inch 0.4.6 → 0.4.7
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +113 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -2
- data/README.md +2 -2
- data/Rakefile +2 -2
- data/bin/inch +3 -2
- data/config/defaults.rb +7 -0
- data/inch.gemspec +7 -7
- data/lib/inch.rb +9 -10
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +2 -3
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +6 -9
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/suggest.rb +1 -1
- data/lib/inch/api/stats.rb +0 -1
- data/lib/inch/api/suggest.rb +8 -9
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +2 -2
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +7 -8
- data/lib/inch/cli/command/inspect.rb +5 -4
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +8 -8
- data/lib/inch/cli/command/options/base_list.rb +9 -5
- data/lib/inch/cli/command/options/console.rb +4 -3
- data/lib/inch/cli/command/options/diff.rb +6 -4
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +4 -3
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +2 -1
- data/lib/inch/cli/command/options/suggest.rb +6 -3
- data/lib/inch/cli/command/output/base.rb +2 -4
- data/lib/inch/cli/command/output/console.rb +4 -5
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +6 -8
- data/lib/inch/cli/command/output/list.rb +0 -1
- data/lib/inch/cli/command/output/show.rb +4 -5
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +28 -26
- data/lib/inch/cli/command/show.rb +4 -4
- data/lib/inch/cli/command/stats.rb +4 -4
- data/lib/inch/cli/command/suggest.rb +6 -6
- data/lib/inch/cli/command_parser.rb +6 -5
- data/lib/inch/cli/sparkline_helper.rb +2 -2
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +4 -3
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +6 -8
- data/lib/inch/code_object/provider.rb +1 -1
- data/lib/inch/code_object/provider/yard.rb +10 -12
- data/lib/inch/code_object/provider/yard/docstring.rb +53 -21
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +3 -3
- data/lib/inch/code_object/provider/yard/object.rb +11 -9
- data/lib/inch/code_object/provider/yard/object/base.rb +33 -9
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +12 -0
- data/lib/inch/code_object/provider/yard/object/method_object.rb +36 -11
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +2 -2
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +11 -8
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +1 -4
- data/lib/inch/code_object/provider/yard/parser.rb +2 -2
- data/lib/inch/code_object/proxy.rb +10 -9
- data/lib/inch/code_object/proxy/base.rb +8 -8
- data/lib/inch/code_object/proxy/class_variable_object.rb +8 -0
- data/lib/inch/code_object/proxy/method_object.rb +3 -2
- data/lib/inch/code_object/proxy/method_parameter_object.rb +1 -1
- data/lib/inch/codebase.rb +4 -5
- data/lib/inch/codebase/objects_filter.rb +2 -4
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +2 -2
- data/lib/inch/config/base.rb +0 -1
- data/lib/inch/config/codebase.rb +3 -3
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +16 -15
- data/lib/inch/evaluation/grade_list.rb +2 -2
- data/lib/inch/evaluation/object_schema.rb +1 -1
- data/lib/inch/evaluation/proxy.rb +8 -7
- data/lib/inch/evaluation/proxy/base.rb +12 -7
- data/lib/inch/evaluation/proxy/class_variable_object.rb +19 -0
- data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
- data/lib/inch/evaluation/proxy/method_object.rb +12 -5
- data/lib/inch/evaluation/proxy/module_object.rb +1 -1
- data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
- data/lib/inch/evaluation/role/base.rb +1 -1
- data/lib/inch/evaluation/role/class_variable.rb +55 -0
- data/lib/inch/evaluation/role/method.rb +0 -1
- data/lib/inch/evaluation/role/method_parameter.rb +2 -1
- data/lib/inch/evaluation/role/object.rb +2 -2
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +2 -2
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +2 -3
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/broken.rb +35 -7
- data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +7 -0
- data/test/fixtures/simple/lib/directives.rb +8 -0
- data/test/fixtures/simple/lib/foo.rb +17 -0
- data/test/integration/api/compare/codebases.rb +1 -1
- data/test/integration/cli/command/console_test.rb +5 -5
- data/test/integration/cli/command/inspect_test.rb +4 -5
- data/test/integration/cli/command/list_test.rb +3 -4
- data/test/integration/cli/command/show_test.rb +4 -4
- data/test/integration/cli/command/stats_test.rb +2 -2
- data/test/integration/cli/command/suggest_test.rb +7 -7
- data/test/integration/stats_options_test.rb +3 -3
- data/test/integration/visibility_options_test.rb +13 -13
- data/test/shared/base_list.rb +4 -3
- data/test/test_helper.rb +16 -5
- data/test/unit/api/filter_test.rb +7 -7
- data/test/unit/api/get_test.rb +1 -1
- data/test/unit/api/list_test.rb +1 -1
- data/test/unit/api/options/base_test.rb +3 -3
- data/test/unit/api/stats_test.rb +1 -1
- data/test/unit/api/suggest_test.rb +3 -3
- data/test/unit/cli/arguments_test.rb +1 -1
- data/test/unit/cli/command/base_test.rb +1 -1
- data/test/unit/cli/command/options/base_list_test.rb +2 -2
- data/test/unit/cli/command/options/base_object_test.rb +1 -1
- data/test/unit/cli/command/options/base_test.rb +1 -1
- data/test/unit/cli/command_parser_test.rb +2 -2
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +4 -3
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider/yard/docstring_test.rb +105 -28
- data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -5
- data/test/unit/code_object/provider/yard/object/method_object_test.rb +20 -10
- data/test/unit/code_object/provider/yard_test.rb +4 -4
- data/test/unit/code_object/provider_test.rb +1 -1
- data/test/unit/code_object/proxy/method_object_test.rb +366 -262
- data/test/unit/code_object/proxy_test.rb +1 -1
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +1 -1
- data/test/unit/config/codebase_test.rb +1 -1
- data/test/unit/evaluation/role/base_test.rb +1 -1
- data/test/unit/utils/ui_test.rb +4 -4
- data/test/unit/utils/weighted_list_test.rb +7 -4
- metadata +12 -2
data/lib/inch/cli.rb
CHANGED
@@ -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(
|
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
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
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
|
29
|
+
require "inch/cli/command"
|
data/lib/inch/cli/command.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "inch/cli/command/base"
|
2
|
+
require "inch/cli/command/base_list"
|
3
|
+
require "inch/cli/command/base_object"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
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
|
9
|
+
require "inch/cli/command/output/base"
|
10
10
|
|
11
|
-
require
|
11
|
+
require "inch/cli/command_parser"
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
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(
|
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
|
@@ -89,7 +89,7 @@ module Inch
|
|
89
89
|
# @note Override with implementation
|
90
90
|
# @param *args [Array<String>]
|
91
91
|
def run(*args)
|
92
|
-
|
92
|
+
fail NotImplementedError
|
93
93
|
end
|
94
94
|
|
95
95
|
# Returns a description of the command's usage pattern
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
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
|
-
|
12
|
+
"Shows a console"
|
13
13
|
end
|
14
14
|
|
15
15
|
def usage
|
16
|
-
|
16
|
+
"Usage: inch console [paths] [OBJECT_NAME] [options]"
|
17
17
|
end
|
18
18
|
|
19
19
|
def run(*args)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
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
|
-
|
14
|
+
"Shows a diff"
|
15
15
|
end
|
16
16
|
|
17
17
|
def usage
|
18
|
-
|
18
|
+
"Usage: inch diff [REV..[REV]] [options]"
|
19
19
|
end
|
20
20
|
|
21
21
|
def run(*args)
|
@@ -33,9 +33,8 @@ 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
|
-
|
37
|
-
|
38
|
-
end
|
36
|
+
next unless rev
|
37
|
+
git(work_dir, "rev-parse #{rev}").strip
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
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,11 +8,12 @@ module Inch
|
|
8
8
|
register_command_as :inspect
|
9
9
|
|
10
10
|
def description
|
11
|
-
|
11
|
+
"Inspects an object"
|
12
12
|
end
|
13
13
|
|
14
14
|
def usage
|
15
|
-
|
15
|
+
"Usage: inch inspect [paths] OBJECT_NAME [[OBJECT_NAME2] ...] " \
|
16
|
+
"[options]"
|
16
17
|
end
|
17
18
|
|
18
19
|
def run(*args)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
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
|
-
|
11
|
+
"Lists all objects with their results"
|
12
12
|
end
|
13
13
|
|
14
14
|
def usage
|
15
|
-
|
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
|
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(
|
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
|
129
|
+
Term::ANSIColor.coloring = v
|
130
130
|
end
|
131
|
-
opts.on_tail(
|
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(
|
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
|
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
|
-
|
14
|
+
alias_method :show_all?, :show_all
|
15
15
|
|
16
16
|
def parse(args)
|
17
17
|
opts = OptionParser.new
|
@@ -37,7 +37,6 @@ module Inch
|
|
37
37
|
|
38
38
|
protected
|
39
39
|
|
40
|
-
|
41
40
|
# Sets all list related options for the current Options object
|
42
41
|
#
|
43
42
|
# @param opts [OptionParser]
|
@@ -50,10 +49,13 @@ module Inch
|
|
50
49
|
@show_all = true
|
51
50
|
end
|
52
51
|
|
53
|
-
opts.on("--only-namespaces",
|
52
|
+
opts.on("--only-namespaces",
|
53
|
+
"Only show namespaces (classes, modules)") do
|
54
54
|
@namespaces = :only
|
55
55
|
end
|
56
|
-
opts.on("--no-namespaces",
|
56
|
+
opts.on("--no-namespaces",
|
57
|
+
"Only show namespace children (methods, constants, " \
|
58
|
+
"attributes)") do
|
57
59
|
@namespaces = :none
|
58
60
|
end
|
59
61
|
|
@@ -74,7 +76,9 @@ module Inch
|
|
74
76
|
@undocumented = :none
|
75
77
|
end
|
76
78
|
|
77
|
-
opts.on("--depth [DEPTH]",
|
79
|
+
opts.on("--depth [DEPTH]",
|
80
|
+
"Only show objects up to a given DEPTH " \
|
81
|
+
"in the class tree") do |depth|
|
78
82
|
@depth = depth.to_i
|
79
83
|
end
|
80
84
|
end
|
@@ -8,17 +8,18 @@ module Inch
|
|
8
8
|
"",
|
9
9
|
"Provides a PRY based REPL to inspect objects.",
|
10
10
|
"",
|
11
|
-
"Example: " +
|
11
|
+
"Example: " +
|
12
|
+
"$ inch console lib/**/*.rb Foo::Bar#initialize".color(:cyan),
|
12
13
|
"",
|
13
14
|
"Shortcut commands on the prompt are:",
|
14
15
|
"",
|
15
16
|
"all".ljust(5) + " returns all code objects",
|
16
17
|
"f".ljust(5) + " finds an object by its path",
|
17
18
|
"ff".ljust(5) + " finds all objects given a partial path",
|
18
|
-
"o".ljust(5) +
|
19
|
+
"o".ljust(5) +
|
20
|
+
" returns the code object for OBJECT_NAME (if present)"
|
19
21
|
]
|
20
22
|
end
|
21
|
-
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "inch/utils/shell_helper"
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CLI
|
@@ -18,7 +18,7 @@ module Inch
|
|
18
18
|
"Shows changes in documentation between two revisions " \
|
19
19
|
"(defaults to last commit against current)",
|
20
20
|
"",
|
21
|
-
"Example: " + "$ inch diff HEAD^..HEAD".cyan,
|
21
|
+
"Example: " + "$ inch diff HEAD^..HEAD".color(:cyan),
|
22
22
|
"",
|
23
23
|
description_hint_grades,
|
24
24
|
description_hint_arrows
|
@@ -59,10 +59,12 @@ module Inch
|
|
59
59
|
opts.separator ""
|
60
60
|
opts.separator "Diff options:"
|
61
61
|
|
62
|
-
opts.on("--since-last-commit",
|
62
|
+
opts.on("--since-last-commit",
|
63
|
+
"Run diff against last commit (default)") do
|
63
64
|
@before_rev = "HEAD"
|
64
65
|
end
|
65
|
-
opts.on("-p", "--since-last-push",
|
66
|
+
opts.on("-p", "--since-last-push",
|
67
|
+
"Run diff against last pushed commit") do
|
66
68
|
@before_rev = get_pushed_rev
|
67
69
|
@since_last_push = true
|
68
70
|
end
|
@@ -3,11 +3,11 @@ module Inch
|
|
3
3
|
module Command
|
4
4
|
module Options
|
5
5
|
class Inspect < BaseObject
|
6
|
-
|
7
6
|
def descriptions
|
8
7
|
[
|
9
8
|
"",
|
10
|
-
"Example: " +
|
9
|
+
"Example: " +
|
10
|
+
"$ inch inspect lib/**/*.rb Foo::Bar#initialize".color(:cyan),
|
11
11
|
"",
|
12
12
|
"Shows one or more objects in detail."
|
13
13
|
]
|
@@ -8,9 +8,10 @@ module Inch
|
|
8
8
|
def descriptions
|
9
9
|
[
|
10
10
|
"",
|
11
|
-
"Lists objects that can be improved regarding their
|
11
|
+
"Lists objects that can be improved regarding their " \
|
12
|
+
"documentation ordered by their grade.",
|
12
13
|
"",
|
13
|
-
"Example: " + "$ inch list lib/**/*.rb --all".cyan,
|
14
|
+
"Example: " + "$ inch list lib/**/*.rb --all".color(:cyan),
|
14
15
|
"",
|
15
16
|
description_hint_grades,
|
16
17
|
description_hint_arrows
|
@@ -19,7 +20,7 @@ module Inch
|
|
19
20
|
|
20
21
|
def list_options(opts)
|
21
22
|
super
|
22
|
-
opts.on("--numbers", "Show numbers instead of grades and arrows") do
|
23
|
+
opts.on("--numbers", "Show numbers instead of grades and arrows") do
|
23
24
|
@numbers = true
|
24
25
|
end
|
25
26
|
end
|
@@ -3,11 +3,11 @@ module Inch
|
|
3
3
|
module Command
|
4
4
|
module Options
|
5
5
|
class Show < BaseObject
|
6
|
-
|
7
6
|
def descriptions
|
8
7
|
[
|
9
8
|
"",
|
10
|
-
"Example: " +
|
9
|
+
"Example: " +
|
10
|
+
"$ 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,
|
@@ -26,9 +26,11 @@ module Inch
|
|
26
26
|
def descriptions
|
27
27
|
[
|
28
28
|
"",
|
29
|
-
"Suggests objects and files that can be improved regarding
|
29
|
+
"Suggests objects and files that can be improved regarding " \
|
30
|
+
"their documentation.",
|
30
31
|
"",
|
31
|
-
"Example: " +
|
32
|
+
"Example: " +
|
33
|
+
"$ inch suggest lib/**/*.rb --pedantic".color(:cyan),
|
32
34
|
"",
|
33
35
|
description_hint_grades,
|
34
36
|
description_hint_arrows
|
@@ -44,7 +46,8 @@ module Inch
|
|
44
46
|
opts.on("-n", "--objects [COUNT]", "Show COUNT objects") do |count|
|
45
47
|
@object_count = count.to_i
|
46
48
|
end
|
47
|
-
opts.on("--pedantic",
|
49
|
+
opts.on("--pedantic",
|
50
|
+
"Be excessively concerned with minor details and rules") do
|
48
51
|
# all objects are considered a priority
|
49
52
|
@object_min_priority = -99
|
50
53
|
# only objects with the highest score are omitted from the list
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "optparse"
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CLI
|
@@ -20,9 +20,7 @@ module Inch
|
|
20
20
|
|
21
21
|
def priority_arrow(priority, color = :white)
|
22
22
|
Evaluation::PriorityRange.all.each do |range|
|
23
|
-
if range.include?(priority)
|
24
|
-
return range.arrow.color(color).dark
|
25
|
-
end
|
23
|
+
return range.arrow.color(color).dark if range.include?(priority)
|
26
24
|
end
|
27
25
|
end
|
28
26
|
|
@@ -35,11 +35,10 @@ module Inch
|
|
35
35
|
@codebase.objects.find(fullname)
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
alias_method :all, :all_objects
|
39
|
+
alias_method :ff, :find_objects
|
40
|
+
alias_method :f, :find_object
|
41
|
+
alias_method :o, :object
|
43
42
|
|
44
43
|
def run
|
45
44
|
ui.trace
|