reek 4.2.0 → 4.2.1
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/CHANGELOG.md +4 -0
- data/docs/Feature-Envy.md +1 -1
- data/lib/reek/smells/too_many_constants.rb +2 -1
- data/lib/reek/version.rb +1 -1
- data/spec/reek/smells/too_many_constants_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 778582708b4cbc00f46fe28d606263595eaa2715
|
4
|
+
data.tar.gz: 59a7e7cb9fc8d1fe90053e822496c29102f99b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef57fbf9e3451a8bc3ba904655e31e51cd3f1dbfec6ecc4a555ef90638804da2bfccd1389ee27e9ab204f5b224482164a50fb9ed5ccf52bb2b15cfff19eb9389
|
7
|
+
data.tar.gz: 52784f1ccba96fc6140d200c8bd256a6111f8439c77bdd465dec87dd38114648d7266c7677c919c87b8a34aee7785fe94da18f120cb4390cc69fbc2702fa176d
|
data/CHANGELOG.md
CHANGED
data/docs/Feature-Envy.md
CHANGED
@@ -17,6 +17,7 @@ module Reek
|
|
17
17
|
# of constants permitted in a class.
|
18
18
|
MAX_ALLOWED_CONSTANTS_KEY = 'max_constants'.freeze
|
19
19
|
DEFAULT_MAX_CONSTANTS = 5
|
20
|
+
IGNORED_NODES = [:module, :class].freeze
|
20
21
|
|
21
22
|
def self.contexts
|
22
23
|
[:class, :module]
|
@@ -36,7 +37,7 @@ module Reek
|
|
36
37
|
def inspect(ctx)
|
37
38
|
max_allowed_constants = value(MAX_ALLOWED_CONSTANTS_KEY, ctx)
|
38
39
|
|
39
|
-
count = ctx.each_node(:casgn,
|
40
|
+
count = ctx.each_node(:casgn, IGNORED_NODES).delete_if(&:defines_module?).length
|
40
41
|
|
41
42
|
return [] if count <= max_allowed_constants
|
42
43
|
|
data/lib/reek/version.rb
CHANGED
@@ -104,6 +104,24 @@ RSpec.describe Reek::Smells::TooManyConstants do
|
|
104
104
|
expect(src).not_to reek_of(:TooManyConstants)
|
105
105
|
end
|
106
106
|
|
107
|
+
it 'should not report outer module when inner module suppressed' do
|
108
|
+
src = <<-EOS
|
109
|
+
module Foo
|
110
|
+
# ignore :reek:TooManyConstants:
|
111
|
+
module Bar
|
112
|
+
A = 1
|
113
|
+
B = 2
|
114
|
+
C = 3
|
115
|
+
D = 4
|
116
|
+
E = 5
|
117
|
+
F = 6
|
118
|
+
end
|
119
|
+
end
|
120
|
+
EOS
|
121
|
+
|
122
|
+
expect(src).not_to reek_of(:TooManyConstants, context: 'Foo')
|
123
|
+
end
|
124
|
+
|
107
125
|
it 'should count each constant only once for each namespace' do
|
108
126
|
src = <<-EOS
|
109
127
|
module Movie
|
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: 4.2.
|
4
|
+
version: 4.2.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: 2016-07-
|
14
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: codeclimate-engine-rb
|