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
@@ -1,19 +1,19 @@
1
- require "inch/cli/command/base"
2
- require "inch/cli/command/base_list"
3
- require "inch/cli/command/base_object"
1
+ require 'inch/cli/command/base'
2
+ require 'inch/cli/command/base_list'
3
+ require 'inch/cli/command/base_object'
4
4
 
5
- require "inch/cli/command/options/base"
6
- require "inch/cli/command/options/base_list"
7
- require "inch/cli/command/options/base_object"
5
+ require 'inch/cli/command/options/base'
6
+ require 'inch/cli/command/options/base_list'
7
+ require 'inch/cli/command/options/base_object'
8
8
 
9
- require "inch/cli/command/output/base"
9
+ require 'inch/cli/command/output/base'
10
10
 
11
- require "inch/cli/command_parser"
11
+ require 'inch/cli/command_parser'
12
12
 
13
- require "inch/cli/command/list"
14
- require "inch/cli/command/show"
15
- require "inch/cli/command/stats"
16
- require "inch/cli/command/suggest"
17
- require "inch/cli/command/console"
18
- require "inch/cli/command/inspect"
19
- require "inch/cli/command/diff"
13
+ require 'inch/cli/command/list'
14
+ require 'inch/cli/command/show'
15
+ require 'inch/cli/command/stats'
16
+ require 'inch/cli/command/suggest'
17
+ require 'inch/cli/command/console'
18
+ require 'inch/cli/command/inspect'
19
+ require 'inch/cli/command/diff'
@@ -60,7 +60,7 @@ module Inch
60
60
  end
61
61
 
62
62
  def initialize
63
- name = self.class.to_s.split("::").last
63
+ name = self.class.to_s.split('::').last
64
64
  options_class = Command::Options.const_get(name)
65
65
  @options = options_class.new
66
66
  @options.usage = usage
@@ -87,9 +87,9 @@ module Inch
87
87
  #
88
88
  # @abstract
89
89
  # @note Override with implementation
90
- # @param *_args [Array<String>]
91
- def run(*_args)
92
- fail NotImplementedError
90
+ # @param *args [Array<String>]
91
+ def run(*args)
92
+ raise NotImplementedError
93
93
  end
94
94
 
95
95
  # Returns a description of the command's usage pattern
@@ -1,6 +1,6 @@
1
- require "pry"
2
- require "inch/cli/command/options/console"
3
- require "inch/cli/command/output/console"
1
+ require 'pry'
2
+ require 'inch/cli/command/options/console'
3
+ require 'inch/cli/command/output/console'
4
4
 
5
5
  module Inch
6
6
  module CLI
@@ -9,11 +9,11 @@ module Inch
9
9
  register_command_as :console
10
10
 
11
11
  def description
12
- "Shows a console"
12
+ 'Shows a console'
13
13
  end
14
14
 
15
15
  def usage
16
- "Usage: inch console [paths] [OBJECT_NAME] [options]"
16
+ 'Usage: inch console [paths] [OBJECT_NAME] [options]'
17
17
  end
18
18
 
19
19
  def run(*args)
@@ -1,6 +1,6 @@
1
- require "pry"
2
- require "inch/cli/command/options/diff"
3
- require "inch/cli/command/output/diff"
1
+ require 'pry'
2
+ require 'inch/cli/command/options/diff'
3
+ require 'inch/cli/command/output/diff'
4
4
 
5
5
  module Inch
6
6
  module CLI
@@ -11,11 +11,11 @@ module Inch
11
11
  register_command_as :diff
12
12
 
13
13
  def description
14
- "Shows a diff"
14
+ 'Shows a diff'
15
15
  end
16
16
 
17
17
  def usage
18
- "Usage: inch diff [REV..[REV]] [options]"
18
+ 'Usage: inch diff [REV..[REV]] [options]'
19
19
  end
20
20
 
21
21
  def run(*args)
@@ -33,8 +33,9 @@ module Inch
33
33
  # @return [Array<String>] the revisions passed in the command_line
34
34
  def revisions
35
35
  @revisions ||= @options.revisions.map do |rev|
36
- next unless rev
37
- git(work_dir, "rev-parse #{rev}").strip
36
+ if rev
37
+ git(work_dir, "rev-parse #{rev}").strip
38
+ end
38
39
  end
39
40
  end
40
41
 
@@ -1,5 +1,5 @@
1
- require "inch/cli/command/options/inspect"
2
- require "inch/cli/command/output/inspect"
1
+ require 'inch/cli/command/options/inspect'
2
+ require 'inch/cli/command/output/inspect'
3
3
 
4
4
  module Inch
5
5
  module CLI
@@ -8,12 +8,11 @@ module Inch
8
8
  register_command_as :inspect
9
9
 
10
10
  def description
11
- "Inspects an object"
11
+ 'Inspects an object'
12
12
  end
13
13
 
14
14
  def usage
15
- "Usage: inch inspect [paths] OBJECT_NAME [[OBJECT_NAME2] ...] " \
16
- "[options]"
15
+ 'Usage: inch inspect [paths] OBJECT_NAME [[OBJECT_NAME2] ...] [options]'
17
16
  end
18
17
 
19
18
  def run(*args)
@@ -1,5 +1,5 @@
1
- require "inch/cli/command/options/list"
2
- require "inch/cli/command/output/list"
1
+ require 'inch/cli/command/options/list'
2
+ require 'inch/cli/command/output/list'
3
3
 
4
4
  module Inch
5
5
  module CLI
@@ -8,11 +8,11 @@ module Inch
8
8
  register_command_as :list
9
9
 
10
10
  def description
11
- "Lists all objects with their results"
11
+ 'Lists all objects with their results'
12
12
  end
13
13
 
14
14
  def usage
15
- "Usage: inch list [paths] [options]"
15
+ 'Usage: inch list [paths] [options]'
16
16
  end
17
17
 
18
18
  # Runs the commandline utility, parsing arguments and displaying a
@@ -1,4 +1,4 @@
1
- require "optparse"
1
+ require 'optparse'
2
2
 
3
3
  module Inch
4
4
  module CLI
@@ -91,8 +91,8 @@ module Inch
91
91
  #
92
92
  # @return [String]
93
93
  def description_hint_arrows
94
- arrows = Evaluation::PriorityRange.all.map(&:arrow).join(" ")
95
- "Arrows (#{arrows}) hint at the importance of the object " \
94
+ arrows = Evaluation::PriorityRange.all.map(&:arrow).join(' ')
95
+ "Arrows (#{arrows}) hint at the importance of the object " +
96
96
  "being documented."
97
97
  end
98
98
 
@@ -102,7 +102,7 @@ module Inch
102
102
  # @return [String]
103
103
  def description_hint_grades
104
104
  grades = Evaluation::Grade.all
105
- "School grades (#{grades.join(", ")}) are assigned and " \
105
+ "School grades (#{grades.join(', ')}) are assigned and " +
106
106
  "displayed with each object."
107
107
  end
108
108
 
@@ -126,13 +126,13 @@ module Inch
126
126
  opts.separator ""
127
127
  opts.separator "Other options:"
128
128
  opts.on("--[no-]color", "Run without color") do |v|
129
- Term::ANSIColor.coloring = v
129
+ Term::ANSIColor::coloring = v
130
130
  end
131
- opts.on_tail("-v", "--version", "Show version.") do
131
+ opts.on_tail('-v', '--version', 'Show version.') do
132
132
  ui.trace "inch #{Inch::VERSION}"
133
133
  exit
134
134
  end
135
- opts.on_tail("-h", "--help", "Show this help.") do
135
+ opts.on_tail('-h', '--help', 'Show this help.') do
136
136
  ui.trace opts
137
137
  exit
138
138
  end
@@ -165,7 +165,7 @@ module Inch
165
165
  # Resets the command-line interface before each run
166
166
  def reset
167
167
  # color is enabled by default, can be turned of by switch --no-color
168
- Term::ANSIColor.coloring = true
168
+ Term::ANSIColor::coloring = true
169
169
  end
170
170
 
171
171
  # Callback when an unrecognize option is parsed
@@ -11,7 +11,7 @@ module Inch
11
11
  attribute :depth
12
12
 
13
13
  attribute :show_all, false
14
- alias_method :show_all?, :show_all
14
+ alias :show_all? :show_all
15
15
 
16
16
  def parse(args)
17
17
  opts = OptionParser.new
@@ -37,6 +37,7 @@ module Inch
37
37
 
38
38
  protected
39
39
 
40
+
40
41
  # Sets all list related options for the current Options object
41
42
  #
42
43
  # @param opts [OptionParser]
@@ -49,13 +50,10 @@ module Inch
49
50
  @show_all = true
50
51
  end
51
52
 
52
- opts.on("--only-namespaces",
53
- "Only show namespaces (classes, modules)") do
53
+ opts.on("--only-namespaces", "Only show namespaces (classes, modules)") do
54
54
  @namespaces = :only
55
55
  end
56
- opts.on("--no-namespaces",
57
- "Only show namespace children (methods, constants, " \
58
- "attributes)") do
56
+ opts.on("--no-namespaces", "Only show namespace children (methods, constants, attributes)") do
59
57
  @namespaces = :none
60
58
  end
61
59
 
@@ -76,9 +74,7 @@ module Inch
76
74
  @undocumented = :none
77
75
  end
78
76
 
79
- opts.on("--depth [DEPTH]",
80
- "Only show objects up to a given DEPTH " \
81
- "in the class tree") do |depth|
77
+ opts.on("--depth [DEPTH]", "Only show objects up to a given DEPTH in the class tree") do |depth|
82
78
  @depth = depth.to_i
83
79
  end
84
80
  end
@@ -8,18 +8,17 @@ module Inch
8
8
  "",
9
9
  "Provides a PRY based REPL to inspect objects.",
10
10
  "",
11
- "Example: " +
12
- "$ inch console lib/**/*.rb Foo::Bar#initialize".color(:cyan),
11
+ "Example: " + "$ inch console lib/**/*.rb Foo::Bar#initialize".color(:cyan),
13
12
  "",
14
13
  "Shortcut commands on the prompt are:",
15
14
  "",
16
15
  "all".ljust(5) + " returns all code objects",
17
16
  "f".ljust(5) + " finds an object by its path",
18
17
  "ff".ljust(5) + " finds all objects given a partial path",
19
- "o".ljust(5) +
20
- " returns the code object for OBJECT_NAME (if present)"
18
+ "o".ljust(5) + " returns the code object for OBJECT_NAME (if present)",
21
19
  ]
22
20
  end
21
+
23
22
  end
24
23
  end
25
24
  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 CLI
@@ -59,13 +59,11 @@ module Inch
59
59
  opts.separator ""
60
60
  opts.separator "Diff options:"
61
61
 
62
- opts.on("--since-last-commit",
63
- "Run diff against last commit (default)") do
62
+ opts.on("--since-last-commit", "Run diff against last commit (default)") do |count|
64
63
  @before_rev = "HEAD"
65
64
  end
66
- opts.on("-p", "--since-last-push",
67
- "Run diff against last pushed commit") do
68
- @before_rev = pushed_rev
65
+ opts.on("-p", "--since-last-push", "Run diff against last pushed commit") do |count|
66
+ @before_rev = get_pushed_rev
69
67
  @since_last_push = true
70
68
  end
71
69
  end
@@ -73,8 +71,8 @@ module Inch
73
71
  # @return [String] the reference for the pushed revision
74
72
  #
75
73
  # @example
76
- # pushed_rev # => "origin/master"
77
- def pushed_rev
74
+ # get_pushed_rev # => "origin/master"
75
+ def get_pushed_rev
78
76
  "#{remote}/#{current_branch}"
79
77
  end
80
78
 
@@ -3,11 +3,11 @@ module Inch
3
3
  module Command
4
4
  module Options
5
5
  class Inspect < BaseObject
6
+
6
7
  def descriptions
7
8
  [
8
9
  "",
9
- "Example: " +
10
- "$ inch inspect lib/**/*.rb Foo::Bar#initialize".color(:cyan),
10
+ "Example: " + "$ inch inspect lib/**/*.rb Foo::Bar#initialize".color(:cyan),
11
11
  "",
12
12
  "Shows one or more objects in detail."
13
13
  ]
@@ -8,8 +8,7 @@ module Inch
8
8
  def descriptions
9
9
  [
10
10
  "",
11
- "Lists objects that can be improved regarding their " \
12
- "documentation ordered by their grade.",
11
+ "Lists objects that can be improved regarding their documentation ordered by their grade.",
13
12
  "",
14
13
  "Example: " + "$ inch list lib/**/*.rb --all".color(:cyan),
15
14
  "",
@@ -20,7 +19,7 @@ module Inch
20
19
 
21
20
  def list_options(opts)
22
21
  super
23
- opts.on("--numbers", "Show numbers instead of grades and arrows") do
22
+ opts.on("--numbers", "Show numbers instead of grades and arrows") do |depth|
24
23
  @numbers = true
25
24
  end
26
25
  end
@@ -3,11 +3,11 @@ module Inch
3
3
  module Command
4
4
  module Options
5
5
  class Show < BaseObject
6
+
6
7
  def descriptions
7
8
  [
8
9
  "",
9
- "Example: " +
10
- "$ inch show lib/**/*.rb Foo::Bar#initialize".color(:cyan),
10
+ "Example: " + "$ inch show lib/**/*.rb Foo::Bar#initialize".color(:cyan),
11
11
  "",
12
12
  "Shows one or more objects in detail.",
13
13
  description_hint_grades,
@@ -9,8 +9,7 @@ module Inch
9
9
 
10
10
  def list_options(opts)
11
11
  super
12
- opts.on("-f", "--format [FORMAT]", FORMATS,
13
- "Set output FORMAT") do |format|
12
+ opts.on("-f", "--format [FORMAT]", FORMATS, "Set output FORMAT") do |format|
14
13
  @format = format
15
14
  end
16
15
  end
@@ -26,11 +26,9 @@ module Inch
26
26
  def descriptions
27
27
  [
28
28
  "",
29
- "Suggests objects and files that can be improved regarding " \
30
- "their documentation.",
29
+ "Suggests objects and files that can be improved regarding their documentation.",
31
30
  "",
32
- "Example: " +
33
- "$ inch suggest lib/**/*.rb --pedantic".color(:cyan),
31
+ "Example: " + "$ inch suggest lib/**/*.rb --pedantic".color(:cyan),
34
32
  "",
35
33
  description_hint_grades,
36
34
  description_hint_arrows
@@ -46,8 +44,7 @@ module Inch
46
44
  opts.on("-n", "--objects [COUNT]", "Show COUNT objects") do |count|
47
45
  @object_count = count.to_i
48
46
  end
49
- opts.on("--pedantic",
50
- "Be excessively concerned with minor details and rules") do
47
+ opts.on("--pedantic", "Be excessively concerned with minor details and rules") do |count|
51
48
  # all objects are considered a priority
52
49
  @object_min_priority = -99
53
50
  # only objects with the highest score are omitted from the list
@@ -1,4 +1,4 @@
1
- require "optparse"
1
+ require 'optparse'
2
2
 
3
3
  module Inch
4
4
  module CLI
@@ -20,13 +20,15 @@ module Inch
20
20
 
21
21
  def priority_arrow(priority, color = :white)
22
22
  Evaluation::PriorityRange.all.each do |range|
23
- return range.arrow.color(color).dark if range.include?(priority)
23
+ if range.include?(priority)
24
+ return range.arrow.color(color).dark
25
+ end
24
26
  end
25
27
  end
26
28
 
27
- def print_file_info(o, color)
29
+ def print_file_info(o, _color)
28
30
  o.files.each do |f|
29
- echo "-> #{f.filename}:#{f.line_no}".color(color)
31
+ echo "-> #{f.filename}:#{f.line_no}".color(_color)
30
32
  end
31
33
  echo separator
32
34
  end
@@ -35,10 +35,11 @@ module Inch
35
35
  @codebase.objects.find(fullname)
36
36
  end
37
37
 
38
- alias_method :all, :all_objects
39
- alias_method :ff, :find_objects
40
- alias_method :f, :find_object
41
- alias_method :o, :object
38
+ alias :all :all_objects
39
+ alias :ff :find_objects
40
+ alias :f :find_object
41
+ alias :o :object
42
+
42
43
 
43
44
  def run
44
45
  ui.trace
@@ -27,7 +27,7 @@ module Inch
27
27
  private
28
28
 
29
29
  def show(added, improved, degraded)
30
- unless added.empty? && improved.empty?
30
+ if !(added.empty? && improved.empty?)
31
31
  ui.trace
32
32
  ui.header("Added or improved:", :green)
33
33
  added.each do |compare|
@@ -38,7 +38,7 @@ module Inch
38
38
  end
39
39
  end
40
40
 
41
- unless degraded.empty?
41
+ if !degraded.empty?
42
42
  ui.trace
43
43
  ui.header("Degraded:", :red)
44
44
  degraded.each do |compare|
@@ -54,6 +54,7 @@ module Inch
54
54
 
55
55
  def puts_added(o)
56
56
  grade = colored_grade(o)
57
+ priority = o.priority
57
58
  change = " + ".dark + grade + " " + priority_arrow(o.priority)
58
59
  ui.sub(" #{change} #{o.fullname}")
59
60
  end
@@ -61,11 +62,10 @@ module Inch
61
62
  def puts_improved(before, o)
62
63
  before_grade = colored_grade(before)
63
64
  grade = colored_grade(o)
64
- change = before_grade + " -> ".dark + grade + " " +
65
- priority_arrow(o.priority)
65
+ change = before_grade + " -> ".dark + grade + " " + priority_arrow(o.priority)
66
66
  ui.sub(" #{change} #{o.fullname}")
67
67
  end
68
- alias_method :puts_degraded, :puts_improved
68
+ alias :puts_degraded :puts_improved
69
69
 
70
70
  def colored_grade(o)
71
71
  r = grade_list(o.grade.to_sym)
@@ -74,7 +74,7 @@ module Inch
74
74
 
75
75
  def grade_list(grade_symbol)
76
76
  @grade_lists ||= Evaluation.new_grade_lists
77
- @grade_lists.find { |r| r.grade.to_sym == grade_symbol }
77
+ @grade_lists.detect { |r| r.grade.to_sym == grade_symbol }
78
78
  end
79
79
 
80
80
  def rev_hint