reek 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/reek/smells/smell_detector.rb +1 -1
- data/lib/reek/source/ast_node.rb +0 -2
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +2 -2
- data/spec/reek/cli/report_spec.rb +6 -6
- data/spec/reek/core/code_context_spec.rb +8 -8
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dce92707c157b19ecfb605d859d11a9f19255c9
|
4
|
+
data.tar.gz: f744fc0047adc1371b6343c5a99f88874ed74625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac473b612774d5942592fb188443313675cfaca2bea8f2776d82cec4d425c0291d49f64fd0c5a037c635ce439a37b1bc431a8af45f79f861fa3cb4e91727b23b
|
7
|
+
data.tar.gz: 4ef741652ffa782237c63a1af81d5dbb1d48ec7d7530e78e9b1c593b9b0a357f42b2b608663b025fd4721ce0787009b0b2c2b20793f96e0a65eeff6db131197f
|
data/CHANGELOG
CHANGED
@@ -14,7 +14,7 @@ module Reek
|
|
14
14
|
# Shared responsibilities of all smell detectors.
|
15
15
|
#
|
16
16
|
class SmellDetector
|
17
|
-
attr_reader :source
|
17
|
+
attr_reader :source
|
18
18
|
|
19
19
|
# The name of the config field that lists the names of code contexts
|
20
20
|
# that should not be checked. Add this field to the config for each
|
data/lib/reek/source/ast_node.rb
CHANGED
@@ -5,8 +5,6 @@ module Reek
|
|
5
5
|
# Base class for AST nodes extended with utility methods. Contains some
|
6
6
|
# methods to ease the transition from Sexp to AST::Node.
|
7
7
|
class AstNode < Parser::AST::Node
|
8
|
-
attr_reader :comments
|
9
|
-
|
10
8
|
def initialize(type, children = [], options = {})
|
11
9
|
@comments = options.fetch(:comments, [])
|
12
10
|
super
|
data/lib/reek/version.rb
CHANGED
data/reek.gemspec
CHANGED
@@ -31,12 +31,12 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.summary = 'Code smell detector for Ruby'
|
32
32
|
|
33
33
|
s.add_runtime_dependency('parser', ['~> 2.2.0.pre.7'])
|
34
|
-
s.add_runtime_dependency('unparser', ['
|
34
|
+
s.add_runtime_dependency('unparser', ['~> 0.2.2'])
|
35
35
|
s.add_runtime_dependency('rainbow', ['>= 1.99', '< 3.0'])
|
36
36
|
|
37
37
|
s.add_development_dependency('bundler', ['~> 1.1'])
|
38
38
|
s.add_development_dependency('rake', ['~> 10.0'])
|
39
|
-
s.add_development_dependency('cucumber', ['~> 1.3'])
|
39
|
+
s.add_development_dependency('cucumber', ['~> 1.3', '>= 1.3.18'])
|
40
40
|
s.add_development_dependency('rspec', ['~> 3.0'])
|
41
41
|
s.add_development_dependency('yard', ['>= 0.8.7', '< 0.9'])
|
42
42
|
s.add_development_dependency('factory_girl', ['~> 4.0'])
|
@@ -55,8 +55,8 @@ describe Report::TextReport, ' when empty' do
|
|
55
55
|
context 'when output format is yaml' do
|
56
56
|
it 'prints empty yaml' do
|
57
57
|
yaml_report = report(Report::YamlReport.new(report_options))
|
58
|
-
|
59
|
-
expect(
|
58
|
+
result = capture_output_stream { yaml_report.show }
|
59
|
+
expect(result).to match(/^--- \[\]\n.*$/)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -104,8 +104,8 @@ describe Report::TextReport, ' when empty' do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'has a footer in color' do
|
107
|
-
|
108
|
-
expect(
|
107
|
+
result = capture_output_stream { @rpt.show }
|
108
|
+
expect(result).to end_with "\e[32m0 total warnings\n\e[0m"
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -123,8 +123,8 @@ describe Report::TextReport, ' when empty' do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'has a footer in color' do
|
126
|
-
|
127
|
-
expect(
|
126
|
+
result = capture_output_stream { @rpt.show }
|
127
|
+
expect(result).to end_with "\e[31m4 total warnings\n\e[0m"
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
@@ -33,9 +33,9 @@ describe CodeContext do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when there is an outer' do
|
36
|
+
let(:outer) { double('outer') }
|
36
37
|
before :each do
|
37
38
|
@outer_name = 'another_random sting'
|
38
|
-
outer = double('outer')
|
39
39
|
allow(outer).to receive(:full_name).at_least(:once).and_return(@outer_name)
|
40
40
|
allow(outer).to receive(:config).and_return({})
|
41
41
|
@ctx = CodeContext.new(outer, @exp)
|
@@ -158,19 +158,19 @@ EOS
|
|
158
158
|
end
|
159
159
|
|
160
160
|
describe '#config_for' do
|
161
|
-
let(:
|
161
|
+
let(:expression) { double('exp') }
|
162
162
|
let(:outer) { nil }
|
163
|
-
let(:
|
163
|
+
let(:context) { CodeContext.new(outer, expression) }
|
164
164
|
let(:sniffer) { double('sniffer') }
|
165
165
|
|
166
166
|
before :each do
|
167
167
|
allow(sniffer).to receive(:smell_type).and_return('DuplicateMethodCall')
|
168
|
-
allow(
|
168
|
+
allow(expression).to receive(:comments).and_return(
|
169
169
|
':reek:DuplicateMethodCall: { allow_calls: [ puts ] }')
|
170
170
|
end
|
171
171
|
|
172
|
-
it 'gets its configuration from the
|
173
|
-
expect(
|
172
|
+
it 'gets its configuration from the expression comments' do
|
173
|
+
expect(context.config_for(sniffer)).to eq('allow_calls' => ['puts'])
|
174
174
|
end
|
175
175
|
|
176
176
|
context 'when there is an outer' do
|
@@ -182,8 +182,8 @@ EOS
|
|
182
182
|
end
|
183
183
|
|
184
184
|
it 'merges the outer config with its own configuration' do
|
185
|
-
expect(
|
186
|
-
|
185
|
+
expect(context.config_for(sniffer)).to eq('allow_calls' => ['puts'],
|
186
|
+
'max_calls' => 2)
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Rutherford
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-01-
|
13
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -30,16 +30,16 @@ dependencies:
|
|
30
30
|
name: unparser
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.2.2
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.2.2
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rainbow
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,9 @@ dependencies:
|
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '1.3'
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 1.3.18
|
98
101
|
type: :development
|
99
102
|
prerelease: false
|
100
103
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -102,6 +105,9 @@ dependencies:
|
|
102
105
|
- - "~>"
|
103
106
|
- !ruby/object:Gem::Version
|
104
107
|
version: '1.3'
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.18
|
105
111
|
- !ruby/object:Gem::Dependency
|
106
112
|
name: rspec
|
107
113
|
requirement: !ruby/object:Gem::Requirement
|