reek 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 300e8430e0cb4dcd0ca01529abb40921ed54f29f
4
- data.tar.gz: c844e886e736762ddb4d61cdcf5bc5931aabc041
3
+ metadata.gz: 778582708b4cbc00f46fe28d606263595eaa2715
4
+ data.tar.gz: 59a7e7cb9fc8d1fe90053e822496c29102f99b6c
5
5
  SHA512:
6
- metadata.gz: 287000e19154d5d0fff6a0996a175eeb4ff091506b19487dd126d3b858a2513d21afa284a2a603791b8c1e7a8e4538c0c3d75c213f3e04264e6e59deedcb3837
7
- data.tar.gz: 7e67159cc8a61f025a1d36f25fba7fefd0b1abda631d7f590c44242292a179804c26604ae4c72dc2af012a9b4c7e359be169f1c29a3d88868a7470810eebe8db
6
+ metadata.gz: ef57fbf9e3451a8bc3ba904655e31e51cd3f1dbfec6ecc4a555ef90638804da2bfccd1389ee27e9ab204f5b224482164a50fb9ed5ccf52bb2b15cfff19eb9389
7
+ data.tar.gz: 52784f1ccba96fc6140d200c8bd256a6111f8439c77bdd465dec87dd38114648d7266c7677c919c87b8a34aee7785fe94da18f120cb4390cc69fbc2702fa176d
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 4.2.1 (2016-07-20)
4
+
5
+ * (waldyr) Fix TooManyConstants for outer module when inner module suppress
6
+
3
7
  ## 4.2.0 (2016-07-16)
4
8
 
5
9
  * (waldyr) Add Too Many Constants smell detector
@@ -25,7 +25,7 @@ end
25
25
  would report:
26
26
 
27
27
  ```Bash
28
- Warehouse#total_price refers to item more than self (FeatureEnvy)
28
+ Warehouse#sale_price refers to item more than self (FeatureEnvy)
29
29
  ```
30
30
 
31
31
  since this:
@@ -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, [:class]).delete_if(&:defines_module?).length
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
 
@@ -7,6 +7,6 @@ module Reek
7
7
  # @public
8
8
  module Version
9
9
  # @public
10
- STRING = '4.2.0'.freeze
10
+ STRING = '4.2.1'.freeze
11
11
  end
12
12
  end
@@ -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.0
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-16 00:00:00.000000000 Z
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