reek 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/.rubocop.yml +66 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +25 -0
- data/CHANGELOG +6 -0
- data/CONTRIBUTING.md +106 -0
- data/Gemfile +14 -0
- data/README.md +16 -21
- data/bin/reek +2 -2
- data/config/cucumber.yml +3 -0
- data/config/defaults.reek +1 -1
- data/features/command_line_interface/smell_selection.feature +4 -8
- data/features/command_line_interface/smells_count.feature +25 -32
- data/features/command_line_interface/stdin.feature +2 -2
- data/features/configuration_files/masking_smells.feature +30 -41
- data/features/configuration_files/overrides_defaults.feature +5 -3
- data/features/configuration_loading.feature +26 -23
- data/features/programmatic_access.feature +24 -0
- data/features/rake_task/rake_task.feature +25 -22
- data/features/reports/json.feature +24 -26
- data/features/reports/reports.feature +77 -103
- data/features/reports/yaml.feature +26 -20
- data/features/ruby_api/api.feature +4 -3
- data/features/samples.feature +21 -20
- data/features/step_definitions/.rubocop.yml +5 -0
- data/features/step_definitions/reek_steps.rb +16 -28
- data/features/step_definitions/sample_file_steps.rb +158 -0
- data/features/support/env.rb +16 -27
- data/lib/reek.rb +3 -3
- data/lib/reek/cli/application.rb +4 -4
- data/lib/reek/cli/command.rb +1 -1
- data/lib/reek/cli/input.rb +2 -4
- data/lib/reek/cli/option_interpreter.rb +9 -9
- data/lib/reek/cli/options.rb +5 -4
- data/lib/reek/cli/reek_command.rb +3 -3
- data/lib/reek/cli/report/formatter.rb +2 -2
- data/lib/reek/cli/report/heading_formatter.rb +1 -1
- data/lib/reek/cli/report/location_formatter.rb +1 -1
- data/lib/reek/cli/report/report.rb +4 -4
- data/lib/reek/configuration/app_configuration.rb +1 -1
- data/lib/reek/configuration/configuration_file_finder.rb +17 -32
- data/lib/reek/core/code_context.rb +1 -1
- data/lib/reek/core/method_context.rb +6 -2
- data/lib/reek/core/module_context.rb +2 -2
- data/lib/reek/core/singleton_method_context.rb +1 -1
- data/lib/reek/core/smell_repository.rb +3 -2
- data/lib/reek/core/tree_walker.rb +4 -4
- data/lib/reek/examiner.rb +4 -4
- data/lib/reek/smells/attribute.rb +3 -3
- data/lib/reek/smells/boolean_parameter.rb +2 -2
- data/lib/reek/smells/class_variable.rb +2 -2
- data/lib/reek/smells/control_parameter.rb +2 -2
- data/lib/reek/smells/data_clump.rb +2 -3
- data/lib/reek/smells/duplicate_method_call.rb +2 -2
- data/lib/reek/smells/feature_envy.rb +6 -2
- data/lib/reek/smells/irresponsible_module.rb +3 -3
- data/lib/reek/smells/long_parameter_list.rb +3 -3
- data/lib/reek/smells/long_yield_list.rb +2 -2
- data/lib/reek/smells/module_initialize.rb +2 -2
- data/lib/reek/smells/nested_iterators.rb +2 -2
- data/lib/reek/smells/nil_check.rb +2 -2
- data/lib/reek/smells/prima_donna_method.rb +2 -2
- data/lib/reek/smells/repeated_conditional.rb +3 -2
- data/lib/reek/smells/smell_detector.rb +2 -2
- data/lib/reek/smells/too_many_instance_variables.rb +2 -2
- data/lib/reek/smells/too_many_methods.rb +2 -2
- data/lib/reek/smells/too_many_statements.rb +2 -2
- data/lib/reek/smells/uncommunicative_method_name.rb +2 -2
- data/lib/reek/smells/uncommunicative_module_name.rb +2 -2
- data/lib/reek/smells/uncommunicative_parameter_name.rb +2 -2
- data/lib/reek/smells/uncommunicative_variable_name.rb +2 -2
- data/lib/reek/smells/unused_parameters.rb +2 -2
- data/lib/reek/smells/utility_function.rb +8 -9
- data/lib/reek/source/ast_node.rb +1 -1
- data/lib/reek/source/ast_node_class_map.rb +6 -6
- data/lib/reek/source/sexp_extensions.rb +11 -2
- data/lib/reek/source/source_code.rb +10 -2
- data/lib/reek/source/source_locator.rb +1 -3
- data/lib/reek/source/source_repository.rb +3 -4
- data/lib/reek/source/tree_dresser.rb +2 -2
- data/lib/reek/spec.rb +3 -3
- data/lib/reek/spec/should_reek.rb +3 -3
- data/lib/reek/spec/should_reek_of.rb +1 -1
- data/lib/reek/spec/should_reek_only_of.rb +3 -3
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +18 -24
- data/spec/factories/factories.rb +1 -1
- data/spec/gem/updates_spec.rb +1 -1
- data/spec/gem/yard_spec.rb +1 -1
- data/spec/quality/reek_source_spec.rb +1 -1
- data/spec/reek/cli/html_report_spec.rb +6 -9
- data/spec/reek/cli/json_report_spec.rb +6 -6
- data/spec/reek/cli/option_interperter_spec.rb +5 -5
- data/spec/reek/cli/text_report_spec.rb +16 -19
- data/spec/reek/cli/yaml_report_spec.rb +7 -10
- data/spec/reek/configuration/app_configuration_spec.rb +23 -25
- data/spec/reek/configuration/configuration_file_finder_spec.rb +46 -21
- data/spec/reek/core/code_context_spec.rb +17 -19
- data/spec/reek/core/method_context_spec.rb +15 -14
- data/spec/reek/core/module_context_spec.rb +5 -7
- data/spec/reek/core/object_refs_spec.rb +4 -6
- data/spec/reek/core/singleton_method_context_spec.rb +5 -7
- data/spec/reek/core/smell_configuration_spec.rb +5 -7
- data/spec/reek/core/smell_repository_spec.rb +8 -8
- data/spec/reek/core/stop_context_spec.rb +4 -7
- data/spec/reek/core/tree_walker_spec.rb +5 -7
- data/spec/reek/core/warning_collector_spec.rb +5 -7
- data/spec/reek/examiner_spec.rb +10 -12
- data/spec/reek/smell_warning_spec.rb +7 -9
- data/spec/reek/smells/attribute_spec.rb +6 -6
- data/spec/reek/smells/boolean_parameter_spec.rb +4 -4
- data/spec/reek/smells/class_variable_spec.rb +6 -6
- data/spec/reek/smells/control_parameter_spec.rb +4 -4
- data/spec/reek/smells/data_clump_spec.rb +4 -4
- data/spec/reek/smells/duplicate_method_call_spec.rb +6 -6
- data/spec/reek/smells/feature_envy_spec.rb +9 -10
- data/spec/reek/smells/irresponsible_module_spec.rb +7 -7
- data/spec/reek/smells/long_parameter_list_spec.rb +5 -5
- data/spec/reek/smells/long_yield_list_spec.rb +5 -5
- data/spec/reek/smells/module_initialize_spec.rb +3 -3
- data/spec/reek/smells/nested_iterators_spec.rb +4 -4
- data/spec/reek/smells/nil_check_spec.rb +5 -5
- data/spec/reek/smells/prima_donna_method_spec.rb +7 -4
- data/spec/reek/smells/repeated_conditional_spec.rb +12 -11
- data/spec/reek/smells/smell_detector_shared.rb +4 -5
- data/spec/reek/smells/too_many_instance_variables_spec.rb +4 -4
- data/spec/reek/smells/too_many_methods_spec.rb +11 -7
- data/spec/reek/smells/too_many_statements_spec.rb +6 -5
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +4 -4
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +7 -7
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +5 -5
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +9 -6
- data/spec/reek/smells/unused_parameters_spec.rb +3 -3
- data/spec/reek/smells/utility_function_spec.rb +41 -37
- data/spec/reek/source/code_comment_spec.rb +19 -17
- data/spec/reek/source/object_source_spec.rb +1 -3
- data/spec/reek/source/reference_collector_spec.rb +5 -6
- data/spec/reek/source/sexp_extensions_spec.rb +9 -11
- data/spec/reek/source/sexp_formatter_spec.rb +7 -8
- data/spec/reek/source/sexp_node_spec.rb +3 -5
- data/spec/reek/source/source_code_spec.rb +9 -9
- data/spec/reek/source/tree_dresser_spec.rb +4 -6
- data/spec/reek/spec/should_reek_of_spec.rb +11 -10
- data/spec/reek/spec/should_reek_only_of_spec.rb +4 -7
- data/spec/reek/spec/should_reek_spec.rb +4 -7
- data/spec/samples/{overrides/masked/lower.reek → masked_by_dotfile/.reek} +3 -1
- data/spec/spec_helper.rb +4 -4
- data/tasks/develop.rake +1 -1
- data/tasks/reek.rake +1 -1
- metadata +72 -86
- data/features/support/hooks.rb +0 -15
- data/lib/reek/source.rb +0 -16
- data/lib/reek/source/core_extras.rb +0 -46
- data/lib/reek/source/source_file.rb +0 -16
- data/spec/samples/config/allow_duplication.reek +0 -3
- data/spec/samples/config/deeper_nested_iterators.reek +0 -3
- data/spec/samples/configuration_loading/minimal_dirty.rb +0 -4
- data/spec/samples/configuration_loading/reek-test-run-disable_smells.reek +0 -7
- data/spec/samples/configuration_loading/reek-test-run-enable_smells.reek +0 -7
- data/spec/samples/corrupt_config_file/corrupt.reek +0 -1
- data/spec/samples/corrupt_config_file/dirty.rb +0 -8
- data/spec/samples/demo/demo.rb +0 -8
- data/spec/samples/empty_config_file/dirty.rb +0 -8
- data/spec/samples/empty_config_file/empty.reek +0 -0
- data/spec/samples/inline_config/dirty.rb +0 -16
- data/spec/samples/inline_config/masked.reek +0 -7
- data/spec/samples/mask_some/dirty.rb +0 -8
- data/spec/samples/mask_some/some.reek +0 -8
- data/spec/samples/masked/dirty.rb +0 -8
- data/spec/samples/masked/masked.reek +0 -5
- data/spec/samples/minimal_smelly_and_masked/config.reek +0 -7
- data/spec/samples/minimal_smelly_and_masked/minimal_dirty.rb +0 -4
- data/spec/samples/mixed_results/clean_one.rb +0 -7
- data/spec/samples/mixed_results/clean_three.rb +0 -7
- data/spec/samples/mixed_results/clean_two.rb +0 -7
- data/spec/samples/mixed_results/dirty_one.rb +0 -8
- data/spec/samples/mixed_results/dirty_two.rb +0 -8
- data/spec/samples/not_quite_masked/dirty.rb +0 -8
- data/spec/samples/not_quite_masked/masked.reek +0 -5
- data/spec/samples/not_quite_masked/smelly.rb +0 -3
- data/spec/samples/one_smelly_file/dirty.rb +0 -3
- data/spec/samples/overrides/masked/dirty.rb +0 -8
- data/spec/samples/overrides/upper.reek +0 -5
- data/spec/samples/overrides_defaults/camel_case.rb +0 -14
- data/spec/samples/overrides_defaults/config.reek +0 -6
- data/spec/samples/standard_smelly/dirty.rb +0 -8
- data/spec/samples/standard_smelly/minimal_dirty.rb +0 -4
- data/spec/samples/three_smelly_files/dirty_one.rb +0 -3
- data/spec/samples/three_smelly_files/dirty_three.rb +0 -5
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3eceb35601fc0869c63c3b45034947d62e803a
|
4
|
+
data.tar.gz: bfafa8489c105d8cd9681dcd1ba640f501abf928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2474b97d54de8ed1b7aa7424a706d18e0f2812b2ac9e7959be70f6b301c8a643968f7cffeff6a83a98b3f65a6aae144a9e743bfca82e6bd4832cfb226b11520
|
7
|
+
data.tar.gz: e4cc1838cbefcd6cdd85f3675f64476ffb1a37ec26e541778f742855cae709ae63199e1069dca2d224eb87b00090496cf344eaef2d5e1cff74467bf25ffeb8a4
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -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
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
reek
|
data/.travis.yml
ADDED
@@ -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
data/CONTRIBUTING.md
ADDED
@@ -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
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
|
-
|
45
|
-
Dirty has no descriptive comment (IrresponsibleModule)
|
46
|
-
Dirty#awful has 4 parameters (LongParameterList)
|
47
|
-
Dirty#awful has boolean parameter 'log' (
|
48
|
-
Dirty#awful has the parameter name 'x' (
|
49
|
-
Dirty#awful has the
|
50
|
-
Dirty#awful has
|
51
|
-
Dirty#awful has unused parameter '
|
52
|
-
Dirty#awful has unused parameter '
|
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-
|
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
|
-
|
221
|
-
[
|
222
|
-
|
223
|
-
|
224
|
-
[
|
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
data/config/cucumber.yml
ADDED
data/config/defaults.reek
CHANGED
@@ -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
|
-
|
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
|
-
|
12
|
-
|
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
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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)
|