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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8af5e0348f9f24426352d7790b0c3b4574b7128b
4
- data.tar.gz: 42b3c7339cae9caebbcab1ab5a6386b21165ae6a
3
+ metadata.gz: 4e3eceb35601fc0869c63c3b45034947d62e803a
4
+ data.tar.gz: bfafa8489c105d8cd9681dcd1ba640f501abf928
5
5
  SHA512:
6
- metadata.gz: c33ef48a39ed8a20ba2a5e4b1973851004f668d4b1878805ce0a245743cd5bbba0c64c4a96747200762b273eae7762433c0509376552620ebd490fa0c2203f9f
7
- data.tar.gz: f682a7ae37aa0787e5dd6215e03ee5340b121e0bc7532f8c0275b6c8274ffccd6345a3a61d7b51e3beb80baa53bb47fdfceaac6422802057741de0d45e7d1d36
6
+ metadata.gz: f2474b97d54de8ed1b7aa7424a706d18e0f2812b2ac9e7959be70f6b301c8a643968f7cffeff6a83a98b3f65a6aae144a9e743bfca82e6bd4832cfb226b11520
7
+ data.tar.gz: e4cc1838cbefcd6cdd85f3675f64476ffb1a37ec26e541778f742855cae709ae63199e1069dca2d224eb87b00090496cf344eaef2d5e1cff74467bf25ffeb8a4
@@ -0,0 +1,13 @@
1
+ pkg
2
+ spec/output
3
+ tmp
4
+ doc
5
+ .yardoc
6
+ .bundle
7
+ .rspec
8
+ .rbx
9
+ Gemfile.lock
10
+ *.swp
11
+ tags
12
+ .pryrc
13
+ .tags*
@@ -0,0 +1,66 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'spec/samples/**/*'
4
+ - 'tmp/**/*'
5
+ - 'vendor/**/*'
6
+
7
+ # FIXME: Lower the ABC size by fixing the biggest offenders
8
+ Metrics/AbcSize:
9
+ Max: 25
10
+
11
+ # FIXME: Make the class shorter
12
+ Metrics/ClassLength:
13
+ Exclude:
14
+ - lib/reek/core/tree_walker.rb
15
+
16
+ # FIXME: Lower the method length by fixing the biggest offenders
17
+ Metrics/MethodLength:
18
+ Max: 46
19
+
20
+ # Be a little more lenient with line length
21
+ Metrics/LineLength:
22
+ Max: 100
23
+
24
+ # Allow small arrays of words with quotes
25
+ Style/WordArray:
26
+ MinSize: 3
27
+
28
+ # Allow single-line method definitions
29
+ Style/SingleLineMethods:
30
+ Enabled: false
31
+
32
+ # Always use raise to signal exceptions
33
+ Style/SignalException:
34
+ EnforcedStyle: only_raise
35
+
36
+ # Allow multiple Hash parameters to look similar
37
+ Style/BracesAroundHashParameters:
38
+ EnforcedStyle: context_dependent
39
+
40
+ # Place . on the previous line
41
+ Style/DotPosition:
42
+ EnforcedStyle: trailing
43
+
44
+ # Require empty lines between defs, except for one-line defs
45
+ Style/EmptyLineBetweenDefs:
46
+ AllowAdjacentOneLineDefs: true
47
+
48
+ # Enforce GaurdClause if there are 2 or more lines in the body
49
+ Style/GuardClause:
50
+ MinBodyLength: 2
51
+
52
+ # Allow s()
53
+ Style/MethodCallParentheses:
54
+ Enabled: false
55
+
56
+ # Allow multiline block chains
57
+ Style/MultilineBlockChain:
58
+ Enabled: false
59
+
60
+ # Allow Perl-style references to regex matches
61
+ Style/PerlBackrefs:
62
+ Enabled: false
63
+
64
+ # Only register TrivialAccessors offenses when the name matches
65
+ Style/TrivialAccessors:
66
+ ExactNameMatch: true
@@ -0,0 +1 @@
1
+ reek
@@ -0,0 +1,25 @@
1
+ sudo: false
2
+ cache: bundler
3
+ language: ruby
4
+ bundler_args: --without local_development
5
+ script: bundle exec rake
6
+ rvm:
7
+ - 1.9.3
8
+ - 2.0.0
9
+ - 2.1
10
+ - 2.2
11
+ - jruby-19mode
12
+ - rbx-2
13
+ - ruby-head
14
+ - jruby-head
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: jruby-head
18
+ - rvm: ruby-head
19
+ notifications:
20
+ recipients:
21
+ - timo.roessner@googlemail.com
22
+ - matijs@matijs.net
23
+ - emil.rehnberg@gmail.com
24
+ - chastell@chastell.net
25
+ irc: "irc.freenode.org#reek"
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ == 2.1.0
2
+
3
+ * (mvz) Ensure require 'reek' is enough to use reek's classes
4
+ * (mvz) Pick config file that comes first alphabetically
5
+ * (mvz) Separate FeatureEnvy and UtilityFunction
6
+
1
7
  == 2.0.4
2
8
 
3
9
  * (chastell) Recognise .reek as a valid configuration file
@@ -0,0 +1,106 @@
1
+ # Contributing to reek
2
+
3
+ We welcome any and all contributions to reek!
4
+
5
+ If what you’re proposing requires significant work discuss it beforehand
6
+ as an issue – it’s much easier for us to guide you towards a good
7
+ solution and less frustrating for you than doing a lot of work
8
+ only to find us suggesting large parts should be rewritten.
9
+
10
+ Don’t hesitate to offer trivial fixes (spelling, better naming
11
+ ideas, etc.) – we’ll let you know if you’re overdoing it. :)
12
+
13
+
14
+
15
+ ## Reporting Issues
16
+
17
+ Search [all existing (open _and_ closed)
18
+ issues](https://github.com/troessner/reek/issues?q=is%3Aissue)
19
+ for a possible previous report; comment there if the issue is not
20
+ actually resolved properly or you have any additional information.
21
+
22
+ Include the steps to reproduce the issue,
23
+ the expected outcome and the actual outcome.
24
+
25
+ Include as much information as possible: the exact reek
26
+ invocation that you use, reek’s config and version, Ruby
27
+ version, Ruby platform (MRI, JRuby, etc.), operating system.
28
+
29
+ Try to provide a minimal example that reproduces the issue.
30
+ Extra kudos if you can write it as a failing test. :)
31
+
32
+
33
+
34
+ ## Setup and Pull Request Basics
35
+
36
+ Fork reek, then clone it, make sure you have
37
+ [Bundler](http://bundler.io) installed, install dependencies
38
+ and make sure all of the existing tests pass:
39
+
40
+ ```
41
+ git clone git@github.com:…username…/reek.git
42
+ cd reek
43
+ gem install bundler
44
+ bundle
45
+ bundle exec rake
46
+ ```
47
+
48
+ Once you’re sure your copy of reek works (and that there are no
49
+ failing tests on master…) create your own branch and start hacking:
50
+
51
+ ```
52
+ git checkout -b your_feature_or_fix_name
53
+ ```
54
+
55
+ Add new tests which make sure that your new feature works or
56
+ demonstrate that your fix was needed; please also [write good commit
57
+ messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
58
+
59
+ Once you’re happy with your feature / fix – or want to
60
+ share it as a work-in-progress and request comments – once
61
+ again make sure all of the tests pass. This will also run
62
+ [RuboCop](https://github.com/bbatsov/rubocop) – fix any
63
+ offences RuboCop finds (or discuss them in the pull request):
64
+
65
+ ```
66
+ bundle exec rake
67
+ ```
68
+
69
+ Once your code is ready for review push it to your repository:
70
+
71
+ ```
72
+ git push -u origin
73
+ ```
74
+
75
+ Then go to your GitHub fork and [make a pull
76
+ request](https://help.github.com/articles/creating-a-pull-request/)
77
+ to the original repository.
78
+
79
+
80
+
81
+ ## Review and Fixes
82
+
83
+ Try to gauge and let us know in the pull request whether what
84
+ you propose is a backward-compatible bugfix and should go into the
85
+ next patch release, is a backward-compatible feature and should go
86
+ into the next minor release, or has to break backward-compatibility
87
+ and so needs to wait for the next major release of reek.
88
+
89
+ Once your PR is open someone will review it, discuss the details (if
90
+ needed) and either merge right away or ask for some further fixes.
91
+
92
+ GitHub doesn’t have a good way to amend pull requests from external
93
+ repositories. In cases where it’s easier to make a direct fix
94
+ to your pull request (rather than describing it in the comments)
95
+ we’ll either open a separate pull request to the branch in your
96
+ repository or ask you to give us commit access to your repository.
97
+
98
+ If there were any fixes to your pull request we’ll ask you to
99
+ [squash](http://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits)
100
+ all of the commits into one:
101
+
102
+ ```
103
+ git rebase -i master
104
+ # squash squash squash
105
+ git push -f origin
106
+ ```
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # The gem's dependencies are specified in the gemspec
4
+ gemspec
5
+
6
+ group :local_development do
7
+ gem 'pry'
8
+ platforms :mri do
9
+ if RUBY_VERSION >= '2.0.0'
10
+ gem 'byebug'
11
+ gem 'pry-byebug'
12
+ end
13
+ end
14
+ end
data/README.md CHANGED
@@ -31,7 +31,7 @@ class Dirty
31
31
  # This method smells of :reek:NestedIterators but ignores them
32
32
  def awful(x, y, offset = 0, log = false)
33
33
  puts @screen.title
34
- @screen = widgets.map {|w| w.each {|key| key += 3}}
34
+ @screen = widgets.map {|w| w.each {|key| key += 3 * x}}
35
35
  puts @screen.contents
36
36
  end
37
37
  end
@@ -41,17 +41,15 @@ Reek will report the following code smells in this file:
41
41
 
42
42
  ```
43
43
  $ reek demo.rb
44
- spec/samples/demo/demo.rb -- 6 warnings:
45
- Dirty has no descriptive comment (IrresponsibleModule)
46
- Dirty#awful has 4 parameters (LongParameterList)
47
- Dirty#awful has boolean parameter 'log' (ControlCouple)
48
- Dirty#awful has the parameter name 'x' (UncommunicativeName)
49
- Dirty#awful has the parameter name 'y' (UncommunicativeName)
50
- Dirty#awful has the variable name 'w' (UncommunicativeName)
51
- Dirty#awful has unused parameter 'log' (UnusedParameters)
52
- Dirty#awful has unused parameter 'offset' (UnusedParameters)
53
- Dirty#awful has unused parameter 'x' (UnusedParameters)
54
- Dirty#awful has unused parameter 'y' (UnusedParameters)
44
+ demo.rb -- 8 warnings:
45
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
46
+ [3]:Dirty#awful has 4 parameters (LongParameterList)
47
+ [3]:Dirty#awful has boolean parameter 'log' (BooleanParameter)
48
+ [3]:Dirty#awful has the parameter name 'x' (UncommunicativeParameterName)
49
+ [5]:Dirty#awful has the variable name 'w' (UncommunicativeVariableName)
50
+ [3]:Dirty#awful has unused parameter 'log' (UnusedParameters)
51
+ [3]:Dirty#awful has unused parameter 'offset' (UnusedParameters)
52
+ [3]:Dirty#awful has unused parameter 'y' (UnusedParameters)
55
53
  ```
56
54
 
57
55
  ## Sources
@@ -171,7 +169,7 @@ reek [options] [dir_or_source_file]*
171
169
  there are quite a few other ways how to use reek in your projects:
172
170
 
173
171
  * Use `reek`'s [Rake Task](https://github.com/troessner/reek/wiki/Rake-Task) to automate detecting code smells
174
- * Add `reek`'s custom matcher to your [RSpec examples](https://github.com/troessner/reek/wiki/RSpec-Integration)
172
+ * Add `reek`'s custom matcher to your [RSpec examples](https://github.com/troessner/reek/wiki/RSpec-matchers)
175
173
  * Include `reek` using the [Developer API](https://github.com/troessner/reek/wiki/Developer-Api)
176
174
 
177
175
  ## Developing reek / Contributing
@@ -217,14 +215,11 @@ If you don't feel like getting your hands dirty with code there are still other
217
215
 
218
216
  ### Tools
219
217
 
220
- There's a vim plugin for `reek`:
221
- [https://github.com/rainerborene/vim-reek](https://github.com/rainerborene/vim-reek)
222
-
223
- TextMate Bundle for `reek`:
224
- [https://github.com/peeyush1234/reek.tmbundle](https://github.com/peeyush1234/reek.tmbundle)
225
-
226
- Colorful output for `reek`: [Preek](https://github.com/joenas/preek) (also with
227
- [Guard::Preek](https://github.com/joenas/guard-preek))
218
+ * [Vim plugin for `reek`](https://github.com/rainerborene/vim-reek)
219
+ * [TextMate Bundle for `reek`](https://github.com/peeyush1234/reek.tmbundle)
220
+ * [Colorful output for `reek`](https://github.com/joenas/preek)
221
+ (also with [Guard::Preek](https://github.com/joenas/guard-preek))
222
+ * [Atom plugin for `reek`](https://atom.io/packages/linter-reek)
228
223
 
229
224
  ### Find out more:
230
225
 
data/bin/reek CHANGED
@@ -6,6 +6,6 @@
6
6
  # Author: Kevin Rutherford
7
7
  #
8
8
 
9
- require 'reek/cli/application'
9
+ require_relative '../lib/reek/cli/application'
10
10
 
11
- exit Reek::Cli::Application.new(ARGV).execute
11
+ exit Reek::CLI::Application.new(ARGV).execute
@@ -0,0 +1,3 @@
1
+ default: --tags ~@wip -fprogress -r features features
2
+ wip: -fpretty --tags @wip --wip features
3
+
@@ -109,4 +109,4 @@ UnusedParameters:
109
109
  UtilityFunction:
110
110
  enabled: true
111
111
  exclude: []
112
- max_helper_calls: 1
112
+ max_helper_calls: 0
@@ -4,15 +4,11 @@ Feature: Smell selection
4
4
  I want to be able to selectively activate smell detectors
5
5
 
6
6
  Scenario: --smell selects a smell to detect
7
- When I run reek --no-line-numbers --smell DuplicateMethodCall spec/samples/two_smelly_files
7
+ Given a smelly file called 'smelly.rb'
8
+ When I run reek --no-line-numbers --smell UncommunicativeMethodName smelly.rb
8
9
  Then the exit status indicates smells
9
10
  And it reports:
10
11
  """
11
- spec/samples/two_smelly_files/dirty_one.rb -- 2 warnings:
12
- Dirty#a calls @s.title 2 times (DuplicateMethodCall)
13
- Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
14
- spec/samples/two_smelly_files/dirty_two.rb -- 2 warnings:
15
- Dirty#a calls @s.title 2 times (DuplicateMethodCall)
16
- Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
17
- 4 total warnings
12
+ smelly.rb -- 1 warning:
13
+ Smelly#m has the name 'm' (UncommunicativeMethodName)
18
14
  """
@@ -3,45 +3,38 @@ Feature: Reports total number of code smells
3
3
  Reek outputs the total number of smells among all files inspected.
4
4
 
5
5
  Scenario: Does not output total number of smells when inspecting single file
6
- When I run reek spec/samples/standard_smelly/dirty.rb
6
+ Given a smelly file called 'smelly.rb'
7
+ When I run reek smelly.rb
7
8
  Then the exit status indicates smells
8
9
  And it reports:
9
- """
10
- spec/samples/standard_smelly/dirty.rb -- 6 warnings:
11
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
12
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
13
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
14
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
15
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
16
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
17
- """
10
+ """
11
+ smelly.rb -- 3 warnings:
12
+ [4, 5]:Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
13
+ [4, 5]:Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
14
+ [3]:Smelly#m has the name 'm' (UncommunicativeMethodName)
15
+ """
18
16
 
19
17
  Scenario: Output total number of smells when inspecting multiple files
20
- When I run reek spec/samples/two_smelly_files
18
+ Given a directory called 'smelly' containing two smelly files
19
+ When I run reek smelly
21
20
  Then the exit status indicates smells
22
21
  And it reports:
23
- """
24
- spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
25
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
26
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
27
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
28
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
29
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
30
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
31
- spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
32
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
33
- [4, 6]:Dirty#a calls @s.title 2 times (DuplicateMethodCall)
34
- [4, 6]:Dirty#a calls puts(@s.title) 2 times (DuplicateMethodCall)
35
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
36
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
37
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
38
- 12 total warnings
39
- """
22
+ """
23
+ smelly/dirty_one.rb -- 2 warnings:
24
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
25
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
26
+ smelly/dirty_two.rb -- 3 warnings:
27
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
28
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
29
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
30
+ 5 total warnings
31
+ """
40
32
 
41
33
  Scenario: Output total number of smells even if total equals 0
42
- When I run reek spec/samples/three_clean_files
34
+ Given a directory called 'clean_files' containing some clean files
35
+ When I run reek clean_files
43
36
  Then it succeeds
44
37
  And it reports:
45
- """
46
- 0 total warnings
47
- """
38
+ """
39
+ 0 total warnings
40
+ """
@@ -18,7 +18,7 @@ Feature: Reek reads from $stdin when no files are given
18
18
  Then it succeeds
19
19
  And it reports:
20
20
  """
21
- $stdin -- 0 warnings
21
+ STDIN -- 0 warnings
22
22
  """
23
23
 
24
24
  Scenario: return non-zero status when there are smells
@@ -26,7 +26,7 @@ Feature: Reek reads from $stdin when no files are given
26
26
  Then the exit status indicates smells
27
27
  And it reports:
28
28
  """
29
- $stdin -- 3 warnings:
29
+ STDIN -- 3 warnings:
30
30
  [1]:Turn has no descriptive comment (IrresponsibleModule)
31
31
  [1]:Turn has the variable name '@x' (UncommunicativeVariableName)
32
32
  [1]:Turn#y has the name 'y' (UncommunicativeMethodName)