reek 3.7.0 → 3.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +26 -1
- data/lib/reek/configuration/app_configuration.rb +4 -3
- data/lib/reek/smells/module_initialize.rb +1 -1
- data/lib/reek/version.rb +1 -1
- data/spec/reek/configuration/app_configuration_spec.rb +26 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0360a27f0d7285b66c630aa23ff08c48273f0ff7
|
4
|
+
data.tar.gz: cf166a5b8541a65c60738afa51aa903c0c673998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d52ffb53c36fc67b58993411a6bdeb1f319cadd044736f5cb13e690789dc77c2e0022b7f25261e1ebe4838fe4c11036f47d005472d5af30d6f33f4885651ae37
|
7
|
+
data.tar.gz: 443d185d3acc0d65d3f673e34f1e050e754a87637cc6fae8c63fa1059d9f1150c5936437c0cfe662d8fd9952ca903fa90647036ee35a35fcb07f200909d67f40
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -258,7 +258,29 @@ exclude_paths:
|
|
258
258
|
- lib/rake/legacy_tasks
|
259
259
|
```
|
260
260
|
|
261
|
-
|
261
|
+
If you have a directory directive for which a default directive exists, the more specific
|
262
|
+
one (which is the directory directive) will take precedence.
|
263
|
+
|
264
|
+
This configuration for instance:
|
265
|
+
|
266
|
+
```yaml
|
267
|
+
---
|
268
|
+
IrresponsibleModule:
|
269
|
+
enabled: false
|
270
|
+
|
271
|
+
TooManyStatements:
|
272
|
+
max_statements: 5
|
273
|
+
|
274
|
+
"app/controllers":
|
275
|
+
TooManyStatements:
|
276
|
+
max_statements: 10
|
277
|
+
```
|
278
|
+
|
279
|
+
translates to:
|
280
|
+
|
281
|
+
* IrresponsibleModule is disabled everywhere
|
282
|
+
* TooManyStatements#max_statements is 10 in "app/controllers"
|
283
|
+
* TooManyStatements#max_statements is 5 everywhere else
|
262
284
|
|
263
285
|
For more details please check out the [Basic Smell Options](docs/Basic-Smell-Options.md)
|
264
286
|
which are supported by every smell type. As you can see above, certain smell
|
@@ -268,6 +290,9 @@ All options that go beyond the [Basic Smell Options](docs/Basic-Smell-Options.md
|
|
268
290
|
are documented in the corresponding smell type /docs page (if you want to get a quick overview over all possible
|
269
291
|
configurations you can also check out [the `default.reek` file in this repository](defaults.reek).
|
270
292
|
|
293
|
+
Note that you do not need a configuration file at all.
|
294
|
+
If you're fine with all the [defaults](defaults.reek) we set you can skip this completely.
|
295
|
+
|
271
296
|
### Source code comments
|
272
297
|
|
273
298
|
In case you need to suppress a smell warning and you can't or don't want to
|
@@ -90,10 +90,11 @@ module Reek
|
|
90
90
|
#
|
91
91
|
# @param source_via [String] - the source of the code inspected
|
92
92
|
#
|
93
|
-
# @return [Hash] the directory directive for the source
|
94
|
-
#
|
93
|
+
# @return [Hash] the directory directive for the source with the default directive
|
94
|
+
# reverse-merged into it.
|
95
95
|
def directive_for(source_via)
|
96
|
-
directory_directives.directive_for(source_via)
|
96
|
+
hit = directory_directives.directive_for(source_via)
|
97
|
+
hit ? default_directive.merge(hit) : default_directive
|
97
98
|
end
|
98
99
|
|
99
100
|
def path_excluded?(path)
|
data/lib/reek/version.rb
CHANGED
@@ -91,9 +91,8 @@ RSpec.describe Reek::Configuration::AppConfiguration do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
describe '#directive_for' do
|
94
|
-
|
95
|
-
|
96
|
-
context 'our source is in a directory for which we have a directive' do
|
94
|
+
context 'multiple directory directives and no default directive present' do
|
95
|
+
let(:source_via) { 'spec/samples/three_clean_files/dummy.rb' }
|
97
96
|
let(:baz_config) { { Reek::Smells::IrresponsibleModule => { enabled: false } } }
|
98
97
|
let(:bang_config) { { Reek::Smells::Attribute => { enabled: true } } }
|
99
98
|
|
@@ -110,7 +109,30 @@ RSpec.describe Reek::Configuration::AppConfiguration do
|
|
110
109
|
end
|
111
110
|
end
|
112
111
|
|
113
|
-
context '
|
112
|
+
context 'directory directive and default directive present' do
|
113
|
+
let(:directory) { 'spec/samples/two_smelly_files/' }
|
114
|
+
let(:directory_config) { { Reek::Smells::TooManyStatements => { max_statements: 8 } } }
|
115
|
+
let(:directory_directives) { { directory => directory_config } }
|
116
|
+
let(:default_directive) do
|
117
|
+
{
|
118
|
+
Reek::Smells::IrresponsibleModule => { enabled: false },
|
119
|
+
Reek::Smells::TooManyStatements => { max_statements: 15 }
|
120
|
+
}
|
121
|
+
end
|
122
|
+
let(:source_via) { "#{directory}/dummy.rb" }
|
123
|
+
|
124
|
+
it 'returns the directory directive with the default directive reverse-merged' do
|
125
|
+
configuration = described_class.from_map directory_directives: directory_directives,
|
126
|
+
default_directive: default_directive
|
127
|
+
actual = configuration.directive_for(source_via)
|
128
|
+
expect(actual[Reek::Smells::IrresponsibleModule]).to be_truthy
|
129
|
+
expect(actual[Reek::Smells::TooManyStatements]).to be_truthy
|
130
|
+
expect(actual[Reek::Smells::TooManyStatements][:max_statements]).to eq(8)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'no directory directive but a default directive present' do
|
135
|
+
let(:source_via) { 'spec/samples/three_clean_files/dummy.rb' }
|
114
136
|
let(:default_directive) { { Reek::Smells::IrresponsibleModule => { enabled: false } } }
|
115
137
|
let(:attribute_config) { { Reek::Smells::Attribute => { enabled: false } } }
|
116
138
|
let(:directory_directives) do
|
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: 3.7.
|
4
|
+
version: 3.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Rutherford
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-11-
|
14
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: codeclimate-engine-rb
|
@@ -530,7 +530,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
530
530
|
version: '0'
|
531
531
|
requirements: []
|
532
532
|
rubyforge_project:
|
533
|
-
rubygems_version: 2.5.
|
533
|
+
rubygems_version: 2.4.5.1
|
534
534
|
signing_key:
|
535
535
|
specification_version: 4
|
536
536
|
summary: Code smell detector for Ruby
|