inch 0.5.0.rc4 → 0.5.0.rc5
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/lib/inch/cli/command/base.rb +1 -0
- data/lib/inch/cli/command/options/base.rb +2 -0
- data/lib/inch/cli/command/output/base.rb +5 -0
- data/lib/inch/cli/command/output/stats.rb +18 -18
- data/lib/inch/cli/command/output/suggest.rb +3 -3
- data/lib/inch/cli/yardopts_helper.rb +3 -1
- data/lib/inch/version.rb +1 -1
- data/test/integration/cli/command/suggest_test.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93877a4281619360271a03029ae4368cf71c7e57
|
4
|
+
data.tar.gz: f76a3b46211e7d258a41bef437839a56ee66826c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8cb6914e685eed7eb4b008757bf91d4ab56efe96e74b6d4faa57321cc9b75fb259a05b085ff6a90b34321e5f2d2d8b8c07b0cfbdc7df4d03a5ea6afb5b6b3c
|
7
|
+
data.tar.gz: 1804964c134ae38cf0108cdeeafe5809af0114da80b65d583a6edb2bf20f7070c38142a10fc532d0121c59900e91fb8542ac8467a0044f2fe2f6b551731e18bc
|
@@ -42,6 +42,8 @@ module Inch
|
|
42
42
|
attribute :paths, [] # the paths of the to-be-analysed sources
|
43
43
|
attribute :excluded, [] # paths to be excluded from the analysis
|
44
44
|
|
45
|
+
attr_accessor :ui
|
46
|
+
|
45
47
|
# Parses the given +args+ "into" the current Options object
|
46
48
|
#
|
47
49
|
# @param args [Array<String>] command-line arguments
|
@@ -30,29 +30,29 @@ module Inch
|
|
30
30
|
print_grades
|
31
31
|
print_grades_by_priority
|
32
32
|
print_priorities
|
33
|
-
|
34
|
-
|
33
|
+
ui.trace
|
34
|
+
ui.trace "Try `--format json|yaml` for raw numbers.".dark
|
35
35
|
end
|
36
36
|
|
37
37
|
def print_grades
|
38
38
|
sparkline = grade_lists_sparkline(@grade_lists).to_s(" ")
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
ui.trace
|
40
|
+
ui.trace "Grade distribution: (undocumented, C, B, A)"
|
41
|
+
ui.trace
|
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
|
-
|
49
|
-
|
48
|
+
ui.trace "Grade distribution by priority:"
|
49
|
+
ui.trace
|
50
50
|
Evaluation::PriorityRange.all.each do |priority_range|
|
51
51
|
list = objects.select { |o| priority_range.include?(o.priority) }
|
52
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
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -68,27 +68,27 @@ module Inch
|
|
68
68
|
sparkline.format do |tick, _count, index|
|
69
69
|
tick.color(PRIORITY_COLORS[index])
|
70
70
|
end
|
71
|
-
|
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
|
-
|
79
|
-
|
80
|
-
|
78
|
+
ui.trace "Priority distribution in grades: (low to high)"
|
79
|
+
ui.trace
|
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
|
84
84
|
end
|
85
85
|
|
86
86
|
def display_json
|
87
|
-
|
87
|
+
ui.trace JSON.pretty_generate(stats_hash)
|
88
88
|
end
|
89
89
|
|
90
90
|
def display_yaml
|
91
|
-
|
91
|
+
ui.trace YAML.dump(stats_hash)
|
92
92
|
end
|
93
93
|
|
94
94
|
def stats_hash
|
@@ -48,9 +48,9 @@ module Inch
|
|
48
48
|
|
49
49
|
def display_distribution
|
50
50
|
sparkline = grades_sparkline(@relevant_objects).to_s(" ")
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
ui.trace "Grade distribution (undocumented, C, B, A): " + sparkline
|
52
|
+
ui.trace
|
53
|
+
ui.trace priority_filter_hint
|
54
54
|
end
|
55
55
|
|
56
56
|
def priority_filter_hint
|
data/lib/inch/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
|
2
|
+
require 'inch/utils/buffered_ui'
|
2
3
|
|
3
4
|
describe ::Inch::CLI::Command::Suggest do
|
4
5
|
before do
|
@@ -81,6 +82,15 @@ describe ::Inch::CLI::Command::Suggest do
|
|
81
82
|
assert err.empty?, "there should be no errors"
|
82
83
|
end
|
83
84
|
|
85
|
+
it "should not output anything to stdout when used with BufferedUI" do
|
86
|
+
ui = ::Inch::Utils::BufferedUI.new
|
87
|
+
out, err = capture_io do
|
88
|
+
@command.run(:ui => ui)
|
89
|
+
end
|
90
|
+
assert out.empty?, "there should be no output"
|
91
|
+
assert err.empty?, "there should be no errors"
|
92
|
+
end
|
93
|
+
|
84
94
|
# Edge case: Really good codebase
|
85
95
|
|
86
96
|
it "should run without args on really good fixture" do
|