reek 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +13 -0
  3. data/.rubocop.yml +66 -0
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +25 -0
  6. data/CHANGELOG +6 -0
  7. data/CONTRIBUTING.md +106 -0
  8. data/Gemfile +14 -0
  9. data/README.md +16 -21
  10. data/bin/reek +2 -2
  11. data/config/cucumber.yml +3 -0
  12. data/config/defaults.reek +1 -1
  13. data/features/command_line_interface/smell_selection.feature +4 -8
  14. data/features/command_line_interface/smells_count.feature +25 -32
  15. data/features/command_line_interface/stdin.feature +2 -2
  16. data/features/configuration_files/masking_smells.feature +30 -41
  17. data/features/configuration_files/overrides_defaults.feature +5 -3
  18. data/features/configuration_loading.feature +26 -23
  19. data/features/programmatic_access.feature +24 -0
  20. data/features/rake_task/rake_task.feature +25 -22
  21. data/features/reports/json.feature +24 -26
  22. data/features/reports/reports.feature +77 -103
  23. data/features/reports/yaml.feature +26 -20
  24. data/features/ruby_api/api.feature +4 -3
  25. data/features/samples.feature +21 -20
  26. data/features/step_definitions/.rubocop.yml +5 -0
  27. data/features/step_definitions/reek_steps.rb +16 -28
  28. data/features/step_definitions/sample_file_steps.rb +158 -0
  29. data/features/support/env.rb +16 -27
  30. data/lib/reek.rb +3 -3
  31. data/lib/reek/cli/application.rb +4 -4
  32. data/lib/reek/cli/command.rb +1 -1
  33. data/lib/reek/cli/input.rb +2 -4
  34. data/lib/reek/cli/option_interpreter.rb +9 -9
  35. data/lib/reek/cli/options.rb +5 -4
  36. data/lib/reek/cli/reek_command.rb +3 -3
  37. data/lib/reek/cli/report/formatter.rb +2 -2
  38. data/lib/reek/cli/report/heading_formatter.rb +1 -1
  39. data/lib/reek/cli/report/location_formatter.rb +1 -1
  40. data/lib/reek/cli/report/report.rb +4 -4
  41. data/lib/reek/configuration/app_configuration.rb +1 -1
  42. data/lib/reek/configuration/configuration_file_finder.rb +17 -32
  43. data/lib/reek/core/code_context.rb +1 -1
  44. data/lib/reek/core/method_context.rb +6 -2
  45. data/lib/reek/core/module_context.rb +2 -2
  46. data/lib/reek/core/singleton_method_context.rb +1 -1
  47. data/lib/reek/core/smell_repository.rb +3 -2
  48. data/lib/reek/core/tree_walker.rb +4 -4
  49. data/lib/reek/examiner.rb +4 -4
  50. data/lib/reek/smells/attribute.rb +3 -3
  51. data/lib/reek/smells/boolean_parameter.rb +2 -2
  52. data/lib/reek/smells/class_variable.rb +2 -2
  53. data/lib/reek/smells/control_parameter.rb +2 -2
  54. data/lib/reek/smells/data_clump.rb +2 -3
  55. data/lib/reek/smells/duplicate_method_call.rb +2 -2
  56. data/lib/reek/smells/feature_envy.rb +6 -2
  57. data/lib/reek/smells/irresponsible_module.rb +3 -3
  58. data/lib/reek/smells/long_parameter_list.rb +3 -3
  59. data/lib/reek/smells/long_yield_list.rb +2 -2
  60. data/lib/reek/smells/module_initialize.rb +2 -2
  61. data/lib/reek/smells/nested_iterators.rb +2 -2
  62. data/lib/reek/smells/nil_check.rb +2 -2
  63. data/lib/reek/smells/prima_donna_method.rb +2 -2
  64. data/lib/reek/smells/repeated_conditional.rb +3 -2
  65. data/lib/reek/smells/smell_detector.rb +2 -2
  66. data/lib/reek/smells/too_many_instance_variables.rb +2 -2
  67. data/lib/reek/smells/too_many_methods.rb +2 -2
  68. data/lib/reek/smells/too_many_statements.rb +2 -2
  69. data/lib/reek/smells/uncommunicative_method_name.rb +2 -2
  70. data/lib/reek/smells/uncommunicative_module_name.rb +2 -2
  71. data/lib/reek/smells/uncommunicative_parameter_name.rb +2 -2
  72. data/lib/reek/smells/uncommunicative_variable_name.rb +2 -2
  73. data/lib/reek/smells/unused_parameters.rb +2 -2
  74. data/lib/reek/smells/utility_function.rb +8 -9
  75. data/lib/reek/source/ast_node.rb +1 -1
  76. data/lib/reek/source/ast_node_class_map.rb +6 -6
  77. data/lib/reek/source/sexp_extensions.rb +11 -2
  78. data/lib/reek/source/source_code.rb +10 -2
  79. data/lib/reek/source/source_locator.rb +1 -3
  80. data/lib/reek/source/source_repository.rb +3 -4
  81. data/lib/reek/source/tree_dresser.rb +2 -2
  82. data/lib/reek/spec.rb +3 -3
  83. data/lib/reek/spec/should_reek.rb +3 -3
  84. data/lib/reek/spec/should_reek_of.rb +1 -1
  85. data/lib/reek/spec/should_reek_only_of.rb +3 -3
  86. data/lib/reek/version.rb +1 -1
  87. data/reek.gemspec +18 -24
  88. data/spec/factories/factories.rb +1 -1
  89. data/spec/gem/updates_spec.rb +1 -1
  90. data/spec/gem/yard_spec.rb +1 -1
  91. data/spec/quality/reek_source_spec.rb +1 -1
  92. data/spec/reek/cli/html_report_spec.rb +6 -9
  93. data/spec/reek/cli/json_report_spec.rb +6 -6
  94. data/spec/reek/cli/option_interperter_spec.rb +5 -5
  95. data/spec/reek/cli/text_report_spec.rb +16 -19
  96. data/spec/reek/cli/yaml_report_spec.rb +7 -10
  97. data/spec/reek/configuration/app_configuration_spec.rb +23 -25
  98. data/spec/reek/configuration/configuration_file_finder_spec.rb +46 -21
  99. data/spec/reek/core/code_context_spec.rb +17 -19
  100. data/spec/reek/core/method_context_spec.rb +15 -14
  101. data/spec/reek/core/module_context_spec.rb +5 -7
  102. data/spec/reek/core/object_refs_spec.rb +4 -6
  103. data/spec/reek/core/singleton_method_context_spec.rb +5 -7
  104. data/spec/reek/core/smell_configuration_spec.rb +5 -7
  105. data/spec/reek/core/smell_repository_spec.rb +8 -8
  106. data/spec/reek/core/stop_context_spec.rb +4 -7
  107. data/spec/reek/core/tree_walker_spec.rb +5 -7
  108. data/spec/reek/core/warning_collector_spec.rb +5 -7
  109. data/spec/reek/examiner_spec.rb +10 -12
  110. data/spec/reek/smell_warning_spec.rb +7 -9
  111. data/spec/reek/smells/attribute_spec.rb +6 -6
  112. data/spec/reek/smells/boolean_parameter_spec.rb +4 -4
  113. data/spec/reek/smells/class_variable_spec.rb +6 -6
  114. data/spec/reek/smells/control_parameter_spec.rb +4 -4
  115. data/spec/reek/smells/data_clump_spec.rb +4 -4
  116. data/spec/reek/smells/duplicate_method_call_spec.rb +6 -6
  117. data/spec/reek/smells/feature_envy_spec.rb +9 -10
  118. data/spec/reek/smells/irresponsible_module_spec.rb +7 -7
  119. data/spec/reek/smells/long_parameter_list_spec.rb +5 -5
  120. data/spec/reek/smells/long_yield_list_spec.rb +5 -5
  121. data/spec/reek/smells/module_initialize_spec.rb +3 -3
  122. data/spec/reek/smells/nested_iterators_spec.rb +4 -4
  123. data/spec/reek/smells/nil_check_spec.rb +5 -5
  124. data/spec/reek/smells/prima_donna_method_spec.rb +7 -4
  125. data/spec/reek/smells/repeated_conditional_spec.rb +12 -11
  126. data/spec/reek/smells/smell_detector_shared.rb +4 -5
  127. data/spec/reek/smells/too_many_instance_variables_spec.rb +4 -4
  128. data/spec/reek/smells/too_many_methods_spec.rb +11 -7
  129. data/spec/reek/smells/too_many_statements_spec.rb +6 -5
  130. data/spec/reek/smells/uncommunicative_method_name_spec.rb +4 -4
  131. data/spec/reek/smells/uncommunicative_module_name_spec.rb +7 -7
  132. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +5 -5
  133. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +9 -6
  134. data/spec/reek/smells/unused_parameters_spec.rb +3 -3
  135. data/spec/reek/smells/utility_function_spec.rb +41 -37
  136. data/spec/reek/source/code_comment_spec.rb +19 -17
  137. data/spec/reek/source/object_source_spec.rb +1 -3
  138. data/spec/reek/source/reference_collector_spec.rb +5 -6
  139. data/spec/reek/source/sexp_extensions_spec.rb +9 -11
  140. data/spec/reek/source/sexp_formatter_spec.rb +7 -8
  141. data/spec/reek/source/sexp_node_spec.rb +3 -5
  142. data/spec/reek/source/source_code_spec.rb +9 -9
  143. data/spec/reek/source/tree_dresser_spec.rb +4 -6
  144. data/spec/reek/spec/should_reek_of_spec.rb +11 -10
  145. data/spec/reek/spec/should_reek_only_of_spec.rb +4 -7
  146. data/spec/reek/spec/should_reek_spec.rb +4 -7
  147. data/spec/samples/{overrides/masked/lower.reek → masked_by_dotfile/.reek} +3 -1
  148. data/spec/spec_helper.rb +4 -4
  149. data/tasks/develop.rake +1 -1
  150. data/tasks/reek.rake +1 -1
  151. metadata +72 -86
  152. data/features/support/hooks.rb +0 -15
  153. data/lib/reek/source.rb +0 -16
  154. data/lib/reek/source/core_extras.rb +0 -46
  155. data/lib/reek/source/source_file.rb +0 -16
  156. data/spec/samples/config/allow_duplication.reek +0 -3
  157. data/spec/samples/config/deeper_nested_iterators.reek +0 -3
  158. data/spec/samples/configuration_loading/minimal_dirty.rb +0 -4
  159. data/spec/samples/configuration_loading/reek-test-run-disable_smells.reek +0 -7
  160. data/spec/samples/configuration_loading/reek-test-run-enable_smells.reek +0 -7
  161. data/spec/samples/corrupt_config_file/corrupt.reek +0 -1
  162. data/spec/samples/corrupt_config_file/dirty.rb +0 -8
  163. data/spec/samples/demo/demo.rb +0 -8
  164. data/spec/samples/empty_config_file/dirty.rb +0 -8
  165. data/spec/samples/empty_config_file/empty.reek +0 -0
  166. data/spec/samples/inline_config/dirty.rb +0 -16
  167. data/spec/samples/inline_config/masked.reek +0 -7
  168. data/spec/samples/mask_some/dirty.rb +0 -8
  169. data/spec/samples/mask_some/some.reek +0 -8
  170. data/spec/samples/masked/dirty.rb +0 -8
  171. data/spec/samples/masked/masked.reek +0 -5
  172. data/spec/samples/minimal_smelly_and_masked/config.reek +0 -7
  173. data/spec/samples/minimal_smelly_and_masked/minimal_dirty.rb +0 -4
  174. data/spec/samples/mixed_results/clean_one.rb +0 -7
  175. data/spec/samples/mixed_results/clean_three.rb +0 -7
  176. data/spec/samples/mixed_results/clean_two.rb +0 -7
  177. data/spec/samples/mixed_results/dirty_one.rb +0 -8
  178. data/spec/samples/mixed_results/dirty_two.rb +0 -8
  179. data/spec/samples/not_quite_masked/dirty.rb +0 -8
  180. data/spec/samples/not_quite_masked/masked.reek +0 -5
  181. data/spec/samples/not_quite_masked/smelly.rb +0 -3
  182. data/spec/samples/one_smelly_file/dirty.rb +0 -3
  183. data/spec/samples/overrides/masked/dirty.rb +0 -8
  184. data/spec/samples/overrides/upper.reek +0 -5
  185. data/spec/samples/overrides_defaults/camel_case.rb +0 -14
  186. data/spec/samples/overrides_defaults/config.reek +0 -6
  187. data/spec/samples/standard_smelly/dirty.rb +0 -8
  188. data/spec/samples/standard_smelly/minimal_dirty.rb +0 -4
  189. data/spec/samples/three_smelly_files/dirty_one.rb +0 -3
  190. data/spec/samples/three_smelly_files/dirty_three.rb +0 -5
  191. data/spec/samples/three_smelly_files/dirty_two.rb +0 -4
@@ -4,69 +4,58 @@ Feature: Masking smells using config files
4
4
  I want to mask some smells using config files
5
5
 
6
6
  Scenario: empty config file is ignored
7
- When I run reek -c spec/samples/empty_config_file/empty.reek spec/samples/empty_config_file/dirty.rb
7
+ Given a smelly file called 'smelly.rb'
8
+ And an empty configuration file called 'empty.reek'
9
+ When I run reek -c empty.reek smelly.rb
8
10
  Then it reports the error 'Warning: Invalid configuration file "empty.reek" -- Empty file'
9
11
  And the exit status indicates smells
10
12
  And it reports:
11
13
  """
12
- spec/samples/empty_config_file/dirty.rb -- 6 warnings:
13
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
14
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
15
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
16
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
17
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
18
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
14
+ smelly.rb -- 3 warnings:
15
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
16
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
17
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
19
18
  """
20
19
 
21
20
  Scenario: corrupt config file prevents normal output
22
- When I run reek -c spec/samples/corrupt_config_file/corrupt.reek spec/samples/corrupt_config_file
21
+ Given a smelly file called 'smelly.rb'
22
+ And a corrupt configuration file called 'corrupt.reek'
23
+ When I run reek -c corrupt.reek smelly.rb
23
24
  Then it reports the error 'Error: Invalid configuration file "corrupt.reek" -- Not a hash'
24
25
  And the exit status indicates an error
25
26
  And it reports nothing
26
27
 
27
28
  Scenario: missing source file is an error
28
- When I run reek spec/samples/missing_source_file/dirty.rb
29
- Then it reports the error "Error: No such file - spec/samples/missing_source_file/dirty.rb"
30
-
31
- Scenario: switch off one smell
32
- When I run reek -c spec/samples/masked/masked.reek spec/samples/masked/dirty.rb
33
- Then the exit status indicates smells
34
- And it reports:
35
- """
36
- spec/samples/masked/dirty.rb -- 3 warnings:
37
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
38
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
39
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
40
- """
29
+ When I run reek not_here.rb
30
+ Then it reports the error "Error: No such file - not_here.rb"
41
31
 
42
- Scenario: non-masked smells are only counted once
43
- When I run reek -c spec/samples/not_quite_masked/masked.reek spec/samples/not_quite_masked/dirty.rb
44
- Then the exit status indicates smells
45
- And it reports:
46
- """
47
- spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
48
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
49
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
50
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
51
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
52
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
53
- """
32
+ Scenario: masking smells in the configuration file
33
+ Given a smelly file called 'smelly.rb'
34
+ And a masking configuration file called 'config.reek'
35
+ When I run reek -c config.reek smelly.rb
36
+ Then it succeeds
37
+ And it reports nothing
54
38
 
55
39
  Scenario: allow masking some calls for duplication smell
56
- When I run reek -c spec/samples/mask_some/some.reek spec/samples/mask_some/dirty.rb
40
+ Given a smelly file called 'smelly.rb'
41
+ And a configuration file masking some duplication smells called 'config.reek'
42
+ When I run reek -c config.reek smelly.rb
57
43
  Then the exit status indicates smells
58
44
  And it reports:
59
45
  """
60
- spec/samples/mask_some/dirty.rb -- 2 warnings:
61
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
62
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
46
+ smelly.rb -- 2 warnings:
47
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
48
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
63
49
  """
64
50
 
65
51
  Scenario: provide extra masking inline in comments
66
- When I run reek -c spec/samples/inline_config/masked.reek spec/samples/inline_config
52
+ Given a smelly file with inline masking called 'inline.rb'
53
+ And a masking configuration file called 'config.reek'
54
+ When I run reek -c config.reek inline.rb
67
55
  Then the exit status indicates smells
68
56
  And it reports:
69
57
  """
70
- spec/samples/inline_config/dirty.rb -- 1 warning:
71
- [5, 7]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
58
+ inline.rb -- 2 warnings:
59
+ [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
60
+ [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
72
61
  """
@@ -3,11 +3,13 @@ Feature: Overriding current rules by specifying new configuration values
3
3
  As a developer
4
4
  I want to be able to override the default configuration values
5
5
 
6
- Scenario: List of configuration values is overridden by a lower config file
7
- When I run reek -c spec/samples/overrides_defaults/config.reek spec/samples/overrides_defaults/camel_case.rb
6
+ Scenario: List of configuration values is overridden by a lower configuration file
7
+ Given a file with smelly variable names called 'camel_case.rb'
8
+ And a configuration file allowing camel case variables
9
+ When I run reek camel_case.rb
8
10
  Then the exit status indicates smells
9
11
  And it reports:
10
12
  """
11
- spec/samples/overrides_defaults/camel_case.rb -- 1 warning:
13
+ camel_case.rb -- 1 warning:
12
14
  [9]:CamelCase#initialize has the variable name 'x1' (UncommunicativeVariableName)
13
15
  """
@@ -11,52 +11,55 @@ Feature: Offer different ways how to load configuration
11
11
  And finally, it should check your HOME directory.
12
12
 
13
13
  Scenario: No configuration
14
- When I run reek spec/samples/configuration_loading/minimal_dirty.rb
14
+ Given a smelly file called 'smelly.rb'
15
+ When I run reek smelly.rb
15
16
  Then the exit status indicates smells
16
17
  And it reports:
17
18
  """
18
- spec/samples/configuration_loading/minimal_dirty.rb -- 3 warnings:
19
- [1]:C has no descriptive comment (IrresponsibleModule)
20
- [1]:C has the name 'C' (UncommunicativeModuleName)
21
- [2]:C#m has the name 'm' (UncommunicativeMethodName)
19
+ smelly.rb -- 3 warnings:
20
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
21
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
22
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
22
23
  """
23
24
 
24
25
  Scenario: Configuration via CLI
25
- When I run reek -c spec/samples/minimal_smelly_and_masked/config.reek spec/samples/minimal_smelly_and_masked/minimal_dirty.rb
26
+ Given a smelly file called 'smelly.rb'
27
+ And a masking configuration file called 'config.reek'
28
+ When I run reek -c config.reek smelly.rb
26
29
  Then it reports no errors
27
30
  And it succeeds
28
31
 
29
- @remove-disable-smell-config-from-current-dir
30
32
  Scenario: Configuration file in working directory
31
- Given "spec/samples/configuration_loading/reek-test-run-disable_smells.reek" exists in the working directory
32
- When I run reek spec/samples/configuration_loading/minimal_dirty.rb
33
+ Given a smelly file called 'smelly.rb'
34
+ And a masking configuration file called 'config.reek'
35
+ When I run reek smelly.rb
33
36
  Then it reports no errors
34
37
  And it succeeds
35
38
 
36
- @remove-disable-smell-config-from-parent-dir
37
39
  Scenario: Configuration file in the parent directory of the working directory
38
- Given "spec/samples/configuration_loading/reek-test-run-disable_smells.reek" exists in the parent directory of the working directory
39
- When I run reek spec/samples/configuration_loading/minimal_dirty.rb
40
+ Given a smelly file called 'smelly.rb' in a subdirectory
41
+ And a masking configuration file called 'config.reek'
42
+ When I run "reek smelly.rb" in the subdirectory
40
43
  Then it reports no errors
41
44
  And it succeeds
42
45
 
43
- @remove-disable-smell-config-from-home-dir
44
46
  Scenario: Configuration file in the HOME directory
45
- Given "spec/samples/configuration_loading/reek-test-run-disable_smells.reek" exists in the HOME directory
46
- When I run reek spec/samples/configuration_loading/minimal_dirty.rb
47
+ Given a smelly file called 'smelly.rb'
48
+ And a masking configuration file in the HOME directory
49
+ When I run reek smelly.rb
47
50
  Then it reports no errors
48
51
  And it succeeds
49
52
 
50
- @remove-enable-smell-config-from-current-dir @remove-disable-smell-config-from-parent-dir
51
53
  Scenario: Two opposing configuration files and we stop after the first one
52
- Given "spec/samples/configuration_loading/reek-test-run-enable_smells.reek" exists in the working directory
53
- And "spec/samples/configuration_loading/reek-test-run-disable_smells.reek" exists in the parent directory of the working directory
54
- When I run reek spec/samples/configuration_loading/minimal_dirty.rb
54
+ Given a smelly file called 'smelly.rb' in a subdirectory
55
+ And an enabling configuration file in the subdirectory
56
+ And a masking configuration file called 'config.reek'
57
+ When I run "reek smelly.rb" in the subdirectory
55
58
  Then the exit status indicates smells
56
59
  And it reports:
57
60
  """
58
- spec/samples/configuration_loading/minimal_dirty.rb -- 3 warnings:
59
- [1]:C has no descriptive comment (IrresponsibleModule)
60
- [1]:C has the name 'C' (UncommunicativeModuleName)
61
- [2]:C#m has the name 'm' (UncommunicativeMethodName)
61
+ smelly.rb -- 3 warnings:
62
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
63
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
64
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
62
65
  """
@@ -0,0 +1,24 @@
1
+ Feature: Using reek programmatically
2
+ In order to use reek from inside my program
3
+ As a developer
4
+ I want to be able to use its classes
5
+
6
+ Scenario:
7
+ Given a smelly file called 'smelly.rb'
8
+ And a file named "examine.rb" with:
9
+ """
10
+ require 'reek'
11
+ examiner = Reek::Examiner.new(['smelly.rb'])
12
+ examiner.smells.each do |smell|
13
+ puts smell.message
14
+ end
15
+ """
16
+ When I run `ruby examine.rb`
17
+ Then it reports no errors
18
+ And it reports:
19
+ """
20
+ calls @foo.bar 2 times
21
+ calls puts(@foo.bar) 2 times
22
+ has the name 'm'
23
+ """
24
+
@@ -3,56 +3,60 @@ Feature: Reek can be driven through its Task
3
3
  via the Task class. These scenarios test its various options.
4
4
 
5
5
  Scenario: source_files points at the desired files
6
+ Given a smelly file called 'smelly.rb'
6
7
  When I run rake reek with:
7
8
  """
8
9
  Reek::Rake::Task.new do |t|
9
- t.source_files = 'spec/samples/standard_smelly/minimal_dirty.rb'
10
+ t.source_files = 'smelly.rb'
10
11
  t.reek_opts = '--no-color'
11
12
  end
12
13
  """
13
14
  Then the exit status indicates an error
14
15
  And it reports:
15
16
  """
16
- spec/samples/standard_smelly/minimal_dirty.rb -- 3 warnings:
17
- [1]:C has no descriptive comment (IrresponsibleModule)
18
- [1]:C has the name 'C' (UncommunicativeModuleName)
19
- [2]:C#m has the name 'm' (UncommunicativeMethodName)
17
+ smelly.rb -- 3 warnings:
18
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
19
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
20
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
20
21
  """
21
22
 
22
23
  Scenario: name changes the task name
24
+ Given a smelly file called 'smelly.rb'
23
25
  When I run rake silky with:
24
26
  """
25
27
  Reek::Rake::Task.new('silky') do |t|
26
- t.source_files = 'spec/samples/standard_smelly/minimal_dirty.rb'
28
+ t.source_files = 'smelly.rb'
27
29
  t.reek_opts = '--no-color'
28
30
  end
29
31
  """
30
32
  Then the exit status indicates an error
31
33
  And it reports:
32
34
  """
33
- spec/samples/standard_smelly/minimal_dirty.rb -- 3 warnings:
34
- [1]:C has no descriptive comment (IrresponsibleModule)
35
- [1]:C has the name 'C' (UncommunicativeModuleName)
36
- [2]:C#m has the name 'm' (UncommunicativeMethodName)
35
+ smelly.rb -- 3 warnings:
36
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
37
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
38
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
37
39
  """
38
40
 
39
41
  Scenario: verbose prints the reek command
42
+ Given a smelly file called 'smelly.rb'
40
43
  When I run rake reek with:
41
44
  """
42
45
  Reek::Rake::Task.new do |t|
43
- t.source_files = 'spec/samples/masked/dirty.rb'
46
+ t.source_files = 'smelly.rb'
44
47
  t.verbose = true
45
48
  end
46
49
  """
47
50
  Then the exit status indicates an error
48
- And stdout includes "spec/samples/masked/dirty.rb"
51
+ And stdout includes "Running 'reek' rake command"
49
52
 
50
53
  Scenario: fail_on_error can hide the error status
54
+ Given a smelly file called 'smelly.rb'
51
55
  When I run rake reek with:
52
56
  """
53
57
  Reek::Rake::Task.new do |t|
54
58
  t.fail_on_error = false
55
- t.source_files = 'spec/samples/no_config_file/dirty.rb'
59
+ t.source_files = 'smelly.rb'
56
60
  t.reek_opts = '--no-color'
57
61
  end
58
62
  """
@@ -60,21 +64,20 @@ Feature: Reek can be driven through its Task
60
64
  And it succeeds
61
65
  And it reports:
62
66
  """
63
- spec/samples/no_config_file/dirty.rb -- 6 warnings:
64
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
65
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
66
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
67
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
68
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
69
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
67
+ smelly.rb -- 3 warnings:
68
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
69
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
70
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
70
71
  """
71
72
 
72
73
  Scenario: can be configured with config_file
74
+ Given a smelly file called 'smelly.rb'
75
+ And a masking configuration file called 'config.reek'
73
76
  When I run rake reek with:
74
77
  """
75
78
  Reek::Rake::Task.new do |t|
76
- t.config_file = 'spec/samples/minimal_smelly_and_masked/config.reek'
77
- t.source_files = 'spec/samples/minimal_smelly_and_masked/minimal_dirty.rb'
79
+ t.config_file = 'config.reek'
80
+ t.source_files = 'smelly.rb'
78
81
  end
79
82
  """
80
83
  Then it succeeds
@@ -3,7 +3,8 @@ Feature: Report smells using simple JSON layout
3
3
  output a list of smells in JSON.
4
4
 
5
5
  Scenario: output is empty when there are no smells
6
- When I run reek --format json spec/samples/three_clean_files
6
+ Given a directory called 'clean_files' containing some clean files
7
+ When I run reek --format json clean_files
7
8
  Then it succeeds
8
9
  And it reports this JSON:
9
10
  """
@@ -11,41 +12,38 @@ Feature: Report smells using simple JSON layout
11
12
  """
12
13
 
13
14
  Scenario: Indicate smells and print them as JSON when using files
14
- When I run reek --format json spec/samples/standard_smelly/minimal_dirty.rb
15
+ Given a smelly file called 'smelly.rb'
16
+ When I run reek --format json smelly.rb
15
17
  Then the exit status indicates smells
16
18
  And it reports this JSON:
17
19
  """
18
20
  [
19
21
  {
20
- "smell_category": "IrresponsibleModule",
21
- "smell_type": "IrresponsibleModule",
22
- "source": "spec/samples/standard_smelly/minimal_dirty.rb",
23
- "context": "C",
24
- "lines": [
25
- 1
26
- ],
27
- "message": "has no descriptive comment",
28
- "name": "C"
22
+ "smell_category": "Duplication",
23
+ "smell_type": "DuplicateMethodCall",
24
+ "source": "smelly.rb",
25
+ "context": "Smelly#m",
26
+ "lines": [ 4, 5 ],
27
+ "message": "calls @foo.bar 2 times",
28
+ "name": "@foo.bar",
29
+ "count": 2
29
30
  },
30
31
  {
31
- "smell_category": "UncommunicativeName",
32
- "smell_type": "UncommunicativeModuleName",
33
- "source": "spec/samples/standard_smelly/minimal_dirty.rb",
34
- "context": "C",
35
- "lines": [
36
- 1
37
- ],
38
- "message": "has the name 'C'",
39
- "name": "C"
32
+ "smell_category": "Duplication",
33
+ "smell_type": "DuplicateMethodCall",
34
+ "source": "smelly.rb",
35
+ "context": "Smelly#m",
36
+ "lines": [ 4, 5 ],
37
+ "message": "calls puts(@foo.bar) 2 times",
38
+ "name": "puts(@foo.bar)",
39
+ "count": 2
40
40
  },
41
41
  {
42
42
  "smell_category": "UncommunicativeName",
43
43
  "smell_type": "UncommunicativeMethodName",
44
- "source": "spec/samples/standard_smelly/minimal_dirty.rb",
45
- "context": "C#m",
46
- "lines": [
47
- 2
48
- ],
44
+ "source": "smelly.rb",
45
+ "context": "Smelly#m",
46
+ "lines": [ 3 ],
49
47
  "message": "has the name 'm'",
50
48
  "name": "m"
51
49
  }
@@ -61,7 +59,7 @@ Feature: Report smells using simple JSON layout
61
59
  {
62
60
  "smell_category": "IrresponsibleModule",
63
61
  "smell_type": "IrresponsibleModule",
64
- "source": "$stdin",
62
+ "source": "STDIN",
65
63
  "context": "Turn",
66
64
  "lines": [
67
65
  1
@@ -4,50 +4,40 @@ Feature: Correctly formatted reports
4
4
  I want to be able to parse reek's output simply and consistently
5
5
 
6
6
  Scenario Outline: two reports run together with indented smells
7
+ Given a directory called 'smelly' containing two smelly files
7
8
  When I run reek <args>
8
9
  Then the exit status indicates smells
9
10
  And it reports:
10
11
  """
11
- spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
12
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
13
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
14
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
15
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
16
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
17
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
18
- spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
19
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
20
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
21
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
22
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
23
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
24
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
25
- 12 total warnings
12
+ smelly/dirty_one.rb -- 2 warnings:
13
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
14
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
15
+ smelly/dirty_two.rb -- 3 warnings:
16
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
17
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
18
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
19
+ 5 total warnings
26
20
  """
27
21
 
28
22
  Examples:
29
- | args |
30
- | spec/samples/two_smelly_files/*.rb |
31
- | spec/samples/two_smelly_files |
23
+ | args |
24
+ | smelly/dirty_one.rb smelly/dirty_two.rb |
25
+ | smelly |
32
26
 
33
27
  Scenario Outline: No sorting (which means report each file as it is read in)
34
- When I run reek <option> spec/samples/three_smelly_files/*.rb
28
+ Given a directory called 'smelly' containing two smelly files
29
+ When I run reek <option> smelly
35
30
  Then the exit status indicates smells
36
31
  And it reports:
37
32
  """
38
- spec/samples/three_smelly_files/dirty_one.rb -- 2 warnings:
33
+ smelly/dirty_one.rb -- 2 warnings:
39
34
  [1]:Dirty has no descriptive comment (IrresponsibleModule)
40
35
  [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
41
- spec/samples/three_smelly_files/dirty_three.rb -- 4 warnings:
36
+ smelly/dirty_two.rb -- 3 warnings:
42
37
  [1]:Dirty has no descriptive comment (IrresponsibleModule)
43
38
  [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
44
39
  [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
45
- [4]:Dirty#c has the name 'c' (UncommunicativeMethodName)
46
- spec/samples/three_smelly_files/dirty_two.rb -- 3 warnings:
47
- [1]:Dirty has no descriptive comment (IrresponsibleModule)
48
- [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
49
- [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
50
- 9 total warnings
40
+ 5 total warnings
51
41
  """
52
42
 
53
43
  Examples:
@@ -57,23 +47,19 @@ Feature: Correctly formatted reports
57
47
  | --sort-by n |
58
48
 
59
49
  Scenario Outline: Sort by issue count
60
- When I run reek <option> spec/samples/three_smelly_files/*.rb
50
+ Given a directory called 'smelly' containing two smelly files
51
+ When I run reek <option> smelly
61
52
  Then the exit status indicates smells
62
53
  And it reports:
63
54
  """
64
- spec/samples/three_smelly_files/dirty_three.rb -- 4 warnings:
65
- [1]:Dirty has no descriptive comment (IrresponsibleModule)
66
- [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
67
- [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
68
- [4]:Dirty#c has the name 'c' (UncommunicativeMethodName)
69
- spec/samples/three_smelly_files/dirty_two.rb -- 3 warnings:
55
+ smelly/dirty_two.rb -- 3 warnings:
70
56
  [1]:Dirty has no descriptive comment (IrresponsibleModule)
71
57
  [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
72
58
  [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
73
- spec/samples/three_smelly_files/dirty_one.rb -- 2 warnings:
59
+ smelly/dirty_one.rb -- 2 warnings:
74
60
  [1]:Dirty has no descriptive comment (IrresponsibleModule)
75
61
  [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
76
- 9 total warnings
62
+ 5 total warnings
77
63
  """
78
64
 
79
65
  Examples:
@@ -81,27 +67,24 @@ Feature: Correctly formatted reports
81
67
  | --sort-by smelliness |
82
68
  | --sort-by s |
83
69
 
84
- Scenario Outline: good files show no headings by default
85
- When I run reek <args>
70
+ Scenario: good files show no headings by default
71
+ Given a directory called 'clean_files' containing some clean files
72
+ When I run reek clean_files
86
73
  Then it succeeds
87
74
  And it reports:
88
75
  """
89
76
  0 total warnings
90
77
  """
91
78
 
92
- Examples:
93
- | args |
94
- | spec/samples/three_clean_files/*.rb |
95
- | spec/samples/three_clean_files |
96
-
97
79
  Scenario Outline: --empty-headings turns on headings for fragrant files
98
- When I run reek <option> spec/samples/three_clean_files/*.rb
80
+ Given a directory called 'clean_files' containing some clean files
81
+ When I run reek <option> clean_files
99
82
  Then it succeeds
100
83
  And it reports:
101
84
  """
102
- spec/samples/three_clean_files/clean_one.rb -- 0 warnings
103
- spec/samples/three_clean_files/clean_three.rb -- 0 warnings
104
- spec/samples/three_clean_files/clean_two.rb -- 0 warnings
85
+ clean_files/clean_one.rb -- 0 warnings
86
+ clean_files/clean_three.rb -- 0 warnings
87
+ clean_files/clean_two.rb -- 0 warnings
105
88
  0 total warnings
106
89
  """
107
90
 
@@ -111,12 +94,13 @@ Feature: Correctly formatted reports
111
94
  | -V |
112
95
 
113
96
  Scenario Outline: --no-empty-headings turns off headings for fragrant files
114
- When I run reek <option> spec/samples/three_clean_files/*.rb
97
+ Given a directory called 'clean_files' containing some clean files
98
+ When I run reek <option> clean_files
115
99
  Then it succeeds
116
100
  And it reports:
117
- """
118
- 0 total warnings
119
- """
101
+ """
102
+ 0 total warnings
103
+ """
120
104
 
121
105
  Examples:
122
106
  | option |
@@ -124,17 +108,15 @@ Feature: Correctly formatted reports
124
108
  | -V --no-empty-headings |
125
109
 
126
110
  Scenario Outline: --no-line-numbers turns off line numbers
127
- When I run reek <option> spec/samples/standard_smelly/dirty.rb
111
+ Given a smelly file called 'smelly.rb'
112
+ When I run reek <option> smelly.rb
128
113
  Then the exit status indicates smells
129
114
  And it reports:
130
115
  """
131
- spec/samples/standard_smelly/dirty.rb -- 6 warnings:
132
- Dirty has the variable name '@s' (UncommunicativeVariableName)
133
- Dirty#a calls @s.title 2 times (DuplicateMethodCall)
134
- Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
135
- Dirty#a contains iterators nested 2 deep (NestedIterators)
136
- Dirty#a has the name 'a' (UncommunicativeMethodName)
137
- Dirty#a has the variable name 'x' (UncommunicativeVariableName)
116
+ smelly.rb -- 3 warnings:
117
+ Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
118
+ Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
119
+ Smelly#m has the name 'm' (UncommunicativeMethodName)
138
120
  """
139
121
 
140
122
  Examples:
@@ -144,17 +126,15 @@ Feature: Correctly formatted reports
144
126
  | -V --no-line-numbers |
145
127
 
146
128
  Scenario Outline: --line-numbers turns on line numbers
147
- When I run reek <option> spec/samples/standard_smelly/dirty.rb
129
+ Given a smelly file called 'smelly.rb'
130
+ When I run reek <option> smelly.rb
148
131
  Then the exit status indicates smells
149
132
  And it reports:
150
133
  """
151
- spec/samples/standard_smelly/dirty.rb -- 6 warnings:
152
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
153
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
154
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
155
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
156
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
157
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
134
+ smelly.rb -- 3 warnings:
135
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
136
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
137
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
158
138
  """
159
139
 
160
140
  Examples:
@@ -164,17 +144,15 @@ Feature: Correctly formatted reports
164
144
  | --no-line-numbers -n |
165
145
 
166
146
  Scenario Outline: --single-line shows filename and one line number
167
- When I run reek <option> spec/samples/standard_smelly/dirty.rb
147
+ Given a smelly file called 'smelly.rb'
148
+ When I run reek <option> smelly.rb
168
149
  Then the exit status indicates smells
169
150
  And it reports:
170
151
  """
171
- spec/samples/standard_smelly/dirty.rb -- 6 warnings:
172
- spec/samples/standard_smelly/dirty.rb:5: Dirty has the variable name '@s' (UncommunicativeVariableName)
173
- spec/samples/standard_smelly/dirty.rb:4: Dirty#a calls @s.title 2 times (DuplicateMethodCall)
174
- spec/samples/standard_smelly/dirty.rb:4: Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
175
- spec/samples/standard_smelly/dirty.rb:5: Dirty#a contains iterators nested 2 deep (NestedIterators)
176
- spec/samples/standard_smelly/dirty.rb:3: Dirty#a has the name 'a' (UncommunicativeMethodName)
177
- spec/samples/standard_smelly/dirty.rb:5: Dirty#a has the variable name 'x' (UncommunicativeVariableName)
152
+ smelly.rb -- 3 warnings:
153
+ smelly.rb:4: Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
154
+ smelly.rb:4: Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
155
+ smelly.rb:3: Smelly#m has the name 'm' (UncommunicativeMethodName)
178
156
  """
179
157
 
180
158
  Examples:
@@ -185,41 +163,36 @@ Feature: Correctly formatted reports
185
163
  | -V -s |
186
164
 
187
165
  Scenario Outline: Extra slashes aren't added to directory names
166
+ Given a directory called 'smelly' containing two smelly files
188
167
  When I run reek <args>
189
168
  Then the exit status indicates smells
190
169
  And it reports:
191
170
  """
192
- spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
193
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
194
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
195
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
196
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
197
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
198
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
199
- spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
200
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
201
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
202
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
203
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
204
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
205
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
206
- 12 total warnings
171
+ smelly/dirty_one.rb -- 2 warnings:
172
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
173
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
174
+ smelly/dirty_two.rb -- 3 warnings:
175
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
176
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
177
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
178
+ 5 total warnings
207
179
  """
208
180
 
209
181
  Examples:
210
- | args |
211
- | spec/samples/two_smelly_files/ |
212
- | spec/samples/two_smelly_files |
182
+ | args |
183
+ | smelly/ |
184
+ | smelly |
213
185
 
214
186
  Scenario Outline: -U or --wiki-links adds helpful links to smell warnings
215
- When I run reek <option> spec/samples/one_smelly_file/dirty.rb
187
+ Given a smelly file called 'smelly.rb'
188
+ When I run reek <option> smelly.rb
216
189
  Then the exit status indicates smells
217
190
  And it reports:
218
191
  """
219
- spec/samples/one_smelly_file/dirty.rb -- 3 warnings:
220
- [1]:D has no descriptive comment (IrresponsibleModule) [https://github.com/troessner/reek/wiki/Irresponsible-Module]
221
- [1]:D has the name 'D' (UncommunicativeModuleName) [https://github.com/troessner/reek/wiki/Uncommunicative-Module-Name]
222
- [2]:D#a has the name 'a' (UncommunicativeMethodName) [https://github.com/troessner/reek/wiki/Uncommunicative-Method-Name]
192
+ smelly.rb -- 3 warnings:
193
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall) [https://github.com/troessner/reek/wiki/Duplicate-Method-Call]
194
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall) [https://github.com/troessner/reek/wiki/Duplicate-Method-Call]
195
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName) [https://github.com/troessner/reek/wiki/Uncommunicative-Method-Name]
223
196
  """
224
197
 
225
198
  Examples:
@@ -228,14 +201,15 @@ Feature: Correctly formatted reports
228
201
  | --wiki-links |
229
202
 
230
203
  Scenario Outline: --wiki-links is independent of --line-numbers
231
- When I run reek <option> spec/samples/one_smelly_file/dirty.rb
204
+ Given a smelly file called 'smelly.rb'
205
+ When I run reek <option> smelly.rb
232
206
  Then the exit status indicates smells
233
207
  And it reports:
234
208
  """
235
- spec/samples/one_smelly_file/dirty.rb -- 3 warnings:
236
- D has no descriptive comment (IrresponsibleModule) [https://github.com/troessner/reek/wiki/Irresponsible-Module]
237
- D has the name 'D' (UncommunicativeModuleName) [https://github.com/troessner/reek/wiki/Uncommunicative-Module-Name]
238
- D#a has the name 'a' (UncommunicativeMethodName) [https://github.com/troessner/reek/wiki/Uncommunicative-Method-Name]
209
+ smelly.rb -- 3 warnings:
210
+ Smelly#m calls @foo.bar 2 times (DuplicateMethodCall) [https://github.com/troessner/reek/wiki/Duplicate-Method-Call]
211
+ Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall) [https://github.com/troessner/reek/wiki/Duplicate-Method-Call]
212
+ Smelly#m has the name 'm' (UncommunicativeMethodName) [https://github.com/troessner/reek/wiki/Uncommunicative-Method-Name]
239
213
  """
240
214
 
241
215
  Examples: