inch 0.5.0.rc5 → 0.5.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -6
- data/.rubocop_todo.yml +40 -34
- data/Gemfile +3 -3
- data/Rakefile +10 -6
- data/bin/inch +5 -5
- data/config/base.rb +4 -4
- data/config/nodejs.rb +44 -1
- data/config/ruby.rb +1 -1
- data/inch.gemspec +17 -17
- data/lib/inch.rb +13 -13
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +1 -1
- data/lib/inch/api/diff.rb +1 -1
- data/lib/inch/api/options/suggest.rb +1 -1
- data/lib/inch/api/suggest.rb +1 -1
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +5 -3
- data/lib/inch/cli/command/base_list.rb +0 -1
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +6 -6
- data/lib/inch/cli/command/inspect.rb +5 -5
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +17 -15
- data/lib/inch/cli/command/options/base_list.rb +17 -17
- data/lib/inch/cli/command/options/base_object.rb +1 -1
- data/lib/inch/cli/command/options/console.rb +13 -13
- data/lib/inch/cli/command/options/diff.rb +19 -19
- data/lib/inch/cli/command/options/inspect.rb +5 -5
- data/lib/inch/cli/command/options/list.rb +7 -7
- data/lib/inch/cli/command/options/show.rb +5 -5
- data/lib/inch/cli/command/options/stats.rb +2 -2
- data/lib/inch/cli/command/options/suggest.rb +12 -12
- data/lib/inch/cli/command/output/base.rb +1 -1
- data/lib/inch/cli/command/output/diff.rb +9 -9
- data/lib/inch/cli/command/output/inspect.rb +13 -13
- data/lib/inch/cli/command/output/list.rb +1 -1
- data/lib/inch/cli/command/output/show.rb +4 -4
- data/lib/inch/cli/command/output/stats.rb +14 -14
- data/lib/inch/cli/command/output/suggest.rb +14 -14
- 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 +4 -4
- data/lib/inch/cli/command_parser.rb +4 -4
- data/lib/inch/cli/sparkline_helper.rb +1 -1
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +1 -1
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/provider.rb +3 -3
- data/lib/inch/code_object/proxy.rb +3 -4
- data/lib/inch/codebase.rb +5 -5
- data/lib/inch/codebase/object.rb +2 -1
- data/lib/inch/codebase/serializer.rb +2 -2
- data/lib/inch/config.rb +6 -6
- data/lib/inch/config/codebase.rb +5 -5
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +8 -8
- data/lib/inch/evaluation/proxy.rb +2 -3
- data/lib/inch/evaluation/role.rb +1 -1
- data/lib/inch/language/elixir/code_object/base.rb +6 -4
- data/lib/inch/language/elixir/evaluation/base.rb +2 -1
- data/lib/inch/language/elixir/evaluation/function_object.rb +1 -1
- data/lib/inch/language/elixir/import.rb +14 -14
- data/lib/inch/language/elixir/provider/reader.rb +1 -1
- data/lib/inch/language/elixir/provider/reader/docstring.rb +13 -0
- data/lib/inch/language/elixir/provider/reader/object.rb +5 -5
- data/lib/inch/language/elixir/provider/reader/object/base.rb +13 -5
- data/lib/inch/language/elixir/provider/reader/object/function_object.rb +1 -1
- data/lib/inch/language/elixir/provider/reader/parser.rb +21 -7
- data/lib/inch/language/elixir/roles/base.rb +3 -3
- data/lib/inch/language/elixir/roles/function.rb +2 -1
- data/lib/inch/language/elixir/roles/object.rb +1 -1
- data/lib/inch/language/nodejs/code_object/base.rb +199 -0
- data/lib/inch/language/nodejs/code_object/function_object.rb +74 -0
- data/lib/inch/language/nodejs/code_object/member_object.rb +11 -0
- data/lib/inch/language/nodejs/code_object/module_object.rb +23 -0
- data/lib/inch/language/nodejs/evaluation/base.rb +29 -0
- data/lib/inch/language/nodejs/evaluation/function_object.rb +31 -0
- data/lib/inch/language/nodejs/evaluation/member_object.rb +11 -0
- data/lib/inch/language/nodejs/evaluation/module_object.rb +27 -0
- data/lib/inch/language/nodejs/import.rb +17 -1
- data/lib/inch/language/nodejs/provider/jsdoc.rb +1 -1
- data/lib/inch/language/nodejs/provider/jsdoc/docstring.rb +13 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object.rb +16 -8
- data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +82 -45
- data/lib/inch/language/nodejs/provider/jsdoc/object/function_object.rb +18 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/member_object.rb +15 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/module_object.rb +22 -0
- data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +9 -10
- data/lib/inch/language/nodejs/roles/base.rb +32 -0
- data/lib/inch/language/nodejs/roles/function.rb +113 -0
- data/lib/inch/language/nodejs/roles/member.rb +13 -0
- data/lib/inch/language/nodejs/roles/module.rb +64 -0
- data/lib/inch/language/nodejs/roles/object.rb +76 -0
- data/lib/inch/language/ruby/code_object/base.rb +6 -4
- data/lib/inch/language/ruby/evaluation/base.rb +2 -1
- data/lib/inch/language/ruby/evaluation/method_object.rb +2 -1
- data/lib/inch/language/ruby/import.rb +24 -24
- data/lib/inch/language/ruby/provider/yard.rb +10 -10
- data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +2 -2
- data/lib/inch/language/ruby/provider/yard/object.rb +9 -9
- data/lib/inch/language/ruby/provider/yard/object/base.rb +25 -28
- data/lib/inch/language/ruby/provider/yard/object/method_object.rb +4 -3
- data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +4 -3
- data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +2 -2
- data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +2 -1
- data/lib/inch/language/ruby/provider/yard/parser.rb +2 -2
- data/lib/inch/language/ruby/roles/base.rb +1 -1
- data/lib/inch/language/ruby/roles/method.rb +2 -1
- data/lib/inch/language/ruby/roles/method_parameter.rb +1 -1
- data/lib/inch/language/ruby/roles/missing.rb +2 -2
- data/lib/inch/language/ruby/roles/object.rb +6 -6
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +5 -5
- data/lib/inch/utils/code_location.rb +12 -0
- data/lib/inch/utils/read_write_methods.rb +2 -2
- data/lib/inch/utils/ui.rb +8 -8
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/elixir/simple/all.json +321 -0
- data/test/integration/api/compare/codebases.rb +6 -6
- data/test/integration/cli/command/console_test.rb +13 -13
- data/test/integration/cli/command/diff_test.rb +12 -14
- data/test/integration/cli/command/inspect_test.rb +30 -30
- data/test/integration/cli/command/list_test.rb +34 -34
- data/test/integration/cli/command/show_test.rb +26 -26
- data/test/integration/cli/command/stats_test.rb +23 -23
- data/test/integration/cli/command/suggest_test.rb +58 -49
- data/test/integration/stats_options_test.rb +9 -9
- data/test/integration/visibility_options_test.rb +49 -45
- data/test/shared/base_list.rb +41 -41
- data/test/test_helper.rb +18 -10
- data/test/unit/api/filter_test.rb +9 -9
- data/test/unit/api/get_test.rb +6 -6
- data/test/unit/api/list_test.rb +3 -3
- data/test/unit/api/options/base_test.rb +6 -6
- data/test/unit/api/stats_test.rb +3 -3
- data/test/unit/api/suggest_test.rb +4 -4
- data/test/unit/cli/arguments_test.rb +25 -25
- data/test/unit/cli/command/base_test.rb +3 -3
- data/test/unit/cli/command/options/base_list_test.rb +14 -14
- data/test/unit/cli/command/options/base_object_test.rb +6 -6
- data/test/unit/cli/command/options/base_test.rb +3 -3
- data/test/unit/cli/command_parser_test.rb +29 -29
- data/test/unit/cli/trace_helper_test.rb +2 -2
- data/test/unit/cli/yardopts_helper_test.rb +35 -35
- data/test/unit/code_object/converter_test.rb +3 -3
- data/test/unit/code_object/provider_test.rb +2 -2
- data/test/unit/code_object/proxy_test.rb +11 -11
- data/test/unit/codebase/objects_test.rb +8 -8
- data/test/unit/codebase/proxy_test.rb +5 -5
- data/test/unit/config/codebase_test.rb +3 -3
- data/test/unit/config_test.rb +4 -4
- data/test/unit/evaluation/role_test.rb +8 -8
- data/test/unit/language/elixir/code_object/function_object_test.rb +35 -0
- data/test/unit/language/ruby/code_object/method_object_test.rb +128 -126
- data/test/unit/language/ruby/provider/yard/docstring_test.rb +27 -23
- data/test/unit/language/ruby/provider/yard/nodoc_helper_test.rb +21 -20
- data/test/unit/language/ruby/provider/yard/object/method_object_test.rb +20 -17
- data/test/unit/language/ruby/provider/yard_test.rb +4 -4
- data/test/unit/utils/buffered_ui_test.rb +20 -20
- data/test/unit/utils/ui_test.rb +20 -20
- data/test/unit/utils/weighted_list_test.rb +7 -7
- metadata +25 -2
@@ -5,11 +5,11 @@ module Inch
|
|
5
5
|
class Inspect < BaseObject
|
6
6
|
def descriptions
|
7
7
|
[
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
'',
|
9
|
+
'Example: ' +
|
10
|
+
'$ inch inspect lib/**/*.rb Foo::Bar#initialize'.color(:cyan),
|
11
|
+
'',
|
12
|
+
'Shows one or more objects in detail.'
|
13
13
|
]
|
14
14
|
end
|
15
15
|
|
@@ -7,12 +7,12 @@ module Inch
|
|
7
7
|
|
8
8
|
def descriptions
|
9
9
|
[
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
'',
|
11
|
+
'Lists objects that can be improved regarding their ' \
|
12
|
+
'documentation ordered by their grade.',
|
13
|
+
'',
|
14
|
+
'Example: ' + '$ inch list lib/**/*.rb --all'.color(:cyan),
|
15
|
+
'',
|
16
16
|
description_hint_grades,
|
17
17
|
description_hint_arrows
|
18
18
|
]
|
@@ -20,7 +20,7 @@ module Inch
|
|
20
20
|
|
21
21
|
def list_options(opts)
|
22
22
|
super
|
23
|
-
opts.on(
|
23
|
+
opts.on('--numbers', 'Show numbers instead of grades and arrows') do
|
24
24
|
@numbers = true
|
25
25
|
end
|
26
26
|
end
|
@@ -5,11 +5,11 @@ module Inch
|
|
5
5
|
class Show < BaseObject
|
6
6
|
def descriptions
|
7
7
|
[
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
'',
|
9
|
+
'Example: ' +
|
10
|
+
'$ inch show lib/**/*.rb Foo::Bar#initialize'.color(:cyan),
|
11
|
+
'',
|
12
|
+
'Shows one or more objects in detail.',
|
13
13
|
description_hint_grades,
|
14
14
|
description_hint_arrows
|
15
15
|
]
|
@@ -25,13 +25,13 @@ module Inch
|
|
25
25
|
|
26
26
|
def descriptions
|
27
27
|
[
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
'',
|
29
|
+
'Suggests objects and files that can be improved regarding ' \
|
30
|
+
'their documentation.',
|
31
|
+
'',
|
32
|
+
'Example: ' +
|
33
|
+
'$ inch suggest lib/**/*.rb --pedantic'.color(:cyan),
|
34
|
+
'',
|
35
35
|
description_hint_grades,
|
36
36
|
description_hint_arrows
|
37
37
|
]
|
@@ -40,14 +40,14 @@ module Inch
|
|
40
40
|
protected
|
41
41
|
|
42
42
|
def suggest_options(opts)
|
43
|
-
opts.separator
|
44
|
-
opts.separator
|
43
|
+
opts.separator ''
|
44
|
+
opts.separator 'Suggest options:'
|
45
45
|
|
46
|
-
opts.on(
|
46
|
+
opts.on('-n', '--objects [COUNT]', 'Show COUNT objects') do |count|
|
47
47
|
@object_count = count.to_i
|
48
48
|
end
|
49
|
-
opts.on(
|
50
|
-
|
49
|
+
opts.on('--pedantic',
|
50
|
+
'Be excessively concerned with minor details and rules') do
|
51
51
|
# all objects are considered a priority
|
52
52
|
@object_min_priority = -99
|
53
53
|
# only objects with the highest score are omitted from the list
|
@@ -18,7 +18,7 @@ module Inch
|
|
18
18
|
degraded = @comparer.degraded_objects
|
19
19
|
|
20
20
|
if added.empty? && improved.empty? && degraded.empty?
|
21
|
-
ui.trace
|
21
|
+
ui.trace 'No changes.'
|
22
22
|
else
|
23
23
|
show(added, improved, degraded)
|
24
24
|
end
|
@@ -29,7 +29,7 @@ module Inch
|
|
29
29
|
def show(added, improved, degraded)
|
30
30
|
unless added.empty? && improved.empty?
|
31
31
|
ui.trace
|
32
|
-
ui.header(
|
32
|
+
ui.header('Added or improved:', :green)
|
33
33
|
added.each do |compare|
|
34
34
|
puts_added compare.after
|
35
35
|
end
|
@@ -40,7 +40,7 @@ module Inch
|
|
40
40
|
|
41
41
|
unless degraded.empty?
|
42
42
|
ui.trace
|
43
|
-
ui.header(
|
43
|
+
ui.header('Degraded:', :red)
|
44
44
|
degraded.each do |compare|
|
45
45
|
puts_degraded compare.before, compare.after
|
46
46
|
end
|
@@ -48,20 +48,20 @@ module Inch
|
|
48
48
|
ui.trace
|
49
49
|
ui.trace rev_hint
|
50
50
|
ui.trace
|
51
|
-
ui.trace
|
51
|
+
ui.trace 'Format: grade (before -> after), priority, and name. ' \
|
52
52
|
"Try `--help' for options.".dark
|
53
53
|
end
|
54
54
|
|
55
55
|
def puts_added(o)
|
56
56
|
grade = colored_grade(o)
|
57
|
-
change =
|
57
|
+
change = ' + '.dark + grade + ' ' + priority_arrow(o.priority)
|
58
58
|
ui.sub(" #{change} #{o.fullname}")
|
59
59
|
end
|
60
60
|
|
61
61
|
def puts_improved(before, o)
|
62
62
|
before_grade = colored_grade(before)
|
63
63
|
grade = colored_grade(o)
|
64
|
-
change = before_grade +
|
64
|
+
change = before_grade + ' -> '.dark + grade + ' ' +
|
65
65
|
priority_arrow(o.priority)
|
66
66
|
ui.sub(" #{change} #{o.fullname}")
|
67
67
|
end
|
@@ -79,13 +79,13 @@ module Inch
|
|
79
79
|
|
80
80
|
def rev_hint
|
81
81
|
if @options.since_last_commit?
|
82
|
-
|
82
|
+
'Showing changes since your last commit.'
|
83
83
|
elsif @options.since_last_push?
|
84
|
-
|
84
|
+
'Showing changes since you last pushed.'
|
85
85
|
else
|
86
86
|
revisions = @options.revisions
|
87
87
|
before_rev = revisions[0]
|
88
|
-
after_rev = revisions[1] ||
|
88
|
+
after_rev = revisions[1] || 'now'
|
89
89
|
"Showing changes between #{before_rev} and #{after_rev}."
|
90
90
|
end
|
91
91
|
end
|
@@ -48,7 +48,7 @@ module Inch
|
|
48
48
|
def print_code_info(o)
|
49
49
|
if o.method?
|
50
50
|
CommentAndAbbrevSource.new(o).lines.each do |line|
|
51
|
-
echo line.gsub(/\n$/m,
|
51
|
+
echo line.gsub(/\n$/m, '').color(COMMENT_COLOR)
|
52
52
|
end
|
53
53
|
echo separator
|
54
54
|
end
|
@@ -56,7 +56,7 @@ module Inch
|
|
56
56
|
|
57
57
|
def print_roles_info(o)
|
58
58
|
if o.roles.empty?
|
59
|
-
echo
|
59
|
+
echo 'No roles assigned.'.dark
|
60
60
|
else
|
61
61
|
o.roles.each do |role|
|
62
62
|
print_role_info(role)
|
@@ -66,7 +66,7 @@ module Inch
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def print_role_info(role)
|
69
|
-
name = role.class.to_s.split(
|
69
|
+
name = role.class.to_s.split('::Role::').last
|
70
70
|
score = colored_role_score(role)
|
71
71
|
|
72
72
|
priority = role.priority.to_s.rjust(4)
|
@@ -86,9 +86,9 @@ module Inch
|
|
86
86
|
|
87
87
|
def print_namespace_info(o)
|
88
88
|
if o.namespace?
|
89
|
-
echo
|
89
|
+
echo 'Children:'
|
90
90
|
o.children.each do |child|
|
91
|
-
echo
|
91
|
+
echo '+ ' + child.fullname.color(COLOR)
|
92
92
|
end
|
93
93
|
echo separator
|
94
94
|
end
|
@@ -105,20 +105,20 @@ module Inch
|
|
105
105
|
|
106
106
|
def colored_score(value, score)
|
107
107
|
if value < 0
|
108
|
-
(
|
108
|
+
('-' + score).red
|
109
109
|
elsif value > 0
|
110
|
-
(
|
110
|
+
('+' + score).green
|
111
111
|
else
|
112
|
-
|
112
|
+
' ' + score
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
def echo(msg =
|
116
|
+
def echo(msg = '')
|
117
117
|
ui.edged(COLOR, msg)
|
118
118
|
end
|
119
119
|
|
120
120
|
def separator
|
121
|
-
|
121
|
+
'-'.color(COLOR) * (CLI::COLUMNS - 2)
|
122
122
|
end
|
123
123
|
|
124
124
|
class CommentAndAbbrevSource < Struct.new(:code_object)
|
@@ -131,7 +131,7 @@ module Inch
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def to_s
|
134
|
-
comments.join(
|
134
|
+
comments.join('') + abbrev_source
|
135
135
|
end
|
136
136
|
|
137
137
|
private
|
@@ -139,12 +139,12 @@ module Inch
|
|
139
139
|
def abbrev_source
|
140
140
|
lines = code_object.source.to_s.lines.to_a
|
141
141
|
if lines.size >= 5
|
142
|
-
indent = lines[1].scan(/^(\s+)/).flatten.join(
|
142
|
+
indent = lines[1].scan(/^(\s+)/).flatten.join('')
|
143
143
|
lines = lines[0..1] +
|
144
144
|
["#{indent}# ... snip ...\n"] +
|
145
145
|
lines[-2..-1]
|
146
146
|
end
|
147
|
-
lines.join(
|
147
|
+
lines.join('')
|
148
148
|
end
|
149
149
|
|
150
150
|
def comments
|
@@ -40,22 +40,22 @@ module Inch
|
|
40
40
|
|
41
41
|
def print_roles_info(o)
|
42
42
|
if o.roles.empty?
|
43
|
-
echo
|
43
|
+
echo 'No roles assigned.'.dark
|
44
44
|
else
|
45
45
|
o.roles.each do |role|
|
46
46
|
next unless role.suggestion
|
47
|
-
echo
|
47
|
+
echo '+'.color(COLOR) + " #{role.suggestion}"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
echo separator
|
51
51
|
end
|
52
52
|
|
53
|
-
def echo(msg =
|
53
|
+
def echo(msg = '')
|
54
54
|
ui.edged(COLOR, msg)
|
55
55
|
end
|
56
56
|
|
57
57
|
def separator
|
58
|
-
|
58
|
+
'-'.color(COLOR) * (CLI::COLUMNS - 2)
|
59
59
|
end
|
60
60
|
|
61
61
|
def grade(score)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'json'
|
2
|
+
require 'yaml'
|
3
3
|
|
4
4
|
module Inch
|
5
5
|
module CLI
|
@@ -31,25 +31,25 @@ module Inch
|
|
31
31
|
print_grades_by_priority
|
32
32
|
print_priorities
|
33
33
|
ui.trace
|
34
|
-
ui.trace
|
34
|
+
ui.trace 'Try `--format json|yaml` for raw numbers.'.dark
|
35
35
|
end
|
36
36
|
|
37
37
|
def print_grades
|
38
|
-
sparkline = grade_lists_sparkline(@grade_lists).to_s(
|
38
|
+
sparkline = grade_lists_sparkline(@grade_lists).to_s(' ')
|
39
39
|
ui.trace
|
40
|
-
ui.trace
|
40
|
+
ui.trace 'Grade distribution: (undocumented, C, B, A)'
|
41
41
|
ui.trace
|
42
42
|
ui.trace " Overall: #{sparkline} #{objects.size.to_s.rjust(5)} " \
|
43
|
-
|
43
|
+
'objects'
|
44
44
|
ui.trace
|
45
45
|
end
|
46
46
|
|
47
47
|
def print_grades_by_priority
|
48
|
-
ui.trace
|
48
|
+
ui.trace 'Grade distribution by priority:'
|
49
49
|
ui.trace
|
50
50
|
Evaluation::PriorityRange.all.each do |priority_range|
|
51
51
|
list = objects.select { |o| priority_range.include?(o.priority) }
|
52
|
-
sparkline = grades_sparkline(list).to_s(
|
52
|
+
sparkline = grades_sparkline(list).to_s(' ')
|
53
53
|
ui.trace " #{priority_range.arrow} #{sparkline} " \
|
54
54
|
"#{list.size.to_s.rjust(5)} objects"
|
55
55
|
ui.trace
|
@@ -68,16 +68,16 @@ module Inch
|
|
68
68
|
sparkline.format do |tick, _count, index|
|
69
69
|
tick.color(PRIORITY_COLORS[index])
|
70
70
|
end
|
71
|
-
ui.trace " #{grade_list.grade}: " + sparkline.to_s(
|
71
|
+
ui.trace " #{grade_list.grade}: " + sparkline.to_s(' ') +
|
72
72
|
" #{grade_list.objects.size.to_s.rjust(5)} objects"
|
73
73
|
ui.trace
|
74
74
|
end
|
75
75
|
|
76
76
|
def print_priorities
|
77
77
|
arrows = Evaluation::PriorityRange.all.map(&:arrow)
|
78
|
-
ui.trace
|
78
|
+
ui.trace 'Priority distribution in grades: (low to high)'
|
79
79
|
ui.trace
|
80
|
-
ui.trace " #{arrows.reverse.join(
|
80
|
+
ui.trace " #{arrows.reverse.join(' ')}"
|
81
81
|
@grade_lists.reverse.each do |grade_list|
|
82
82
|
print_grade_list(grade_list)
|
83
83
|
end
|
@@ -93,9 +93,9 @@ module Inch
|
|
93
93
|
|
94
94
|
def stats_hash
|
95
95
|
{
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
'grade_lists' => __grade_lists,
|
97
|
+
'scores' => __scores,
|
98
|
+
'priorities' => __priorities
|
99
99
|
}
|
100
100
|
end
|
101
101
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'sparkr'
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CLI
|
@@ -11,10 +11,10 @@ module Inch
|
|
11
11
|
|
12
12
|
FILE_COLOR = :dark # TODO: store all colors somewhere
|
13
13
|
RANGE_LABELS = {
|
14
|
-
A:
|
15
|
-
B:
|
16
|
-
C:
|
17
|
-
U:
|
14
|
+
A: 'Nearly perfect:',
|
15
|
+
B: 'Properly documented, could be improved:',
|
16
|
+
C: 'Not properly documented:',
|
17
|
+
U: 'Undocumented:'
|
18
18
|
}
|
19
19
|
|
20
20
|
# @param options [Command::Options::Suggest]
|
@@ -47,8 +47,8 @@ module Inch
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def display_distribution
|
50
|
-
sparkline = grades_sparkline(@relevant_objects).to_s(
|
51
|
-
ui.trace
|
50
|
+
sparkline = grades_sparkline(@relevant_objects).to_s(' ')
|
51
|
+
ui.trace 'Grade distribution (undocumented, C, B, A): ' + sparkline
|
52
52
|
ui.trace
|
53
53
|
ui.trace priority_filter_hint
|
54
54
|
end
|
@@ -65,11 +65,11 @@ module Inch
|
|
65
65
|
|
66
66
|
def display_files
|
67
67
|
ui.trace
|
68
|
-
ui.trace
|
68
|
+
ui.trace 'You might want to look at these files:'
|
69
69
|
ui.trace
|
70
70
|
|
71
71
|
files.each do |file|
|
72
|
-
filename = file.fullname.gsub(base_dir,
|
72
|
+
filename = file.fullname.gsub(base_dir, '')
|
73
73
|
ui.edged(FILE_COLOR, filename.color(FILE_COLOR))
|
74
74
|
end
|
75
75
|
ui.trace
|
@@ -93,16 +93,16 @@ module Inch
|
|
93
93
|
|
94
94
|
def display_no_objects_hint
|
95
95
|
hint = if @options.pedantic
|
96
|
-
|
96
|
+
'Even by my standards.'
|
97
97
|
else
|
98
|
-
|
99
|
-
|
98
|
+
'Try --pedantic to be excessively concerned with minor ' \
|
99
|
+
'details and rules.'
|
100
100
|
end
|
101
|
-
ui.trace
|
101
|
+
ui.trace 'Nothing to suggest.'.color(:green) + " #{hint}"
|
102
102
|
end
|
103
103
|
|
104
104
|
def min_priority_arrows
|
105
|
-
priority_arrows_gte(@options.object_min_priority).join(
|
105
|
+
priority_arrows_gte(@options.object_min_priority).join(' ')
|
106
106
|
end
|
107
107
|
|
108
108
|
def priority_arrows_gte(min_priority)
|