inch 0.4.10 → 0.5.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -11
  3. data/Gemfile +2 -5
  4. data/README.md +1 -1
  5. data/Rakefile +2 -2
  6. data/bin/inch +3 -3
  7. data/config/defaults.rb +0 -7
  8. data/inch.gemspec +7 -7
  9. data/lib/inch.rb +9 -9
  10. data/lib/inch/api.rb +10 -10
  11. data/lib/inch/api/compare.rb +2 -2
  12. data/lib/inch/api/compare/code_objects.rb +3 -2
  13. data/lib/inch/api/compare/codebases.rb +1 -1
  14. data/lib/inch/api/diff.rb +10 -7
  15. data/lib/inch/api/filter.rb +1 -1
  16. data/lib/inch/api/get.rb +1 -1
  17. data/lib/inch/api/options/base.rb +4 -4
  18. data/lib/inch/api/options/filter.rb +4 -0
  19. data/lib/inch/api/options/suggest.rb +5 -1
  20. data/lib/inch/api/stats.rb +1 -0
  21. data/lib/inch/api/suggest.rb +10 -9
  22. data/lib/inch/cli.rb +6 -6
  23. data/lib/inch/cli/arguments.rb +2 -2
  24. data/lib/inch/cli/command.rb +15 -15
  25. data/lib/inch/cli/command/base.rb +4 -4
  26. data/lib/inch/cli/command/console.rb +5 -5
  27. data/lib/inch/cli/command/diff.rb +8 -7
  28. data/lib/inch/cli/command/inspect.rb +4 -5
  29. data/lib/inch/cli/command/list.rb +4 -4
  30. data/lib/inch/cli/command/options/base.rb +8 -8
  31. data/lib/inch/cli/command/options/base_list.rb +5 -9
  32. data/lib/inch/cli/command/options/console.rb +3 -4
  33. data/lib/inch/cli/command/options/diff.rb +6 -8
  34. data/lib/inch/cli/command/options/inspect.rb +2 -2
  35. data/lib/inch/cli/command/options/list.rb +2 -3
  36. data/lib/inch/cli/command/options/show.rb +2 -2
  37. data/lib/inch/cli/command/options/stats.rb +1 -2
  38. data/lib/inch/cli/command/options/suggest.rb +3 -6
  39. data/lib/inch/cli/command/output/base.rb +6 -4
  40. data/lib/inch/cli/command/output/console.rb +5 -4
  41. data/lib/inch/cli/command/output/diff.rb +6 -6
  42. data/lib/inch/cli/command/output/inspect.rb +8 -6
  43. data/lib/inch/cli/command/output/list.rb +1 -0
  44. data/lib/inch/cli/command/output/show.rb +5 -4
  45. data/lib/inch/cli/command/output/stats.rb +21 -21
  46. data/lib/inch/cli/command/output/suggest.rb +27 -30
  47. data/lib/inch/cli/command/show.rb +4 -4
  48. data/lib/inch/cli/command/stats.rb +4 -4
  49. data/lib/inch/cli/command/suggest.rb +6 -6
  50. data/lib/inch/cli/command_parser.rb +5 -6
  51. data/lib/inch/cli/sparkline_helper.rb +6 -6
  52. data/lib/inch/cli/trace_helper.rb +1 -1
  53. data/lib/inch/cli/yardopts_helper.rb +3 -4
  54. data/lib/inch/code_object.rb +3 -3
  55. data/lib/inch/code_object/converter.rb +8 -6
  56. data/lib/inch/code_object/provider.rb +1 -1
  57. data/lib/inch/code_object/provider/yard.rb +12 -10
  58. data/lib/inch/code_object/provider/yard/docstring.rb +19 -51
  59. data/lib/inch/code_object/provider/yard/nodoc_helper.rb +4 -4
  60. data/lib/inch/code_object/provider/yard/object.rb +10 -12
  61. data/lib/inch/code_object/provider/yard/object/base.rb +27 -48
  62. data/lib/inch/code_object/provider/yard/object/method_object.rb +10 -47
  63. data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +6 -10
  64. data/lib/inch/code_object/provider/yard/object/method_signature.rb +8 -12
  65. data/lib/inch/code_object/provider/yard/object/namespace_object.rb +4 -1
  66. data/lib/inch/code_object/provider/yard/parser.rb +3 -3
  67. data/lib/inch/code_object/proxy.rb +9 -10
  68. data/lib/inch/code_object/proxy/base.rb +10 -12
  69. data/lib/inch/code_object/proxy/method_object.rb +2 -3
  70. data/lib/inch/code_object/proxy/method_parameter_object.rb +3 -5
  71. data/lib/inch/codebase.rb +5 -4
  72. data/lib/inch/codebase/objects_filter.rb +4 -2
  73. data/lib/inch/codebase/serializer.rb +3 -3
  74. data/lib/inch/config.rb +2 -2
  75. data/lib/inch/config/base.rb +1 -0
  76. data/lib/inch/config/codebase.rb +4 -4
  77. data/lib/inch/core_ext.rb +1 -1
  78. data/lib/inch/core_ext/string.rb +1 -1
  79. data/lib/inch/evaluation.rb +15 -16
  80. data/lib/inch/evaluation/file.rb +1 -1
  81. data/lib/inch/evaluation/grade_list.rb +2 -2
  82. data/lib/inch/evaluation/object_schema.rb +1 -1
  83. data/lib/inch/evaluation/proxy.rb +7 -8
  84. data/lib/inch/evaluation/proxy/base.rb +10 -13
  85. data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
  86. data/lib/inch/evaluation/proxy/method_object.rb +5 -12
  87. data/lib/inch/evaluation/proxy/module_object.rb +1 -1
  88. data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
  89. data/lib/inch/evaluation/role/base.rb +1 -1
  90. data/lib/inch/evaluation/role/method.rb +2 -2
  91. data/lib/inch/evaluation/role/method_parameter.rb +1 -2
  92. data/lib/inch/evaluation/role/object.rb +2 -2
  93. data/lib/inch/rake.rb +2 -2
  94. data/lib/inch/rake/suggest.rb +2 -3
  95. data/lib/inch/utils/shell_helper.rb +1 -1
  96. data/lib/inch/utils/ui.rb +5 -5
  97. data/lib/inch/utils/weighted_list.rb +3 -2
  98. data/lib/inch/version.rb +1 -1
  99. data/test/fixtures/simple/lib/broken.rb +7 -35
  100. data/test/fixtures/simple/lib/foo.rb +1 -22
  101. data/test/integration/api/compare/codebases.rb +1 -1
  102. data/test/integration/cli/command/console_test.rb +5 -5
  103. data/test/integration/cli/command/inspect_test.rb +5 -4
  104. data/test/integration/cli/command/list_test.rb +4 -3
  105. data/test/integration/cli/command/show_test.rb +4 -4
  106. data/test/integration/cli/command/stats_test.rb +2 -2
  107. data/test/integration/cli/command/suggest_test.rb +10 -10
  108. data/test/integration/stats_options_test.rb +3 -3
  109. data/test/integration/visibility_options_test.rb +13 -13
  110. data/test/shared/base_list.rb +3 -4
  111. data/test/test_helper.rb +6 -16
  112. data/test/unit/api/filter_test.rb +7 -7
  113. data/test/unit/api/get_test.rb +1 -1
  114. data/test/unit/api/list_test.rb +1 -1
  115. data/test/unit/api/options/base_test.rb +3 -3
  116. data/test/unit/api/stats_test.rb +1 -1
  117. data/test/unit/api/suggest_test.rb +3 -3
  118. data/test/unit/cli/arguments_test.rb +1 -1
  119. data/test/unit/cli/command/base_test.rb +1 -1
  120. data/test/unit/cli/command/options/base_list_test.rb +2 -2
  121. data/test/unit/cli/command/options/base_object_test.rb +1 -1
  122. data/test/unit/cli/command/options/base_test.rb +1 -1
  123. data/test/unit/cli/command_parser_test.rb +2 -2
  124. data/test/unit/cli/trace_helper_test.rb +1 -1
  125. data/test/unit/cli/yardopts_helper_test.rb +3 -4
  126. data/test/unit/code_object/converter_test.rb +1 -1
  127. data/test/unit/code_object/provider/yard/docstring_test.rb +28 -106
  128. data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -6
  129. data/test/unit/code_object/provider/yard/object/method_object_test.rb +10 -20
  130. data/test/unit/code_object/provider/yard_test.rb +4 -4
  131. data/test/unit/code_object/provider_test.rb +1 -1
  132. data/test/unit/code_object/proxy/method_object_test.rb +262 -382
  133. data/test/unit/code_object/proxy_test.rb +1 -1
  134. data/test/unit/codebase/objects_test.rb +2 -2
  135. data/test/unit/codebase/proxy_test.rb +1 -1
  136. data/test/unit/config/codebase_test.rb +1 -1
  137. data/test/unit/evaluation/role/base_test.rb +2 -2
  138. data/test/unit/utils/ui_test.rb +4 -4
  139. data/test/unit/utils/weighted_list_test.rb +4 -7
  140. metadata +4 -14
  141. data/.rubocop.yml +0 -15
  142. data/.rubocop_todo.yml +0 -94
  143. data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
  144. data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
  145. data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
  146. data/lib/inch/evaluation/role/class_variable.rb +0 -55
  147. data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +0 -7
  148. data/test/fixtures/simple/lib/directives.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8db784f667f4f70a4d90d9ab4ea5485e38f31590
4
- data.tar.gz: ff193873fff093ae113b9efde21245b69019f0ad
3
+ metadata.gz: 9b627b3f3280cb1d20ff03e3a90decafe62cae3e
4
+ data.tar.gz: 5489c5a9d46a46e20d924aef08063bd4a2663998
5
5
  SHA512:
6
- metadata.gz: ff12fd72f9f142eb7ae4217f003f5f4579f1a05f15baf4d95e583b489380096bdd2b041870b7bd5e4bc2ab8e11ebbb51aabdcc2890683e986f9f49d61440e1e8
7
- data.tar.gz: 16b3b9c9a18eea2cb34db191565efeaf01f00688b445cd20417ef0446c2a541a02b9ce561da3a89463932fe6b3dc9f302c006571d5c0baba359ed52c6f0c7849
6
+ metadata.gz: 748f0227ada481c78e398ba26e9c30397293acdefa22244c4b2482accaac8893f0eb10076ce4eb1c2484c91cc8253acd7619b5071e2e9c8189eb1b8676905603
7
+ data.tar.gz: 4e82d4927c776c8c825187821af1d6e4d5abfdbd56d7c5c4f73dbe093d50d85b901d24fc8934bae81dc1c6fd22b7ceac8bc39aa0c52569bc7cb9c32be3a2bfa8
@@ -1,20 +1,11 @@
1
1
  # Changelog
2
2
 
3
3
 
4
- ## 0.4.8
5
-
6
- - Fix a bug related to "CLI classes must be required seperately from now on"
7
- Note to self: read own CHANGELOG more carefully in the future
8
-
9
- ## 0.4.7
4
+ ## 0.5.0 (pre)
10
5
 
11
6
  - CLI classes must be required seperately from now on
12
7
  - external data read by NoDocHelper is encoded as UTF-8
13
- - YARD's attribute directive is now interpreted correctly
14
- - Docs are now evaluated for class variables as well
15
- - TomDoc support has been improved
16
- - Method parameter name recognition has been improved for RDoc style comments
17
- - Compliance with the Ruby Style Guide has been improved (thanks @yous)
8
+
18
9
 
19
10
  ## 0.4.6
20
11
 
data/Gemfile CHANGED
@@ -1,9 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in inch.gemspec
4
4
  gemspec
5
5
 
6
- group :test do
7
- gem "simplecov", require: false
8
- gem "rubocop", require: false
9
- end
6
+ gem 'simplecov', :require => false, :group => :test
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Inch [![Build Status](https://travis-ci.org/rrrene/inch.png)](https://travis-ci.org/rrrene/inch) [![Code Climate](https://codeclimate.com/github/rrrene/inch.png)](https://codeclimate.com/github/rrrene/inch) [![Inline docs](http://inch-ci.org/github/rrrene/inch.png)](http://inch-ci.org/github/rrrene/inch)
1
+ # Inch [![Build Status](https://travis-ci.org/rrrene/inch.png)](https://travis-ci.org/rrrene/inch) [![Code Climate](https://codeclimate.com/github/rrrene/inch.png)](https://codeclimate.com/github/rrrene/inch) [![Inline docs](http://inch-pages.github.io/github/rrrene/inch.png)](http://inch-pages.github.io/github/rrrene/inch)
2
2
 
3
3
  `inch` gives you hints where to improve your docs. One Inch at a time.
4
4
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- require "rake/testtask"
3
+ require 'rake/testtask'
4
4
 
5
5
  Rake::TestTask.new do |t|
6
6
  t.pattern = "test/**/*_test.rb"
@@ -14,4 +14,4 @@ Rake::TestTask.new(:"test:integration") do |t|
14
14
  t.pattern = "test/integration/**/*_test.rb"
15
15
  end
16
16
 
17
- task default: :test
17
+ task :default => :test
data/bin/inch CHANGED
@@ -12,12 +12,12 @@ def find_lib_path
12
12
  while File.symlink?(path)
13
13
  path = File.expand_path(File.readlink(path), File.dirname(path))
14
14
  end
15
- File.join(File.dirname(File.expand_path(path)), "..", "lib")
15
+ File.join(File.dirname(File.expand_path(path)), '..', 'lib')
16
16
  end
17
17
 
18
18
  $LOAD_PATH.unshift(find_lib_path)
19
19
 
20
- require "inch"
21
- require "inch/cli"
20
+ require 'inch'
21
+ require 'inch/cli'
22
22
 
23
23
  Inch::CLI::CommandParser.run(*ARGV)
@@ -64,13 +64,6 @@ Inch::Config.run do
64
64
  unconsidered_tag 0.2
65
65
  end
66
66
 
67
- schema(:ClassVariableObject) do
68
- docstring 1.0
69
-
70
- # optional:
71
- unconsidered_tag 0.2
72
- end
73
-
74
67
  schema(:ClassObject) do
75
68
  docstring 1.0
76
69
 
@@ -1,21 +1,21 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "inch/version"
4
+ require 'inch/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "inch"
8
8
  spec.version = Inch::VERSION
9
9
  spec.authors = ["René Föhring"]
10
10
  spec.email = ["rf@bamaru.de"]
11
- spec.summary = "Documentation measurement tool for Ruby"
12
- spec.description = "Documentation measurement tool for Ruby, based on YARD."
11
+ spec.summary = %q{Documentation measurement tool for Ruby}
12
+ spec.description = %q{Documentation measurement tool for Ruby, based on YARD.}
13
13
  spec.homepage = "http://trivelop.de/inch/"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "minitest", "~> 5.2"
24
24
 
25
25
  spec.add_dependency "pry"
26
- spec.add_dependency "sparkr", ">= 0.2.0"
26
+ spec.add_dependency 'sparkr', ">= 0.2.0"
27
27
  spec.add_dependency "term-ansicolor"
28
28
  spec.add_dependency "yard", "~> 0.8.7"
29
29
  end
@@ -1,15 +1,15 @@
1
- require "inch/version"
1
+ require 'inch/version'
2
2
 
3
3
  module Inch
4
4
  end
5
5
 
6
- require "forwardable"
6
+ require 'forwardable'
7
7
 
8
- require "inch/api"
9
- require "inch/core_ext"
10
- require "inch/codebase"
11
- require "inch/code_object"
12
- require "inch/evaluation"
8
+ require 'inch/api'
9
+ require 'inch/core_ext'
10
+ require 'inch/codebase'
11
+ require 'inch/code_object'
12
+ require 'inch/evaluation'
13
13
 
14
- require "inch/config"
15
- require File.join(File.dirname(__FILE__), "..", "config", "defaults.rb")
14
+ require 'inch/config'
15
+ require File.join(File.dirname(__FILE__), '..', 'config', 'defaults.rb')
@@ -23,14 +23,14 @@ module Inch
23
23
  end
24
24
  end
25
25
 
26
- require "inch/api/options/base"
27
- require "inch/api/options/filter"
28
- require "inch/api/options/suggest"
26
+ require 'inch/api/options/base'
27
+ require 'inch/api/options/filter'
28
+ require 'inch/api/options/suggest'
29
29
 
30
- require "inch/api/compare"
31
- require "inch/api/filter"
32
- require "inch/api/get"
33
- require "inch/api/list"
34
- require "inch/api/suggest"
35
- require "inch/api/stats"
36
- require "inch/api/diff"
30
+ require 'inch/api/compare'
31
+ require 'inch/api/filter'
32
+ require 'inch/api/get'
33
+ require 'inch/api/list'
34
+ require 'inch/api/suggest'
35
+ require 'inch/api/stats'
36
+ require 'inch/api/diff'
@@ -1,2 +1,2 @@
1
- require "inch/api/compare/code_objects"
2
- require "inch/api/compare/codebases"
1
+ require 'inch/api/compare/code_objects'
2
+ require 'inch/api/compare/codebases'
@@ -3,11 +3,11 @@ module Inch
3
3
  module Compare
4
4
  class CodeObjects
5
5
  attr_reader :before, :after
6
-
6
+
7
7
  def initialize(object1, object2)
8
8
  @before, @after = object1, object2
9
9
  if @before.object_id == @after.object_id
10
- fail "@before and @after are identical ruby objects. this is bad."
10
+ raise "@before and @after are identical ruby objects. this is bad."
11
11
  end
12
12
  end
13
13
 
@@ -23,6 +23,7 @@ module Inch
23
23
  @after.grade
24
24
  end
25
25
 
26
+
26
27
  def added?
27
28
  @before.nil? && !@after.nil?
28
29
  end
@@ -31,7 +31,7 @@ module Inch
31
31
  end
32
32
 
33
33
  def find(fullname)
34
- comparisons.find do |comparison|
34
+ comparisons.detect do |comparison|
35
35
  comparison.fullname == fullname
36
36
  end
37
37
  end
@@ -1,4 +1,4 @@
1
- require "inch/utils/shell_helper"
1
+ require 'inch/utils/shell_helper'
2
2
 
3
3
  module Inch
4
4
  module API
@@ -20,17 +20,17 @@ module Inch
20
20
  @work_dir = dir
21
21
  @codebase_old = codebase_for(before_rev)
22
22
  @codebase_new = if after_rev.nil?
23
- Codebase.parse(work_dir)
24
- else
25
- codebase_for(after_rev)
26
- end
23
+ Codebase.parse(work_dir)
24
+ else
25
+ codebase_for(after_rev)
26
+ end
27
27
  @comparer = API::Compare::Codebases.new(@codebase_old, @codebase_new)
28
28
  end
29
29
 
30
30
  private
31
31
 
32
32
  def codebase_for(revision)
33
- if (cached = codebase_from_cache(revision))
33
+ if cached = codebase_from_cache(revision)
34
34
  cached
35
35
  else
36
36
  codebase = codebase_from_copy(work_dir, revision)
@@ -42,7 +42,9 @@ module Inch
42
42
 
43
43
  def codebase_from_cache(revision)
44
44
  filename = Codebase::Serializer.filename(revision)
45
- Codebase::Serializer.load(filename) if File.exist?(filename)
45
+ if File.exist?(filename)
46
+ Codebase::Serializer.load(filename)
47
+ end
46
48
  end
47
49
 
48
50
  def codebase_from_copy(original_dir, revision)
@@ -63,6 +65,7 @@ module Inch
63
65
  def git_reset(dir, revision = nil)
64
66
  git dir, "reset --hard #{revision}"
65
67
  end
68
+
66
69
  end
67
70
  end
68
71
  end
@@ -8,7 +8,7 @@ module Inch
8
8
 
9
9
  def initialize(codebase, options)
10
10
  @codebase = codebase
11
- codebase.objects.filter! Options::Filter.new(options)
11
+ codebase.objects.filter! Options::Filter(options)
12
12
  @objects = codebase.objects.to_a
13
13
  @grade_lists = @codebase.grade_lists
14
14
  end
@@ -18,7 +18,7 @@ module Inch
18
18
  # @return [Array<CodeObject::Proxy::Base>]
19
19
  def find_objects_with_names(object_names)
20
20
  object_names.map do |object_name|
21
- if (object = codebase.objects.find(object_name))
21
+ if object = codebase.objects.find(object_name)
22
22
  object
23
23
  else
24
24
  codebase.objects.starting_with(object_name)
@@ -33,10 +33,10 @@ module Inch
33
33
 
34
34
  def read(options_or_hash, name)
35
35
  value = if options_or_hash.is_a?(Hash)
36
- options_or_hash[name]
37
- else
38
- options_or_hash.send(name)
39
- end
36
+ options_or_hash[name]
37
+ else
38
+ options_or_hash.send(name)
39
+ end
40
40
  instance_variable_set("@#{name}", value)
41
41
  end
42
42
  end
@@ -16,6 +16,10 @@ module Inch
16
16
  attribute :undocumented
17
17
  attribute :depth
18
18
  end
19
+
20
+ def self.Filter(options_or_hash)
21
+ Filter.new(options_or_hash)
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -1,4 +1,4 @@
1
- require "inch/evaluation/proxy/base"
1
+ require 'inch/evaluation/proxy/base'
2
2
 
3
3
  module Inch
4
4
  module API
@@ -27,6 +27,10 @@ module Inch
27
27
  attribute :object_min_priority, DEFAULT_OBJECT_MIN_PRIORITY
28
28
  attribute :object_max_score, DEFAULT_OBJECT_MAX_SCORE
29
29
  end
30
+
31
+ def self.Suggest(options_or_hash)
32
+ Suggest.new(options_or_hash)
33
+ end
30
34
  end
31
35
  end
32
36
  end
@@ -1,6 +1,7 @@
1
1
  module Inch
2
2
  module API
3
3
  class Stats < Filter
4
+
4
5
  end
5
6
  end
6
7
  end
@@ -1,11 +1,11 @@
1
- require "inch/utils/weighted_list"
1
+ require 'inch/utils/weighted_list'
2
2
 
3
3
  module Inch
4
4
  module API
5
5
  class Suggest < Filter
6
6
  def initialize(codebase, options)
7
7
  super
8
- @options = Options::Suggest.new(options)
8
+ @options = Options::Suggest(options)
9
9
  end
10
10
 
11
11
  def files
@@ -19,6 +19,7 @@ module Inch
19
19
  filter_objects_to_display
20
20
  end
21
21
 
22
+
22
23
  # @return [Array] all the objects that match +@options+
23
24
  def all_objects
24
25
  relevant_objects
@@ -51,13 +52,15 @@ module Inch
51
52
 
52
53
  list = Codebase::Objects.sort_by_priority(weighted_list.to_a.flatten)
53
54
 
54
- list = list[0...object_count] if list.size > object_count
55
+ if list.size > object_count
56
+ list = list[0...object_count]
57
+ end
55
58
  list
56
59
  end
57
60
 
58
61
  def files_sorted_by_importance
59
62
  list = all_filenames(relevant_objects).uniq.map do |filename|
60
- Evaluation::File.for(filename, relevant_objects)
63
+ f = Evaluation::File.for(filename, relevant_objects)
61
64
  end
62
65
 
63
66
  priority_list = list.select do |f|
@@ -65,8 +68,7 @@ module Inch
65
68
  relevant_priorities.include?(f.priority)
66
69
  end
67
70
 
68
- Codebase::Objects.sort_by_priority(
69
- priority_list.empty? ? list : priority_list)
71
+ Codebase::Objects.sort_by_priority(priority_list.empty? ? list : priority_list)
70
72
  end
71
73
 
72
74
  def all_filenames(objects)
@@ -85,7 +87,7 @@ module Inch
85
87
  end
86
88
 
87
89
  def grade_list(grade_symbol)
88
- grade_lists.find { |r| r.grade.to_sym == grade_symbol }
90
+ grade_lists.detect { |r| r.grade.to_sym == grade_symbol }
89
91
  end
90
92
 
91
93
  def select_by_priority(list, min_priority)
@@ -97,8 +99,7 @@ module Inch
97
99
  end
98
100
 
99
101
  def relevant_objects
100
- @relevant_objects ||= select_by_priority(codebase.objects,
101
- @options.object_min_priority)
102
+ @relevant_objects ||= select_by_priority(codebase.objects, @options.object_min_priority)
102
103
  end
103
104
 
104
105
  def relevant_priorities
@@ -11,7 +11,7 @@ module Inch
11
11
  # @return [Fixnum]
12
12
  def get_term_columns(default = 80)
13
13
  str = `stty size`
14
- rows_cols = str.split(" ").map(&:to_i)
14
+ rows_cols = str.split(' ').map(&:to_i)
15
15
  rows_cols[1] || default
16
16
  rescue
17
17
  default
@@ -21,9 +21,9 @@ module Inch
21
21
  end
22
22
  end
23
23
 
24
- require "inch/cli/arguments"
25
- require "inch/cli/sparkline_helper"
26
- require "inch/cli/trace_helper"
27
- require "inch/cli/yardopts_helper"
24
+ require 'inch/cli/arguments'
25
+ require 'inch/cli/sparkline_helper'
26
+ require 'inch/cli/trace_helper'
27
+ require 'inch/cli/yardopts_helper'
28
28
 
29
- require "inch/cli/command"
29
+ require 'inch/cli/command'
@@ -28,10 +28,10 @@ module Inch
28
28
  # @param args [Array<String>]
29
29
  # @return [void]
30
30
  def parse(args)
31
- if (first_non_file = args.find_index { |e| !glob_or_file?(e) })
31
+ if first_non_file = args.find_index { |e| !glob_or_file?(e) }
32
32
  @files = args[0...first_non_file]
33
33
  rest = args[first_non_file..-1]
34
- if (first_switch = rest.find_index { |e| switch?(e) })
34
+ if first_switch = rest.find_index { |e| switch?(e) }
35
35
  @object_names = rest[0...first_switch]
36
36
  @switches = rest[first_switch..-1]
37
37
  else