preek 1.4.3 → 1.5.0
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/.travis.yml +1 -0
- data/lib/preek/examiner.rb +15 -8
- data/lib/preek/output.rb +9 -0
- data/lib/preek/version.rb +1 -1
- data/preek.gemspec +2 -2
- data/spec/cli_spec.rb +9 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c585c8febf862238a426fd347775911454140bbb
|
4
|
+
data.tar.gz: e1ec29fbab5d972d84a4abf5731cd815cd1d2e83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa32eff70b87f0f4ebfa3ff282ed72399d15192fb537b403163c75f284f3486f4001a82d5631f40f33c8581068a6a91823bf8723ec101742fe928170007a4ed2
|
7
|
+
data.tar.gz: 52f8ef1a293c65142a1d834e499a581d91f505f1dc9d81c56c5895f33b5183c93a431ed51ae807b49014b21c2e842164935c1cb8ff523b5499e695b590768883
|
data/.travis.yml
CHANGED
data/lib/preek/examiner.rb
CHANGED
@@ -13,9 +13,11 @@ module Preek
|
|
13
13
|
|
14
14
|
def perform
|
15
15
|
examine_and_report
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
@output.separated do
|
17
|
+
report_success if report_success?
|
18
|
+
report_total_smells unless success?
|
19
|
+
report_non_existing if non_existing_files?
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
private
|
@@ -34,19 +36,24 @@ module Preek
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
def
|
38
|
-
return false if @reporter.verbose? || @sources.count == 0
|
39
|
+
def success?
|
39
40
|
@total_smells == 0
|
40
41
|
end
|
41
42
|
|
42
|
-
def
|
43
|
-
@
|
43
|
+
def report_success?
|
44
|
+
!@reporter.verbose? && @sources.count > 0 && success?
|
45
|
+
end
|
46
|
+
|
47
|
+
def report_success
|
44
48
|
@output.green :success, %(No smells detected)
|
45
49
|
end
|
46
50
|
|
51
|
+
def report_total_smells
|
52
|
+
@output.red :total, @total_smells
|
53
|
+
end
|
54
|
+
|
47
55
|
def report_non_existing
|
48
56
|
@output.red :error, %{No such file(s) - #{non_existing_files.join(', ')}.\n}
|
49
|
-
@output.print_line
|
50
57
|
end
|
51
58
|
|
52
59
|
def existing_files
|
data/lib/preek/output.rb
CHANGED
@@ -9,6 +9,8 @@ module Preek
|
|
9
9
|
say "\n\t#{'-'*60}\n\n"
|
10
10
|
end
|
11
11
|
|
12
|
+
alias :separator :print_line
|
13
|
+
|
12
14
|
def blue(*args)
|
13
15
|
status *args, :blue
|
14
16
|
end
|
@@ -20,6 +22,12 @@ module Preek
|
|
20
22
|
def red(*args)
|
21
23
|
status *args, :red
|
22
24
|
end
|
25
|
+
|
26
|
+
def separated(&block)
|
27
|
+
print_line
|
28
|
+
yield
|
29
|
+
print_line
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
class CompactOutput < Output
|
@@ -32,5 +40,6 @@ module Preek
|
|
32
40
|
def print_line
|
33
41
|
say "\n-\n\n"
|
34
42
|
end
|
43
|
+
alias :separator :print_line
|
35
44
|
end
|
36
45
|
end
|
data/lib/preek/version.rb
CHANGED
data/preek.gemspec
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/preek/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Jon Neverland"]
|
6
6
|
gem.email = ["jonwestin@gmail.com"]
|
7
|
-
gem.description = %q{
|
8
|
-
gem.summary = %q{
|
7
|
+
gem.description = %q{Preek prints Ruby code smells in color, using Reek. }
|
8
|
+
gem.summary = %q{Code smells in color}
|
9
9
|
gem.homepage = "https://github.com/joenas/preek"
|
10
10
|
gem.license = 'MIT'
|
11
11
|
|
data/spec/cli_spec.rb
CHANGED
@@ -68,7 +68,7 @@ describe Preek::CLI do
|
|
68
68
|
Then{output.should_not include(args[0])}
|
69
69
|
end
|
70
70
|
|
71
|
-
context "when given file has no smells" do
|
71
|
+
context "when given file has no smells and the other does not exist" do
|
72
72
|
Given(:args){ [test_file('non_smelly'), 'i/am/not/a_file'] }
|
73
73
|
Then{output.should include("No smells")}
|
74
74
|
Then{output.should_not include(args[0])}
|
@@ -86,6 +86,10 @@ describe Preek::CLI do
|
|
86
86
|
Given(:args){ [test_file('two_smelly_classes')] }
|
87
87
|
Then{output.should include('SecondSmelly')}
|
88
88
|
Then{output.should include('UncommunicativeMethodName')}
|
89
|
+
|
90
|
+
describe 'total count' do
|
91
|
+
Then{output.should match(/total.*1/)}
|
92
|
+
end
|
89
93
|
end
|
90
94
|
|
91
95
|
context "when given two smelly files" do
|
@@ -93,6 +97,10 @@ describe Preek::CLI do
|
|
93
97
|
Then{output.should include('UncommunicativeMethodName', 'TooManyStatements')}
|
94
98
|
Then{output.should include(args[0], args[1])}
|
95
99
|
Then{output.should include("#loong_method", "#x")}
|
100
|
+
|
101
|
+
describe 'total count' do
|
102
|
+
Then{output.should match(/total.*2/)}
|
103
|
+
end
|
96
104
|
end
|
97
105
|
|
98
106
|
context "when given one file without smells and another with smells" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: preek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Neverland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description: 'Preek prints Ruby code smells in color, using Reek. '
|
112
112
|
email:
|
113
113
|
- jonwestin@gmail.com
|
114
114
|
executables:
|
@@ -165,10 +165,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
168
|
+
rubygems_version: 2.2.1
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
|
-
summary:
|
171
|
+
summary: Code smells in color
|
172
172
|
test_files:
|
173
173
|
- spec/capture_helper.rb
|
174
174
|
- spec/cli_spec.rb
|