reek 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +9 -0
  3. data/README.md +54 -5
  4. data/Rakefile +1 -1
  5. data/features/command_line_interface/smell_selection.feature +4 -4
  6. data/features/command_line_interface/smells_count.feature +9 -8
  7. data/features/configuration_files/masking_smells.feature +16 -51
  8. data/features/configuration_files/overrides_defaults.feature +1 -1
  9. data/features/rake_task/rake_task.feature +14 -14
  10. data/features/reports/reports.feature +21 -19
  11. data/features/reports/yaml.feature +35 -63
  12. data/features/samples.feature +55 -54
  13. data/features/support/env.rb +8 -1
  14. data/lib/reek/cli/application.rb +22 -7
  15. data/lib/reek/cli/command.rb +4 -2
  16. data/lib/reek/cli/help_command.rb +1 -1
  17. data/lib/reek/cli/options.rb +3 -3
  18. data/lib/reek/cli/reek_command.rb +4 -8
  19. data/lib/reek/cli/report/formatter.rb +8 -5
  20. data/lib/reek/cli/report/report.rb +6 -5
  21. data/lib/reek/cli/report/strategy.rb +3 -2
  22. data/lib/reek/cli/version_command.rb +1 -1
  23. data/lib/reek/configuration/app_configuration.rb +75 -0
  24. data/lib/reek/configuration/configuration_file_finder.rb +56 -0
  25. data/lib/reek/core/code_context.rb +2 -6
  26. data/lib/reek/core/module_context.rb +4 -0
  27. data/lib/reek/core/smell_repository.rb +5 -3
  28. data/lib/reek/core/sniffer.rb +12 -8
  29. data/lib/reek/examiner.rb +7 -6
  30. data/lib/reek/rake/task.rb +10 -12
  31. data/lib/reek/smell_warning.rb +25 -43
  32. data/lib/reek/smells/attribute.rb +7 -12
  33. data/lib/reek/smells/boolean_parameter.rb +9 -9
  34. data/lib/reek/smells/class_variable.rb +7 -13
  35. data/lib/reek/smells/control_parameter.rb +8 -11
  36. data/lib/reek/smells/data_clump.rb +16 -21
  37. data/lib/reek/smells/duplicate_method_call.rb +11 -18
  38. data/lib/reek/smells/feature_envy.rb +8 -8
  39. data/lib/reek/smells/irresponsible_module.rb +6 -10
  40. data/lib/reek/smells/long_parameter_list.rb +7 -15
  41. data/lib/reek/smells/long_yield_list.rb +13 -15
  42. data/lib/reek/smells/module_initialize.rb +4 -7
  43. data/lib/reek/smells/nested_iterators.rb +6 -13
  44. data/lib/reek/smells/nil_check.rb +9 -7
  45. data/lib/reek/smells/prima_donna_method.rb +5 -7
  46. data/lib/reek/smells/repeated_conditional.rb +19 -15
  47. data/lib/reek/smells/smell_detector.rb +21 -1
  48. data/lib/reek/smells/too_many_instance_variables.rb +9 -16
  49. data/lib/reek/smells/too_many_methods.rb +10 -17
  50. data/lib/reek/smells/too_many_statements.rb +14 -14
  51. data/lib/reek/smells/uncommunicative_method_name.rb +9 -10
  52. data/lib/reek/smells/uncommunicative_module_name.rb +9 -10
  53. data/lib/reek/smells/uncommunicative_parameter_name.rb +9 -9
  54. data/lib/reek/smells/uncommunicative_variable_name.rb +9 -9
  55. data/lib/reek/smells/unused_parameters.rb +8 -20
  56. data/lib/reek/smells/utility_function.rb +12 -10
  57. data/lib/reek/source.rb +0 -1
  58. data/lib/reek/source/code_comment.rb +1 -0
  59. data/lib/reek/source/source_code.rb +3 -13
  60. data/lib/reek/source/source_file.rb +0 -14
  61. data/lib/reek/source/source_repository.rb +7 -0
  62. data/lib/reek/spec/should_reek_of.rb +3 -3
  63. data/lib/reek/spec/should_reek_only_of.rb +2 -2
  64. data/lib/reek/version.rb +1 -1
  65. data/reek.gemspec +4 -2
  66. data/spec/factories/factories.rb +32 -0
  67. data/spec/matchers/smell_of_matcher.rb +3 -2
  68. data/spec/reek/cli/report_spec.rb +2 -1
  69. data/spec/reek/configuration/app_configuration_spec.rb +67 -0
  70. data/spec/reek/configuration/configuration_file_finder_spec.rb +35 -0
  71. data/spec/reek/core/code_context_spec.rb +1 -1
  72. data/spec/reek/core/module_context_spec.rb +5 -1
  73. data/spec/reek/core/smell_configuration_spec.rb +21 -13
  74. data/spec/reek/core/warning_collector_spec.rb +4 -1
  75. data/spec/reek/examiner_spec.rb +19 -1
  76. data/spec/reek/smell_warning_spec.rb +42 -36
  77. data/spec/reek/smells/attribute_spec.rb +6 -2
  78. data/spec/reek/smells/boolean_parameter_spec.rb +11 -12
  79. data/spec/reek/smells/class_variable_spec.rb +16 -6
  80. data/spec/reek/smells/control_parameter_spec.rb +17 -19
  81. data/spec/reek/smells/data_clump_spec.rb +25 -15
  82. data/spec/reek/smells/duplicate_method_call_spec.rb +18 -12
  83. data/spec/reek/smells/feature_envy_spec.rb +29 -10
  84. data/spec/reek/smells/irresponsible_module_spec.rb +7 -7
  85. data/spec/reek/smells/long_parameter_list_spec.rb +16 -10
  86. data/spec/reek/smells/long_yield_list_spec.rb +2 -2
  87. data/spec/reek/smells/module_initialize_spec.rb +26 -0
  88. data/spec/reek/smells/nested_iterators_spec.rb +21 -10
  89. data/spec/reek/smells/nil_check_spec.rb +0 -2
  90. data/spec/reek/smells/prima_donna_method_spec.rb +3 -3
  91. data/spec/reek/smells/repeated_conditional_spec.rb +0 -26
  92. data/spec/reek/smells/smell_detector_shared.rb +4 -4
  93. data/spec/reek/smells/too_many_instance_variables_spec.rb +3 -3
  94. data/spec/reek/smells/too_many_methods_spec.rb +16 -11
  95. data/spec/reek/smells/too_many_statements_spec.rb +55 -18
  96. data/spec/reek/smells/uncommunicative_method_name_spec.rb +3 -2
  97. data/spec/reek/smells/uncommunicative_module_name_spec.rb +5 -5
  98. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +4 -4
  99. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +28 -21
  100. data/spec/reek/smells/unused_parameters_spec.rb +3 -5
  101. data/spec/reek/smells/utility_function_spec.rb +2 -1
  102. data/spec/reek/source/code_comment_spec.rb +7 -2
  103. data/spec/reek/source/reference_collector_spec.rb +0 -1
  104. data/spec/reek/source/sexp_extensions_spec.rb +0 -15
  105. data/spec/reek/source/source_code_spec.rb +13 -1
  106. data/spec/reek/spec/should_reek_only_of_spec.rb +22 -10
  107. data/spec/reek/spec/should_reek_spec.rb +6 -2
  108. data/spec/samples/minimal_smelly_and_masked/config.reek +7 -0
  109. data/spec/samples/minimal_smelly_and_masked/minimal_dirty.rb +4 -0
  110. data/spec/samples/simple_configuration.reek +5 -0
  111. data/spec/samples/standard_smelly/dirty.rb +8 -0
  112. data/spec/samples/standard_smelly/minimal_dirty.rb +4 -0
  113. data/spec/spec_helper.rb +20 -0
  114. data/tasks/develop.rake +1 -1
  115. data/tasks/rubocop.rake +5 -0
  116. metadata +41 -6
  117. data/lib/reek/config_file_exception.rb +0 -7
  118. data/lib/reek/smell_description.rb +0 -26
  119. data/lib/reek/source/config_file.rb +0 -88
  120. data/spec/reek/smell_description_spec.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c45202c174ceb4196695ec6f2a5b6a823c14d06
4
- data.tar.gz: 34ec72fa7a3dc9cb07d40258e178ee8ab066e3b8
3
+ metadata.gz: b1a9764f875a3808e5f529ed5a9ec7491fb4056b
4
+ data.tar.gz: 756f9677be1f8bb5f4cd435662d6265d935ff1ca
5
5
  SHA512:
6
- metadata.gz: b2b8bf4eee7cba82e33ce1f2dbc6768c786829599d64d175d3eb232d82b3d9e6c605111ae0723e9164697ae9718194a4f91078cc4a6e130341b4bac1f178ed60
7
- data.tar.gz: 52242fe4f536bb3d2bb2de1777b4cd77232307047392ad308542d0f1f62d4ecf337a8e7f78f892e6de95459accbbf17e7a1a1732fbce3bce924f82bb80e4d81f
6
+ metadata.gz: 9d8f6a8beb542047a0da14b1624020ba3e1cbabccedca54c7d210f893771ac69811c202ccbce6db942e682fe95483c89e050cab1360428ef46cc13ccf4c9766e
7
+ data.tar.gz: f081828271bc3311fb38409fd8cdf69f081e1e552cb848dabfc9232d5b910bdfbdfbe279d9b5faf5c88aa60651f1a54e2c9a36c17ab83f9b98dce66d422f687c
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ == 1.6.0
2
+
3
+ * (troessner) Revise configuration handling:
4
+ Now there are 3 ways of passing reek a configuration file:
5
+ - Using the cli "-c" switch
6
+ - Having a file ending with .reek either in your current working directory or in a parent directory (more on that later)
7
+ - Having a file ending with .reek in your HOME directory
8
+ The order in which reek tries to find such a configuration file is exactly like above: First reek checks if we have given it a configuration file explicitly via CLI. Then it checks the current working directory for a file and if it can't find one, it traverses up the directories until it hits the root directory. And lastly, it checks your HOME directory.
9
+ As soon as reek detects a configuration file it stops searching immediately, meaning that from reek's point of view there exists one configuration file and one configuration only regardless of how many ".reek" files you might have on your filesystem.
1
10
  * (chastell) Add keyword arguments support after switching to 'parser'
2
11
  * (mvz) Handle nil-block in iterators
3
12
 
data/README.md CHANGED
@@ -60,6 +60,8 @@ spec/samples/demo/demo.rb -- 6 warnings:
60
60
 
61
61
  ## Configuration
62
62
 
63
+ ### Command line interface
64
+
63
65
  For a basic overview, run
64
66
 
65
67
  ```Ruby
@@ -68,11 +70,58 @@ reek --help
68
70
 
69
71
  For a summary of those CLI options see [Command-Line Options](https://github.com/troessner/reek/wiki/Command-Line-Options).
70
72
 
71
- Apart from that, `reek` offers quite a few ways for configuring it:
73
+ ### Configuration files
74
+
75
+ #### Configuration loading
76
+
77
+ Configuring `reek` via configuration file is by far the most powerful way.
78
+
79
+ There are 3 ways of passing `reek` a configuration file:
80
+
81
+ 1. Using the cli "-c" switch (see "Command line interface" above)
82
+ 2. Having a file ending with .reek either in your current working directory or in a parent directory (more on that later)
83
+ 3. Having a file ending with .reek in your HOME directory
84
+
85
+ The order in which `reek` tries to find such a configuration file is exactly like above: First `reek` checks if we have given it a configuration file explicitly via CLI. Then it checks the current working directory for a file and if it can't find one, it traverses up the directories until it hits the root directory. And lastly, it checks your HOME directory.
86
+
87
+ As soon as `reek` detects a configuration file it stops searching immediately, meaning that from `reek`'s point of view there exists one configuration file and one configuration only regardless of how many ".reek" files you might have on your filesystem.
88
+
89
+ #### Configuration options
90
+
91
+ The first thing you probably want to check out are the [Basic Smell Options](https://github.com/troessner/reek/wiki/Basic-Smell-Options) which are supported by every smell type.
92
+ Certain smell types offer a configuration that goes beyond that of the basic smell options - for instance [Data Clump](https://github.com/troessner/reek/wiki/Data-Clump).
93
+ All options that go beyond the [Basic Smell Options](https://github.com/troessner/reek/wiki/Basic-Smell-Options) should be documented in the corresponding smell type wiki page but if you want to get a quick and full overview over all possible configurations you can always check out [the default.reek file in this repository](https://github.com/troessner/reek/blob/master/config/defaults.reek).
94
+
95
+ Here's an excerpt of a `reek` configuration file from a commercial project:
96
+
97
+ ```yaml
98
+ ---
99
+ IrresponsibleModule:
100
+ enabled: false
101
+ NestedIterators:
102
+ exclude:
103
+ - "ActiveModelErrorAdder#self.run" # should be refactored
104
+ - "BookingRequests::Transfer#remote_validation"
105
+ - "BookingRequestsController#vehicle_options" # respond_to block
106
+ - "Content::Base#self.expose_fields" # unavoidable due to metaprogramming
107
+ DataClump:
108
+ max_copies: 3
109
+ min_clump_size: 3
110
+ ```
111
+
112
+ ### Source code comments
113
+
114
+ `reek` is not the police. In case you need to suppress a smell warning and you can't or don't want to use configuration files for whatever reasons you can also use source code comments like this:
115
+
116
+ ```Ruby
117
+ # This method smells of :reek:NestedIterators
118
+ def smelly_method foo
119
+ foo.each {|bar| bar.each {|baz| baz.qux}}
120
+ end
121
+ ```
122
+
123
+ This is further explained [here](https://github.com/troessner/reek/wiki/Smell-Suppression)
72
124
 
73
- * The first thing you probably want to check out are the [Basic Smell Options](https://github.com/troessner/reek/wiki/Basic-Smell-Options)
74
- * `reek` is not the police. In case you need to suppress a smell warning for whatever reasons have a look at [Smell Suppression](https://github.com/troessner/reek/wiki/Smell-Suppression)
75
- * Lastly there are a couple of ways to configure `reek` via [Configuration Files](https://github.com/troessner/reek/wiki/Configuration-Files)
76
125
 
77
126
  ## Integration
78
127
 
@@ -113,7 +162,7 @@ bundle exec rake
113
162
 
114
163
  From then on continue by following the establish [pull request workflow](https://help.github.com/articles/using-pull-requests/).
115
164
 
116
- If you don't feel like getting your hands dirty with code there a still other ways you can help us:
165
+ If you don't feel like getting your hands dirty with code there are still other ways you can help us:
117
166
 
118
167
  * Work on the [wiki](https://github.com/troessner/reek/wiki)
119
168
  * Open up an [issue](https://github.com/troessner/reek/issues) and report bugs or suggest other improvements
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'bundler/gem_tasks'
3
3
 
4
4
  Dir['tasks/**/*.rake'].each { |t| load t }
5
5
 
6
- task default: [:test]
6
+ task default: [:test, :rubocop]
@@ -9,11 +9,11 @@ Feature: Smell selection
9
9
  And it reports:
10
10
  """
11
11
  spec/samples/two_smelly_files/dirty_one.rb -- 2 warnings:
12
- Dirty#a calls @s.title twice (DuplicateMethodCall)
13
- Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
12
+ Dirty#a calls @s.title 2 times (DuplicateMethodCall)
13
+ Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
14
14
  spec/samples/two_smelly_files/dirty_two.rb -- 2 warnings:
15
- Dirty#a calls @s.title twice (DuplicateMethodCall)
16
- Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
15
+ Dirty#a calls @s.title 2 times (DuplicateMethodCall)
16
+ Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
17
17
  4 total warnings
18
18
 
19
19
  """
@@ -4,16 +4,17 @@ Feature: Reports total number of code smells
4
4
  Reek outputs the total number of smells among all files inspected.
5
5
 
6
6
  Scenario: Does not output total number of smells when inspecting single file
7
- When I run reek spec/samples/not_quite_masked/dirty.rb
7
+ When I run reek spec/samples/standard_smelly/dirty.rb
8
8
  Then the exit status indicates smells
9
9
  And it reports:
10
10
  """
11
- spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
11
+ spec/samples/standard_smelly/dirty.rb -- 6 warnings:
12
12
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
13
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
14
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
13
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
14
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
15
15
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
16
16
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
17
+ [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
17
18
  """
18
19
 
19
20
  Scenario: Output total number of smells when inspecting multiple files
@@ -23,15 +24,15 @@ Feature: Reports total number of code smells
23
24
  """
24
25
  spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
25
26
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
26
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
27
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
27
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
28
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
28
29
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
29
30
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
30
31
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
31
32
  spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
32
33
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
33
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
34
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
34
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
35
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
35
36
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
36
37
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
37
38
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
@@ -5,22 +5,22 @@ Feature: Masking smells using config files
5
5
  I want to mask some smells using config files
6
6
 
7
7
  Scenario: empty config file is ignored
8
- When I run reek spec/samples/empty_config_file/dirty.rb
8
+ When I run reek -c spec/samples/empty_config_file/empty.reek spec/samples/empty_config_file/dirty.rb
9
9
  Then it reports the error 'Warning: Invalid configuration file "empty.reek" -- Empty file'
10
10
  And the exit status indicates smells
11
11
  And it reports:
12
12
  """
13
13
  spec/samples/empty_config_file/dirty.rb -- 6 warnings:
14
14
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
15
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
16
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
15
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
16
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
17
17
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
18
18
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
19
19
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
20
20
  """
21
21
 
22
22
  Scenario: corrupt config file prevents normal output
23
- When I run reek spec/samples/corrupt_config_file
23
+ When I run reek -c spec/samples/corrupt_config_file/corrupt.reek spec/samples/corrupt_config_file
24
24
  Then it reports the error 'Error: Invalid configuration file "corrupt.reek" -- Not a hash'
25
25
  And the exit status indicates an error
26
26
  And it reports:
@@ -28,84 +28,49 @@ Feature: Masking smells using config files
28
28
  """
29
29
 
30
30
  Scenario: missing source file is an error
31
- When I run reek no_such_file.rb spec/samples/masked/dirty.rb
32
- Then the exit status indicates smells
33
- And it reports:
34
- """
35
- spec/samples/masked/dirty.rb -- 3 warnings:
36
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
37
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
38
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
39
- """
40
- And it reports the error "Error: No such file - no_such_file.rb"
31
+ When I run reek spec/samples/missing_source_file/dirty.rb
32
+ Then it reports the error "Error: No such file - spec/samples/missing_source_file/dirty.rb"
41
33
 
42
34
  Scenario: switch off one smell
43
- When I run reek spec/samples/masked/dirty.rb
35
+ When I run reek -c spec/samples/masked/masked.reek spec/samples/masked/dirty.rb
44
36
  Then the exit status indicates smells
45
37
  And it reports:
46
38
  """
47
39
  spec/samples/masked/dirty.rb -- 3 warnings:
48
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
49
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
40
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
41
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
50
42
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
51
43
  """
52
44
 
53
45
  Scenario: non-masked smells are only counted once
54
- When I run reek spec/samples/not_quite_masked/dirty.rb
46
+ When I run reek -c spec/samples/not_quite_masked/masked.reek spec/samples/not_quite_masked/dirty.rb
55
47
  Then the exit status indicates smells
56
48
  And it reports:
57
49
  """
58
50
  spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
59
51
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
60
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
61
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
52
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
53
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
62
54
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
63
55
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
64
56
  """
65
57
 
66
- @overrides
67
- Scenario: lower overrides upper
68
- When I run reek spec/samples/overrides
69
- Then the exit status indicates smells
70
- And it reports:
71
- """
72
- spec/samples/overrides/masked/dirty.rb -- 2 warnings:
73
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
74
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
75
- """
76
-
77
58
  Scenario: allow masking some calls for duplication smell
78
- When I run reek spec/samples/mask_some/dirty.rb
59
+ When I run reek -c spec/samples/mask_some/some.reek spec/samples/mask_some/dirty.rb
79
60
  Then the exit status indicates smells
80
61
  And it reports:
81
62
  """
82
63
  spec/samples/mask_some/dirty.rb -- 2 warnings:
83
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
64
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
84
65
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
85
66
  """
86
67
 
87
68
  @comments
88
69
  Scenario: provide extra masking inline in comments
89
- When I run reek spec/samples/inline_config
70
+ When I run reek -c spec/samples/inline_config/masked.reek spec/samples/inline_config
90
71
  Then the exit status indicates smells
91
72
  And it reports:
92
73
  """
93
74
  spec/samples/inline_config/dirty.rb -- 1 warning:
94
- [5, 7]:Dirty#a calls @s.title twice (DuplicateMethodCall)
95
- """
96
-
97
- Scenario: supports a config file
98
- When I run reek -c spec/samples/config/allow_duplication.reek spec/samples/masked/dirty.rb
99
- Then the exit status indicates smells
100
- And it reports:
101
- """
102
- spec/samples/masked/dirty.rb -- 1 warning:
103
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
104
- """
105
-
106
- Scenario: supports multiple config files
107
- When I run reek -c spec/samples/config/allow_duplication.reek -c spec/samples/config/deeper_nested_iterators.reek spec/samples/masked/dirty.rb
108
- Then it succeeds
109
- And it reports:
110
- """
75
+ [5, 7]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
111
76
  """
@@ -5,7 +5,7 @@ Feature: Overriding current rules by specifying new configuration values
5
5
  I want to be able to override the default configuration values
6
6
 
7
7
  Scenario: List of configuration values is overridden by a lower config file
8
- When I run reek spec/samples/overrides_defaults/camel_case.rb
8
+ When I run reek -c spec/samples/overrides_defaults/config.reek spec/samples/overrides_defaults/camel_case.rb
9
9
  Then the exit status indicates smells
10
10
  And it reports:
11
11
  """
@@ -7,34 +7,34 @@ Feature: Reek can be driven through its Task
7
7
  When I run rake reek with:
8
8
  """
9
9
  Reek::Rake::Task.new do |t|
10
- t.source_files = 'spec/samples/masked/dirty.rb'
10
+ t.source_files = 'spec/samples/standard_smelly/minimal_dirty.rb'
11
11
  t.reek_opts = '--no-color'
12
12
  end
13
13
  """
14
14
  Then the exit status indicates an error
15
15
  And it reports:
16
16
  """
17
- spec/samples/masked/dirty.rb -- 3 warnings:
18
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
19
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
20
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
17
+ spec/samples/standard_smelly/minimal_dirty.rb -- 3 warnings:
18
+ [1]:C has no descriptive comment (IrresponsibleModule)
19
+ [1]:C has the name 'C' (UncommunicativeModuleName)
20
+ [2]:C#m has the name 'm' (UncommunicativeMethodName)
21
21
  """
22
22
 
23
23
  Scenario: name changes the task name
24
24
  When I run rake silky with:
25
25
  """
26
26
  Reek::Rake::Task.new('silky') do |t|
27
- t.source_files = 'spec/samples/masked/dirty.rb'
27
+ t.source_files = 'spec/samples/standard_smelly/minimal_dirty.rb'
28
28
  t.reek_opts = '--no-color'
29
29
  end
30
30
  """
31
31
  Then the exit status indicates an error
32
32
  And it reports:
33
33
  """
34
- spec/samples/masked/dirty.rb -- 3 warnings:
35
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
36
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
37
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
34
+ spec/samples/standard_smelly/minimal_dirty.rb -- 3 warnings:
35
+ [1]:C has no descriptive comment (IrresponsibleModule)
36
+ [1]:C has the name 'C' (UncommunicativeModuleName)
37
+ [2]:C#m has the name 'm' (UncommunicativeMethodName)
38
38
  """
39
39
 
40
40
  Scenario: verbose prints the reek command
@@ -63,8 +63,8 @@ Feature: Reek can be driven through its Task
63
63
  """
64
64
  spec/samples/no_config_file/dirty.rb -- 6 warnings:
65
65
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
66
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
67
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
66
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
67
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
68
68
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
69
69
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
70
70
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
@@ -74,8 +74,8 @@ Feature: Reek can be driven through its Task
74
74
  When I run rake reek with:
75
75
  """
76
76
  Reek::Rake::Task.new do |t|
77
- t.config_files = 'spec/samples/config/**/*.reek'
78
- t.source_files = 'spec/samples/masked/dirty.rb'
77
+ t.config_file = 'spec/samples/minimal_smelly_and_masked/config.reek'
78
+ t.source_files = 'spec/samples/minimal_smelly_and_masked/minimal_dirty.rb'
79
79
  end
80
80
  """
81
81
  Then it succeeds
@@ -11,15 +11,15 @@ Feature: Correctly formatted reports
11
11
  """
12
12
  spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
13
13
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
14
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
15
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
14
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
15
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
16
16
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
17
17
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
18
18
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
19
19
  spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
20
20
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
21
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
22
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
21
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
22
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
23
23
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
24
24
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
25
25
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
@@ -122,16 +122,17 @@ Feature: Correctly formatted reports
122
122
  | -V --quiet |
123
123
 
124
124
  Scenario Outline: --line-number turns off line numbers
125
- When I run reek <option> spec/samples/not_quite_masked/dirty.rb
125
+ When I run reek <option> spec/samples/standard_smelly/dirty.rb
126
126
  Then the exit status indicates smells
127
127
  And it reports:
128
128
  """
129
- spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
129
+ spec/samples/standard_smelly/dirty.rb -- 6 warnings:
130
130
  Dirty has the variable name '@s' (UncommunicativeVariableName)
131
- Dirty#a calls @s.title twice (DuplicateMethodCall)
132
- Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
131
+ Dirty#a calls @s.title 2 times (DuplicateMethodCall)
132
+ Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
133
133
  Dirty#a contains iterators nested 2 deep (NestedIterators)
134
134
  Dirty#a has the name 'a' (UncommunicativeMethodName)
135
+ Dirty#a has the variable name 'x' (UncommunicativeVariableName)
135
136
  """
136
137
 
137
138
  Examples:
@@ -142,16 +143,17 @@ Feature: Correctly formatted reports
142
143
  | -V -n |
143
144
 
144
145
  Scenario Outline: --single-line shows filename and one line number
145
- When I run reek <option> spec/samples/not_quite_masked/dirty.rb
146
+ When I run reek <option> spec/samples/standard_smelly/dirty.rb
146
147
  Then the exit status indicates smells
147
148
  And it reports:
148
149
  """
149
- spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
150
- spec/samples/not_quite_masked/dirty.rb:5: Dirty has the variable name '@s' (UncommunicativeVariableName)
151
- spec/samples/not_quite_masked/dirty.rb:4: Dirty#a calls @s.title twice (DuplicateMethodCall)
152
- spec/samples/not_quite_masked/dirty.rb:4: Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
153
- spec/samples/not_quite_masked/dirty.rb:5: Dirty#a contains iterators nested 2 deep (NestedIterators)
154
- spec/samples/not_quite_masked/dirty.rb:3: Dirty#a has the name 'a' (UncommunicativeMethodName)
150
+ spec/samples/standard_smelly/dirty.rb -- 6 warnings:
151
+ spec/samples/standard_smelly/dirty.rb:5: Dirty has the variable name '@s' (UncommunicativeVariableName)
152
+ spec/samples/standard_smelly/dirty.rb:4: Dirty#a calls @s.title 2 times (DuplicateMethodCall)
153
+ spec/samples/standard_smelly/dirty.rb:4: Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
154
+ spec/samples/standard_smelly/dirty.rb:5: Dirty#a contains iterators nested 2 deep (NestedIterators)
155
+ spec/samples/standard_smelly/dirty.rb:3: Dirty#a has the name 'a' (UncommunicativeMethodName)
156
+ spec/samples/standard_smelly/dirty.rb:5: Dirty#a has the variable name 'x' (UncommunicativeVariableName)
155
157
  """
156
158
 
157
159
  Examples:
@@ -168,15 +170,15 @@ Feature: Correctly formatted reports
168
170
  """
169
171
  spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
170
172
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
171
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
172
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
173
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
174
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
173
175
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
174
176
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
175
177
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
176
178
  spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
177
179
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
178
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
179
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
180
+ [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
181
+ [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
180
182
  [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
181
183
  [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
182
184
  [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)