reek 4.5.1 → 4.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e73dfbe510f33f5080c142589e06141d394590c4
4
- data.tar.gz: c97e989ed22ab395217099122515d0b1e02ca8e2
3
+ metadata.gz: 602cbf9c7a40f8103d514b8d4088192cbfd7fdff
4
+ data.tar.gz: 39c4099443c81b23662e3c640374a0af287001ee
5
5
  SHA512:
6
- metadata.gz: 27c163213eee8653498e261dc44b3e6b8a1c7e9a17dfeb19bafdd914a7b7ec741168cc1f1505b71b7f8653c8eff889dbb0cbb3f953220bd46876ca4a12e310d4
7
- data.tar.gz: 3884c786a8deda2eab21427011f595b0484c61075ab96beb759bbe1ecbefc92f244650a9ef045850ce261783ef397516d5cf8fd16956cbdec16ab712fe86546b
6
+ metadata.gz: bfd0a2c1dfa98ca1e4edbf1967d973f17bf10ad9e15c9b205c68a222bb23dd46084488c942f0570ca58e1baa86258e9f8fb6f953ac3f7ad2077f8441fd56b9b2
7
+ data.tar.gz: d46599e1cbb959026843db0d87c3cd8749baa517ff9db172c4ab37e73fcb3c3b827ae8ef425ead5553dea452b91bddeefa898eb80e8e091152855a9346b83116
data/.rubocop.yml CHANGED
@@ -8,6 +8,10 @@ AllCops:
8
8
  - 'vendor/**/*'
9
9
  TargetRubyVersion: 2.1
10
10
 
11
+ Lint/HandleExceptions:
12
+ Exclude:
13
+ - 'spec/reek/configuration/configuration_file_finder_spec.rb'
14
+
11
15
  # FIXME: Make the class shorter
12
16
  Metrics/ClassLength:
13
17
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 4.5.2 (2016-11-06)
4
+
5
+ * (troessner) Warn about multiple configuration files.
6
+
3
7
  ## 4.5.1 (2016-10-16)
4
8
 
5
9
  * (troessner) Validate configuration keys in code comments.
data/Gemfile CHANGED
@@ -15,7 +15,7 @@ group :development do
15
15
  gem 'activesupport', '~> 4.2'
16
16
 
17
17
  if RUBY_VERSION >= '2.3'
18
- gem 'rubocop', '~> 0.42.0'
18
+ gem 'rubocop', '~> 0.44.1'
19
19
  gem 'rubocop-rspec', '~> 1.7'
20
20
  end
21
21
 
data/README.md CHANGED
@@ -16,8 +16,9 @@
16
16
  - [Configuration file](#configuration-file)
17
17
  - [Configuration loading](#configuration-loading)
18
18
  - [Configuration options](#configuration-options)
19
- - [Source code comments](#source-code-comments)
20
19
  - [Generating a 'todo' list](#generating-a-todo-list)
20
+ - [Beware of multiple configuration files](#beware-of-multiple-configuration-files)
21
+ - [Source code comments](#source-code-comments)
21
22
  - [Usage](#usage)
22
23
  - [Developing Reek / Contributing](#developing-reek--contributing)
23
24
  - [Output formats](#output-formats)
@@ -355,30 +356,6 @@ configurations you can also check out [the `default.reek` file in this repositor
355
356
  Note that you do not need a configuration file at all.
356
357
  If you're fine with all the [defaults](defaults.reek) we set you can skip this completely.
357
358
 
358
- ### Source code comments
359
-
360
- In case you need to suppress a smell warning and you can't or don't want to
361
- use configuration files for whatever reasons you can also use special
362
- source code comments like this:
363
-
364
- ```Ruby
365
- # This method smells of :reek:NestedIterators
366
- def smelly_method foo
367
- foo.each {|bar| bar.each {|baz| baz.qux}}
368
- end
369
- ```
370
-
371
- You can even pass in smell specific configuration settings:
372
-
373
- ```Ruby
374
- # :reek:NestedIterators { max_allowed_nesting: 2 }
375
- def smelly_method foo
376
- foo.each {|bar| bar.each {|baz| baz.qux}}
377
- end
378
- ```
379
-
380
- This is an incredible powerful feature and further explained under [Smell Suppresion](docs/Smell-Suppression.md).
381
-
382
359
  ### Generating a 'todo' list
383
360
 
384
361
  Integrating tools like Reek into an existing larger codebase can be daunting when you have to fix
@@ -425,6 +402,42 @@ reek -c other_configuration.reek --todo lib/
425
402
  `other_configuration.reek` will simply be ignored (as outlined before, Reek
426
403
  is supposed to have one configuration file and one file only).
427
404
 
405
+ ### Beware of multiple configuration files
406
+
407
+ Reek takes one configuration file and one configuration file only.
408
+
409
+ If you have more than one configuration file in the same directory Reek
410
+ will not know what configuration file to use. If this happens Reek will
411
+ print a warning on STDERR and exit with the failure exit status 1.
412
+
413
+ In case you have to have one or more configuration files in the directory (e.g. you're
414
+ toying around with different, mutually exclusive settings) you need to tell Reek
415
+ explicitly which file to use via `reek -c config.reek`.
416
+
417
+ ### Source code comments
418
+
419
+ In case you need to suppress a smell warning and you can't or don't want to
420
+ use configuration files for whatever reasons you can also use special
421
+ source code comments like this:
422
+
423
+ ```Ruby
424
+ # This method smells of :reek:NestedIterators
425
+ def smelly_method foo
426
+ foo.each {|bar| bar.each {|baz| baz.qux}}
427
+ end
428
+ ```
429
+
430
+ You can even pass in smell specific configuration settings:
431
+
432
+ ```Ruby
433
+ # :reek:NestedIterators { max_allowed_nesting: 2 }
434
+ def smelly_method foo
435
+ foo.each {|bar| bar.each {|baz| baz.qux}}
436
+ end
437
+ ```
438
+
439
+ This is an incredible powerful feature and further explained under [Smell Suppresion](docs/Smell-Suppression.md).
440
+
428
441
  ## Usage
429
442
 
430
443
  Besides the obvious
@@ -0,0 +1,44 @@
1
+ Feature: Warn on multiple configuration files
2
+ Reek is designed for one configuration file and for one configuration file only.
3
+ We should make this clear to the user by warning him when we detect multiple
4
+ configuration files and then exiting the program.
5
+
6
+ Scenario: Warn on more than one configuration file
7
+ Given the smelly file 'smelly.rb'
8
+ And a file named "config.reek" with:
9
+ """
10
+ ---
11
+ UncommunicativeMethodName:
12
+ enabled: false
13
+ """
14
+ And a file named ".todo.reek" with:
15
+ """
16
+ ---
17
+ UtilityFunction:
18
+ enabled: false
19
+ """
20
+ When I run reek smelly.rb
21
+ Then it reports the error "Error: Found multiple configuration files '.todo.reek', 'config.reek'"
22
+ And it reports the error "Reek supports only one configuration file. You have 2 options now:"
23
+ And it reports the error "1) Remove all offending files"
24
+ And it reports the error "2) Be specific about which one you want to load via the -c switch"
25
+ And the exit status indicates an error
26
+
27
+ Scenario: Do not warn on more than one when we explicitly specify one configuration file
28
+ Given the smelly file 'smelly.rb'
29
+ And a file named "config.reek" with:
30
+ """
31
+ ---
32
+ UncommunicativeMethodName:
33
+ enabled: false
34
+ """
35
+ And a file named ".todo.reek" with:
36
+ """
37
+ ---
38
+ UtilityFunction:
39
+ enabled: false
40
+ """
41
+ When I run reek -c config.reek smelly.rb
42
+ Then the exit status indicates smells
43
+ And it reports no errors
44
+
@@ -23,17 +23,17 @@ Then /^stdout includes "(.*)"$/ do |text|
23
23
  end
24
24
 
25
25
  Then /^it succeeds$/ do
26
- success = Reek::CLI::Options::DEFAULT_SUCCESS_EXIT_CODE
26
+ success = Reek::CLI::Status::DEFAULT_SUCCESS_EXIT_CODE
27
27
  expect(last_command_started).to have_exit_status(success)
28
28
  end
29
29
 
30
30
  Then /^the exit status indicates an error$/ do
31
- error = Reek::CLI::Options::DEFAULT_ERROR_EXIT_CODE
31
+ error = Reek::CLI::Status::DEFAULT_ERROR_EXIT_CODE
32
32
  expect(last_command_started).to have_exit_status(error)
33
33
  end
34
34
 
35
35
  Then /^the exit status indicates smells$/ do
36
- smells = Reek::CLI::Options::DEFAULT_FAILURE_EXIT_CODE
36
+ smells = Reek::CLI::Status::DEFAULT_FAILURE_EXIT_CODE
37
37
  expect(last_command_started).to have_exit_status(smells)
38
38
  end
39
39
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative 'options'
3
+ require_relative 'status'
3
4
  require_relative '../configuration/app_configuration'
4
5
  require_relative '../source/source_locator'
5
6
  require_relative 'command/report_command'
@@ -36,15 +37,15 @@ module Reek
36
37
  def configure_options(argv)
37
38
  Options.new(argv).parse
38
39
  rescue OptionParser::InvalidOption => error
39
- $stderr.puts "Error: #{error}"
40
- exit Options::DEFAULT_ERROR_EXIT_CODE
40
+ warn "Error: #{error}"
41
+ exit Status::DEFAULT_ERROR_EXIT_CODE
41
42
  end
42
43
 
43
44
  def configure_app_configuration(config_file)
44
45
  Configuration::AppConfiguration.from_path(config_file)
45
46
  rescue Reek::Configuration::ConfigFileException => error
46
- $stderr.puts "Error: #{error}"
47
- exit Options::DEFAULT_ERROR_EXIT_CODE
47
+ warn "Error: #{error}"
48
+ exit Status::DEFAULT_ERROR_EXIT_CODE
48
49
  end
49
50
 
50
51
  def command_class
@@ -2,6 +2,7 @@
2
2
  require 'optparse'
3
3
  require 'rainbow'
4
4
  require_relative '../version'
5
+ require_relative 'status'
5
6
 
6
7
  module Reek
7
8
  module CLI
@@ -15,10 +16,6 @@ module Reek
15
16
  # :reek:Attribute: { enabled: false }
16
17
  #
17
18
  class Options
18
- DEFAULT_SUCCESS_EXIT_CODE = 0
19
- DEFAULT_ERROR_EXIT_CODE = 1
20
- DEFAULT_FAILURE_EXIT_CODE = 2
21
-
22
19
  attr_reader :argv, :parser, :smells_to_detect
23
20
  attr_accessor :colored,
24
21
  :config_file,
@@ -41,8 +38,8 @@ module Reek
41
38
  @show_links = true
42
39
  @smells_to_detect = []
43
40
  @colored = tty_output?
44
- @success_exit_code = DEFAULT_SUCCESS_EXIT_CODE
45
- @failure_exit_code = DEFAULT_FAILURE_EXIT_CODE
41
+ @success_exit_code = Status::DEFAULT_SUCCESS_EXIT_CODE
42
+ @failure_exit_code = Status::DEFAULT_FAILURE_EXIT_CODE
46
43
  @generate_todo_list = false
47
44
 
48
45
  set_up_parser
@@ -179,12 +176,12 @@ module Reek
179
176
  parser.separator "\nExit codes:"
180
177
  parser.on('--success-exit-code CODE',
181
178
  'The exit code when no smells are found '\
182
- "(default: #{DEFAULT_SUCCESS_EXIT_CODE})") do |option|
179
+ "(default: #{Status::DEFAULT_SUCCESS_EXIT_CODE})") do |option|
183
180
  self.success_exit_code = Integer(option)
184
181
  end
185
182
  parser.on('--failure-exit-code CODE',
186
183
  'The exit code when smells are found '\
187
- "(default: #{DEFAULT_FAILURE_EXIT_CODE})") do |option|
184
+ "(default: #{Status::DEFAULT_FAILURE_EXIT_CODE})") do |option|
188
185
  self.failure_exit_code = Integer(option)
189
186
  end
190
187
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module Reek
3
+ module CLI
4
+ module Status
5
+ DEFAULT_SUCCESS_EXIT_CODE = 0
6
+ DEFAULT_ERROR_EXIT_CODE = 1
7
+ DEFAULT_FAILURE_EXIT_CODE = 2
8
+ end
9
+ end
10
+ end
@@ -17,42 +17,102 @@ module Reek
17
17
  # The order in which ConfigurationFileFinder tries to find such a
18
18
  # configuration file is exactly like above.
19
19
  module ConfigurationFileFinder
20
- module_function
20
+ TOO_MANY_CONFIGURATION_FILES_MESSAGE = <<-EOS.freeze
21
21
 
22
- def find_and_load(path: nil)
23
- load_from_file(find(path: path))
24
- end
22
+ Error: Found multiple configuration files %s
23
+ while scanning directory %s.
25
24
 
26
- # :reek:ControlParameter
27
- def find(path: nil, current: Pathname.pwd, home: Pathname.new(Dir.home))
28
- path || find_by_dir(current) || find_in_dir(home)
29
- end
25
+ Reek supports only one configuration file. You have 2 options now:
26
+ 1) Remove all offending files.
27
+ 2) Be specific about which one you want to load via the -c switch.
28
+
29
+ EOS
30
30
 
31
- def find_by_dir(start)
32
- start.ascend do |dir|
33
- found = find_in_dir(dir)
34
- return found if found
31
+ class << self
32
+ #
33
+ # Finds and loads a configuration file from a given path.
34
+ #
35
+ # @return [Hash]
36
+ #
37
+ def find_and_load(path: nil)
38
+ load_from_file(find(path: path))
35
39
  end
36
- end
37
40
 
38
- def find_in_dir(dir)
39
- files = dir.children.select(&:file?).sort
40
- files.find { |file| file.to_s.end_with?('.reek') }
41
- end
41
+ #
42
+ # Tries to find a configuration file via:
43
+ # * given path (e.g. via cli switch)
44
+ # * ascending down from the current directory
45
+ # * looking into the home directory
46
+ #
47
+ # @return [File|nil]
48
+ #
49
+ # :reek:ControlParameter
50
+ def find(path: nil, current: Pathname.pwd, home: Pathname.new(Dir.home))
51
+ path || find_by_dir(current) || find_in_dir(home)
52
+ end
53
+
54
+ #
55
+ # Loads a configuration file from a given path.
56
+ # Raises on invalid data.
57
+ #
58
+ # @param path [String]
59
+ # @return [Hash]
60
+ #
61
+ # :reek:TooManyStatements: { max_statements: 6 }
62
+ def load_from_file(path)
63
+ return {} unless path
64
+ begin
65
+ configuration = YAML.load_file(path) || {}
66
+ rescue => error
67
+ raise ConfigFileException, "Invalid configuration file #{path}, error is #{error}"
68
+ end
69
+
70
+ unless configuration.is_a? Hash
71
+ raise ConfigFileException, "Invalid configuration file \"#{path}\" -- Not a hash"
72
+ end
73
+ configuration
74
+ end
75
+
76
+ private
77
+
78
+ #
79
+ # Recursively traverse directories down to find a configuration file.
80
+ #
81
+ # @return [File|nil]
82
+ #
83
+ def find_by_dir(start)
84
+ start.ascend do |dir|
85
+ file = find_in_dir(dir)
86
+ return file if file
87
+ end
88
+ end
42
89
 
43
- # :reek:TooManyStatements: { max_statements: 6 }
44
- def load_from_file(path)
45
- return {} unless path
46
- begin
47
- configuration = YAML.load_file(path) || {}
48
- rescue => error
49
- raise ConfigFileException, "Invalid configuration file #{path}, error is #{error}"
90
+ #
91
+ # Checks a given directory for a configuration file and returns it.
92
+ # Raises an exception if we find more than one.
93
+ #
94
+ # @return [File|nil]
95
+ #
96
+ # :reek:FeatureEnvy
97
+ def find_in_dir(dir)
98
+ found = dir.children.select { |item| item.file? && item.to_s.end_with?('.reek') }.sort
99
+ if found.size > 1
100
+ escalate_too_many_configuration_files found, dir
101
+ else
102
+ found.first
103
+ end
50
104
  end
51
105
 
52
- unless configuration.is_a? Hash
53
- raise ConfigFileException, "Invalid configuration file \"#{path}\" -- Not a hash"
106
+ #
107
+ # Writes a proper warning message to STDERR and then exits the program.
108
+ #
109
+ # @return [undefined]
110
+ #
111
+ def escalate_too_many_configuration_files(found, directory)
112
+ offensive_files = found.map { |file| "'#{file.basename}'" }.join(', ')
113
+ warn format(TOO_MANY_CONFIGURATION_FILES_MESSAGE, offensive_files, directory)
114
+ exit 1
54
115
  end
55
- configuration
56
116
  end
57
117
  end
58
118
  end
@@ -23,13 +23,11 @@ module Reek
23
23
  # :reek:FeatureEnvy
24
24
  def sniff(ctx)
25
25
  ctx.local_nodes(:def) do |node|
26
- if node.name.to_s == 'initialize'
27
- return [
28
- smell_warning(
29
- context: ctx,
30
- lines: [ctx.exp.line],
31
- message: 'has initialize method')
32
- ]
26
+ if node.name == :initialize
27
+ return smell_warning(
28
+ context: ctx,
29
+ lines: [ctx.exp.line],
30
+ message: 'has initialize method')
33
31
  end
34
32
  end
35
33
  []
data/lib/reek/version.rb CHANGED
@@ -7,6 +7,6 @@ module Reek
7
7
  # @public
8
8
  module Version
9
9
  # @public
10
- STRING = '4.5.1'.freeze
10
+ STRING = '4.5.2'.freeze
11
11
  end
12
12
  end
@@ -10,7 +10,7 @@ RSpec.describe Reek::CLI::Application do
10
10
  end
11
11
  end
12
12
  expect(call).to raise_error(SystemExit) do |error|
13
- expect(error.status).to eq Reek::CLI::Options::DEFAULT_ERROR_EXIT_CODE
13
+ expect(error.status).to eq Reek::CLI::Status::DEFAULT_ERROR_EXIT_CODE
14
14
  end
15
15
  end
16
16
  end
@@ -26,7 +26,7 @@ RSpec.describe Reek::CLI::Command::ReportCommand do
26
26
  result = Reek::CLI::Silencer.silently do
27
27
  command.execute
28
28
  end
29
- expect(result).to eq Reek::CLI::Options::DEFAULT_SUCCESS_EXIT_CODE
29
+ expect(result).to eq Reek::CLI::Status::DEFAULT_SUCCESS_EXIT_CODE
30
30
  end
31
31
  end
32
32
 
@@ -37,7 +37,7 @@ RSpec.describe Reek::CLI::Command::ReportCommand do
37
37
  result = Reek::CLI::Silencer.silently do
38
38
  command.execute
39
39
  end
40
- expect(result).to eq Reek::CLI::Options::DEFAULT_FAILURE_EXIT_CODE
40
+ expect(result).to eq Reek::CLI::Status::DEFAULT_FAILURE_EXIT_CODE
41
41
  end
42
42
  end
43
43
  end
@@ -40,7 +40,7 @@ RSpec.describe Reek::CLI::Command::TodoListCommand do
40
40
 
41
41
  it 'returns a success code' do
42
42
  result = command.execute
43
- expect(result).to eq(Reek::CLI::Options::DEFAULT_SUCCESS_EXIT_CODE)
43
+ expect(result).to eq(Reek::CLI::Status::DEFAULT_SUCCESS_EXIT_CODE)
44
44
  end
45
45
 
46
46
  it 'writes a todo file' do
@@ -111,7 +111,7 @@ RSpec.describe Reek::CLI::Command::TodoListCommand do
111
111
 
112
112
  it 'returns a success code' do
113
113
  result = command.execute
114
- expect(result).to eq Reek::CLI::Options::DEFAULT_SUCCESS_EXIT_CODE
114
+ expect(result).to eq Reek::CLI::Status::DEFAULT_SUCCESS_EXIT_CODE
115
115
  end
116
116
 
117
117
  it 'does not write a todo file' do
@@ -32,8 +32,9 @@ RSpec.describe Reek::Configuration::ConfigurationFileFinder do
32
32
  end
33
33
 
34
34
  it 'returns the file even if it’s just ‘.reek’' do
35
- found = described_class.find(current: CONFIG_PATH)
36
- expect(found).to eq(CONFIG_PATH.join('.reek'))
35
+ single_configuration_file_dir = CONFIG_PATH.join('single_configuration_file')
36
+ found = described_class.find(current: single_configuration_file_dir)
37
+ expect(found).to eq(single_configuration_file_dir.join('.reek'))
37
38
  end
38
39
 
39
40
  it 'returns the file in home if traversing from the current dir fails' do
@@ -91,25 +92,47 @@ RSpec.describe Reek::Configuration::ConfigurationFileFinder do
91
92
  end
92
93
  end
93
94
 
94
- describe '.load_from_file' do
95
- let(:sample_configuration_loaded) do
96
- {
97
- 'UncommunicativeVariableName' => { 'enabled' => false },
98
- 'UncommunicativeMethodName' => { 'enabled' => false }
99
- }
95
+ context 'more than one configuration file' do
96
+ let(:path) { CONFIG_PATH.join('more_than_one_configuration_file') }
97
+
98
+ it 'prints a message on STDERR' do
99
+ expected_message = "Error: Found multiple configuration files 'regular.reek', 'todo.reek'"
100
+ expect do
101
+ begin
102
+ described_class.find(current: path)
103
+ rescue SystemExit
104
+ end
105
+ end.to output(/#{expected_message}/).to_stderr
100
106
  end
101
107
 
102
- it 'loads the configuration from given file' do
103
- configuration = described_class.load_from_file(CONFIG_PATH.join('full_mask.reek'))
104
- expect(configuration).to eq(sample_configuration_loaded)
108
+ it 'exits' do
109
+ Reek::CLI::Silencer.silently do
110
+ expect do
111
+ described_class.find(current: path)
112
+ end.to raise_error(SystemExit)
113
+ end
105
114
  end
106
115
  end
116
+ end
107
117
 
108
- private
118
+ describe '.load_from_file' do
119
+ let(:sample_configuration_loaded) do
120
+ {
121
+ 'UncommunicativeVariableName' => { 'enabled' => false },
122
+ 'UncommunicativeMethodName' => { 'enabled' => false }
123
+ }
124
+ end
109
125
 
110
- def skip_if_a_config_in_tempdir
111
- found = described_class.find(current: Pathname.new(Dir.tmpdir))
112
- skip "skipped: #{found} exists and would fail this test" if found
126
+ it 'loads the configuration from given file' do
127
+ configuration = described_class.load_from_file(CONFIG_PATH.join('full_mask.reek'))
128
+ expect(configuration).to eq(sample_configuration_loaded)
113
129
  end
114
130
  end
131
+
132
+ private
133
+
134
+ def skip_if_a_config_in_tempdir
135
+ found = described_class.find(current: Pathname.new(Dir.tmpdir))
136
+ skip "skipped: #{found} exists and would fail this test" if found
137
+ end
115
138
  end
@@ -10,7 +10,7 @@ RSpec.describe Reek::Report::CodeClimateConfiguration do
10
10
  smell_types.each do |name|
11
11
  config = yml.fetch(name)
12
12
  it "provides remediation_points for #{name}" do
13
- expect(config['remediation_points']).to be_a Fixnum
13
+ expect(config['remediation_points']).to be_a Integer
14
14
  end
15
15
 
16
16
  it "provides content for #{name}" do
@@ -37,8 +37,8 @@ RSpec.describe Reek::SmellDetectors::DuplicateMethodCall do
37
37
  EOS
38
38
 
39
39
  expect(src).
40
- to reek_of(:DuplicateMethodCall, lines: [3, 4], name: 'charlie.delta', count: 2).
41
- and reek_of(:DuplicateMethodCall, lines: [8, 9], name: 'foxtrot.golf', count: 2)
40
+ to reek_of(:DuplicateMethodCall, lines: [3, 4], name: 'charlie.delta', count: 2).
41
+ and reek_of(:DuplicateMethodCall, lines: [8, 9], name: 'foxtrot.golf', count: 2)
42
42
  end
43
43
 
44
44
  context 'with repeated method calls' do
@@ -33,8 +33,8 @@ RSpec.describe Reek::SmellDetectors::FeatureEnvy do
33
33
  EOS
34
34
 
35
35
  expect(src).
36
- to reek_of(:FeatureEnvy, lines: [3, 3], name: 'charlie').
37
- and reek_of(:FeatureEnvy, lines: [7, 7], name: 'hotel')
36
+ to reek_of(:FeatureEnvy, lines: [3, 3], name: 'charlie').
37
+ and reek_of(:FeatureEnvy, lines: [7, 7], name: 'hotel')
38
38
  end
39
39
 
40
40
  it 'does not report use of self' do
@@ -16,7 +16,17 @@ RSpec.describe Reek::SmellDetectors::ModuleInitialize do
16
16
  source: 'string')
17
17
  end
18
18
 
19
- it 'does not report with method named initialize in a nested class' do
19
+ it 'reports nothing for a method with a different name' do
20
+ src = <<-EOF
21
+ module Alfa
22
+ def bravo; end
23
+ end
24
+ EOF
25
+
26
+ expect(src).not_to reek_of(:ModuleInitialize)
27
+ end
28
+
29
+ it 'reports nothing for a method named initialize in a nested class' do
20
30
  src = <<-EOF
21
31
  module Alfa
22
32
  class Bravo
@@ -28,7 +38,7 @@ RSpec.describe Reek::SmellDetectors::ModuleInitialize do
28
38
  expect(src).not_to reek_of(:ModuleInitialize)
29
39
  end
30
40
 
31
- it 'does not smell with method named initialize in a nested struct' do
41
+ it 'reports nothing for a method named initialize in a nested struct' do
32
42
  src = <<-EOF
33
43
  module Alfa
34
44
  Bravo = Struct.new(:charlie) do
@@ -25,8 +25,8 @@ RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do
25
25
  end
26
26
  EOS
27
27
 
28
- expect(src).to reek_of(:UncommunicativeVariableName, lines: [2], name: 'x').
29
- and reek_of(:UncommunicativeVariableName, lines: [3], name: 'y')
28
+ expect(src).to reek_of(:UncommunicativeVariableName, lines: [2], name: 'x').
29
+ and reek_of(:UncommunicativeVariableName, lines: [3], name: 'y')
30
30
  end
31
31
 
32
32
  context 'instance variables' do
@@ -24,7 +24,7 @@ RSpec.describe Reek::SmellDetectors::UnusedParameters do
24
24
 
25
25
  expect(src).
26
26
  to reek_of(:UnusedParameters, lines: [1], name: 'bravo').
27
- and reek_of(:UnusedParameters, lines: [1], name: 'charlie')
27
+ and reek_of(:UnusedParameters, lines: [1], name: 'charlie')
28
28
  end
29
29
 
30
30
  it 'reports nothing for no parameters' 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: 4.5.1
4
+ version: 4.5.2
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-10-16 00:00:00.000000000 Z
14
+ date: 2016-11-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: codeclimate-engine-rb
@@ -155,6 +155,7 @@ files:
155
155
  - features/configuration_files/mix_accept_reject_setting.feature
156
156
  - features/configuration_files/reject_setting.feature
157
157
  - features/configuration_files/unused_private_method.feature
158
+ - features/configuration_files/warn_about_multiple_configuration_files.feature
158
159
  - features/configuration_loading.feature
159
160
  - features/configuration_via_source_comments/erroneous_source_comments.feature
160
161
  - features/configuration_via_source_comments/well_formed_source_comments.feature
@@ -200,6 +201,7 @@ files:
200
201
  - lib/reek/cli/command/todo_list_command.rb
201
202
  - lib/reek/cli/options.rb
202
203
  - lib/reek/cli/silencer.rb
204
+ - lib/reek/cli/status.rb
203
205
  - lib/reek/code_comment.rb
204
206
  - lib/reek/configuration/app_configuration.rb
205
207
  - lib/reek/configuration/configuration_file_finder.rb
@@ -297,13 +299,15 @@ files:
297
299
  - reek.gemspec
298
300
  - samples/checkstyle.xml
299
301
  - samples/clean.rb
300
- - samples/configuration/.reek
301
302
  - samples/configuration/corrupt.reek
302
303
  - samples/configuration/empty.reek
303
304
  - samples/configuration/full_configuration.reek
304
305
  - samples/configuration/full_mask.reek
306
+ - samples/configuration/more_than_one_configuration_file/regular.reek
307
+ - samples/configuration/more_than_one_configuration_file/todo.reek
305
308
  - samples/configuration/non_public_modifiers_mask.reek
306
309
  - samples/configuration/partial_mask.reek
310
+ - samples/configuration/single_configuration_file/.reek
307
311
  - samples/configuration/with_excluded_paths.reek
308
312
  - samples/exceptions.reek
309
313
  - samples/inline.rb