reek 4.2.3 → 4.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +7 -6
- data/Gemfile +2 -2
- data/README.md +8 -15
- data/Rakefile +1 -1
- data/defaults.reek +1 -0
- data/features/command_line_interface/basic_usage.feature +8 -14
- data/features/command_line_interface/smell_selection.feature +4 -4
- data/features/command_line_interface/smells_count.feature +12 -14
- data/features/configuration_files/masking_smells.feature +31 -24
- data/features/configuration_loading.feature +15 -18
- data/features/programmatic_access.feature +7 -9
- data/features/rake_task/rake_task.feature +20 -24
- data/features/reports/json.feature +16 -28
- data/features/reports/reports.feature +56 -67
- data/features/reports/yaml.feature +13 -26
- data/features/samples.feature +3 -3
- data/features/step_definitions/sample_file_steps.rb +22 -156
- data/features/todo_list.feature +13 -14
- data/lib/reek/cli/options.rb +1 -1
- data/lib/reek/examiner.rb +45 -10
- data/lib/reek/smells/attribute.rb +3 -4
- data/lib/reek/smells/boolean_parameter.rb +2 -2
- data/lib/reek/smells/class_variable.rb +1 -1
- data/lib/reek/smells/control_parameter.rb +4 -4
- data/lib/reek/smells/data_clump.rb +2 -3
- data/lib/reek/smells/duplicate_method_call.rb +1 -1
- data/lib/reek/smells/feature_envy.rb +2 -2
- data/lib/reek/smells/irresponsible_module.rb +2 -3
- data/lib/reek/smells/long_parameter_list.rb +1 -1
- data/lib/reek/smells/long_yield_list.rb +1 -1
- data/lib/reek/smells/module_initialize.rb +1 -1
- data/lib/reek/smells/nested_iterators.rb +2 -2
- data/lib/reek/smells/nil_check.rb +1 -1
- data/lib/reek/smells/prima_donna_method.rb +5 -2
- data/lib/reek/smells/repeated_conditional.rb +1 -1
- data/lib/reek/smells/smell_detector.rb +1 -1
- data/lib/reek/smells/smell_warning.rb +6 -5
- data/lib/reek/smells/subclassed_from_core_class.rb +3 -3
- data/lib/reek/smells/too_many_constants.rb +1 -1
- data/lib/reek/smells/too_many_instance_variables.rb +1 -1
- data/lib/reek/smells/too_many_methods.rb +1 -1
- data/lib/reek/smells/too_many_statements.rb +1 -1
- data/lib/reek/smells/uncommunicative_method_name.rb +1 -1
- data/lib/reek/smells/uncommunicative_module_name.rb +1 -1
- data/lib/reek/smells/uncommunicative_parameter_name.rb +1 -1
- data/lib/reek/smells/uncommunicative_variable_name.rb +1 -1
- data/lib/reek/smells/unused_parameters.rb +1 -1
- data/lib/reek/smells/unused_private_method.rb +1 -1
- data/lib/reek/smells/utility_function.rb +2 -3
- data/lib/reek/spec/should_reek_of.rb +14 -1
- data/lib/reek/version.rb +1 -1
- data/samples/checkstyle.xml +7 -0
- data/samples/clean.rb +6 -0
- data/samples/configuration/.reek +0 -0
- data/samples/configuration/corrupt.reek +1 -0
- data/samples/configuration/empty.reek +0 -0
- data/samples/configuration/full_configuration.reek +9 -0
- data/{spec/samples/configuration/simple_configuration.reek → samples/configuration/full_mask.reek} +2 -2
- data/samples/configuration/non_public_modifiers_mask.reek +3 -0
- data/samples/configuration/partial_mask.reek +3 -0
- data/samples/configuration/with_excluded_paths.reek +4 -0
- data/{spec/samples → samples}/exceptions.reek +0 -0
- data/{spec/samples → samples}/inline.rb +0 -0
- data/{spec/samples → samples}/optparse.rb +0 -0
- data/samples/paths.rb +4 -0
- data/{spec/samples → samples}/redcloth.rb +0 -0
- data/samples/smelly.rb +7 -0
- data/samples/smelly_with_inline_mask.rb +8 -0
- data/samples/smelly_with_modifiers.rb +12 -0
- data/{spec/samples → samples}/source_with_exclude_paths/ignore_me/uncommunicative_method_name.rb +0 -0
- data/{spec/samples → samples}/source_with_exclude_paths/nested/ignore_me_as_well/irresponsible_module.rb +0 -0
- data/{spec/samples → samples}/source_with_exclude_paths/nested/uncommunicative_parameter_name.rb +0 -0
- data/{spec/samples → samples}/source_with_hidden_directories/.hidden/uncommunicative_method_name.rb +0 -0
- data/{spec/samples → samples}/source_with_hidden_directories/uncommunicative_parameter_name.rb +0 -0
- data/{spec/samples → samples}/source_with_non_ruby_files/gibberish +0 -0
- data/{spec/samples → samples}/source_with_non_ruby_files/python_source.py +0 -0
- data/{spec/samples → samples}/source_with_non_ruby_files/uncommunicative_parameter_name.rb +0 -0
- data/spec/reek/cli/application_spec.rb +1 -1
- data/spec/reek/cli/command/report_command_spec.rb +2 -5
- data/spec/reek/configuration/app_configuration_spec.rb +10 -8
- data/spec/reek/configuration/configuration_file_finder_spec.rb +24 -17
- data/spec/reek/examiner_spec.rb +84 -5
- data/spec/reek/report/json_report_spec.rb +1 -3
- data/spec/reek/report/xml_report_spec.rb +2 -3
- data/spec/reek/report/yaml_report_spec.rb +0 -2
- data/spec/reek/smells/attribute_spec.rb +21 -10
- data/spec/reek/smells/boolean_parameter_spec.rb +13 -12
- data/spec/reek/smells/class_variable_spec.rb +4 -4
- data/spec/reek/smells/control_parameter_spec.rb +25 -18
- data/spec/reek/smells/data_clump_spec.rb +5 -5
- data/spec/reek/smells/duplicate_method_call_spec.rb +1 -1
- data/spec/reek/smells/feature_envy_spec.rb +8 -2
- data/spec/reek/smells/irresponsible_module_spec.rb +16 -14
- data/spec/reek/smells/long_parameter_list_spec.rb +5 -1
- data/spec/reek/smells/long_yield_list_spec.rb +5 -2
- data/spec/reek/smells/nested_iterators_spec.rb +37 -13
- data/spec/reek/smells/nil_check_spec.rb +50 -53
- data/spec/reek/smells/prima_donna_method_spec.rb +9 -1
- data/spec/reek/smells/too_many_instance_variables_spec.rb +1 -1
- data/spec/reek/smells/too_many_methods_spec.rb +4 -4
- data/spec/reek/smells/too_many_statements_spec.rb +1 -1
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +3 -3
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +3 -3
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +3 -3
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +3 -3
- data/spec/reek/smells/utility_function_spec.rb +12 -8
- data/spec/reek/source/source_locator_spec.rb +5 -1
- data/spec/reek/spec/should_reek_of_spec.rb +20 -13
- data/spec/reek/spec/should_reek_spec.rb +6 -11
- data/spec/spec_helper.rb +2 -2
- metadata +28 -36
- data/spec/samples/all_but_one_masked/clean_one.rb +0 -7
- data/spec/samples/all_but_one_masked/dirty.rb +0 -8
- data/spec/samples/all_but_one_masked/masked.reek +0 -9
- data/spec/samples/checkstyle.xml +0 -13
- data/spec/samples/clean_due_to_masking/clean_one.rb +0 -7
- data/spec/samples/clean_due_to_masking/clean_three.rb +0 -7
- data/spec/samples/clean_due_to_masking/clean_two.rb +0 -7
- data/spec/samples/clean_due_to_masking/dirty_one.rb +0 -7
- data/spec/samples/clean_due_to_masking/dirty_two.rb +0 -7
- data/spec/samples/clean_due_to_masking/masked.reek +0 -11
- data/spec/samples/configuration/full_configuration.reek +0 -9
- data/spec/samples/configuration/with_excluded_paths.reek +0 -4
- data/spec/samples/masked_by_dotfile/.reek +0 -9
- data/spec/samples/masked_by_dotfile/dirty.rb +0 -8
- data/spec/samples/no_config_file/dirty.rb +0 -8
- data/spec/samples/three_clean_files/clean_one.rb +0 -7
- data/spec/samples/three_clean_files/clean_three.rb +0 -7
- data/spec/samples/three_clean_files/clean_two.rb +0 -7
- data/spec/samples/two_smelly_files/dirty_one.rb +0 -8
- data/spec/samples/two_smelly_files/dirty_two.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7756b10a94b5df5b45c50b6cdaa6577146dbbf15
|
|
4
|
+
data.tar.gz: d1e67defd358f1ce5f60affaa2c33e45aa09d744
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f2cbb1aacb409e57504ab7206b917648ad9e5db97a98302179a5902ab8a8b83335fcc674580f380f2314ec055f9c8be35156c1bab5d7b5ba6384429a8b42fdf9
|
|
7
|
+
data.tar.gz: 7476f5a7ce8dc2a0ab1f4791c1d5d0a4688b2462761f50775dd8404928faced642dfeedbbacbb2d3525e673003889fe3e7c643305bb92658ea397ad5fcdc4368
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 4.2.4 (2016-08-15)
|
|
4
|
+
|
|
5
|
+
* (troessner) Make Reek more resilient on incomprehensible source.
|
|
6
|
+
* (troessner) Make our parameter handling consistent in smell detectors.
|
|
7
|
+
* (Drenmi) Rename `#inspect` method to `#sniff`
|
|
8
|
+
|
|
3
9
|
## 4.2.3 (2016-08-05)
|
|
4
10
|
|
|
5
11
|
* (soutaro) Add SexpExtensions::CSendNode for safe navigation operator
|
data/CONTRIBUTING.md
CHANGED
|
@@ -10,8 +10,6 @@ only to find us suggesting large parts should be rewritten.
|
|
|
10
10
|
Don’t hesitate to offer trivial fixes (spelling, better naming
|
|
11
11
|
ideas, etc.) – we’ll let you know if you’re overdoing it. :)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
13
|
## Reporting Issues
|
|
16
14
|
|
|
17
15
|
Search [all existing (open _and_ closed)
|
|
@@ -29,8 +27,6 @@ version, Ruby platform (MRI, JRuby, etc.), operating system.
|
|
|
29
27
|
Try to provide a minimal example that reproduces the issue.
|
|
30
28
|
Extra kudos if you can write it as a failing test. :)
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
30
|
## Setup and Pull Request Basics
|
|
35
31
|
|
|
36
32
|
Fork Reek, then clone it, make sure you have
|
|
@@ -55,8 +51,13 @@ Make sure you have read our [style guide](docs/style-guide.md) before you
|
|
|
55
51
|
start contributing.
|
|
56
52
|
|
|
57
53
|
Then start hacking and add new tests which make sure that your new feature works or
|
|
58
|
-
demonstrate that your fix was needed
|
|
59
|
-
|
|
54
|
+
demonstrate that your fix was needed.
|
|
55
|
+
Reek is using [Rspec](http://rspec.info/) for unit and functional testing and [cucumber]() for integration tests.
|
|
56
|
+
|
|
57
|
+
When it comes to Rspec we're trying to follow [betterspecs](http://betterspecs.org/).
|
|
58
|
+
Additonally you can find an excellent cheat sheet on how to write idiomatic Rspec [here](http://www.rubypigeon.com/posts/rspec-core-cheat-sheet).
|
|
59
|
+
|
|
60
|
+
We also care a lot about [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
|
60
61
|
|
|
61
62
|
Once you’re happy with your feature / fix – or want to
|
|
62
63
|
share it as a work-in-progress and request comments – once
|
data/Gemfile
CHANGED
|
@@ -10,9 +10,9 @@ group :development do
|
|
|
10
10
|
gem 'mutant-rspec', '~> 0.8.8'
|
|
11
11
|
gem 'rake', '~> 11.1'
|
|
12
12
|
gem 'rspec', '~> 3.0'
|
|
13
|
-
gem 'rubocop', '~> 0.
|
|
13
|
+
gem 'rubocop', '~> 0.42.0'
|
|
14
14
|
gem 'simplecov', '~> 0.12.0'
|
|
15
|
-
gem 'yard', '~> 0.
|
|
15
|
+
gem 'yard', '~> 0.9.5'
|
|
16
16
|
gem 'activesupport', '~> 4.2'
|
|
17
17
|
|
|
18
18
|
platforms :mri do
|
data/README.md
CHANGED
|
@@ -71,12 +71,11 @@ reek [options] [dir_or_source_file]*
|
|
|
71
71
|
Imagine a source file `demo.rb` containing:
|
|
72
72
|
|
|
73
73
|
```Ruby
|
|
74
|
-
class
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
puts @screen.contents
|
|
74
|
+
# Smelly class
|
|
75
|
+
class Smelly
|
|
76
|
+
# This will reek of UncommunicativeMethodName
|
|
77
|
+
def x
|
|
78
|
+
y = 10 # This will reek of UncommunicativeVariableName
|
|
80
79
|
end
|
|
81
80
|
end
|
|
82
81
|
```
|
|
@@ -85,15 +84,9 @@ Reek will report the following code smells in this file:
|
|
|
85
84
|
|
|
86
85
|
```
|
|
87
86
|
$ reek demo.rb
|
|
88
|
-
demo.rb --
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[3]:Dirty#awful has boolean parameter 'log' (BooleanParameter)
|
|
92
|
-
[3]:Dirty#awful has the parameter name 'x' (UncommunicativeParameterName)
|
|
93
|
-
[5]:Dirty#awful has the variable name 'w' (UncommunicativeVariableName)
|
|
94
|
-
[3]:Dirty#awful has unused parameter 'log' (UnusedParameters)
|
|
95
|
-
[3]:Dirty#awful has unused parameter 'offset' (UnusedParameters)
|
|
96
|
-
[3]:Dirty#awful has unused parameter 'y' (UnusedParameters)
|
|
87
|
+
demo.rb -- 2 warnings:
|
|
88
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
89
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
97
90
|
```
|
|
98
91
|
|
|
99
92
|
## Supported rubies
|
data/Rakefile
CHANGED
data/defaults.reek
CHANGED
|
@@ -3,19 +3,13 @@ Feature: The Reek CLI maintains backwards compatibility
|
|
|
3
3
|
As a developer
|
|
4
4
|
I want to have a stable basic command line interface
|
|
5
5
|
|
|
6
|
-
Scenario: the
|
|
7
|
-
Given the smelly file '
|
|
8
|
-
When I run reek
|
|
6
|
+
Scenario: the example from README reports as expected
|
|
7
|
+
Given the smelly file 'smelly.rb'
|
|
8
|
+
When I run reek smelly.rb
|
|
9
9
|
Then the exit status indicates smells
|
|
10
10
|
And it reports:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[3]:UncommunicativeParameterName: Dirty#awful has the parameter name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Parameter-Name.md]
|
|
17
|
-
[5]:UncommunicativeVariableName: Dirty#awful has the variable name 'w' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
18
|
-
[3]:UnusedParameters: Dirty#awful has unused parameter 'log' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
|
19
|
-
[3]:UnusedParameters: Dirty#awful has unused parameter 'offset' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
|
20
|
-
[3]:UnusedParameters: Dirty#awful has unused parameter 'y' [https://github.com/troessner/reek/blob/master/docs/Unused-Parameters.md]
|
|
21
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
smelly.rb -- 2 warnings:
|
|
13
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
14
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
15
|
+
"""
|
|
@@ -4,12 +4,12 @@ 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
|
-
Given
|
|
8
|
-
And a configuration file
|
|
9
|
-
When I run reek --no-line-numbers --smell
|
|
7
|
+
Given the smelly file 'smelly.rb'
|
|
8
|
+
And a configuration file 'partial_mask.reek'
|
|
9
|
+
When I run reek --no-line-numbers --smell UncommunicativeVariableName smelly.rb
|
|
10
10
|
Then the exit status indicates smells
|
|
11
11
|
And it reports:
|
|
12
12
|
"""
|
|
13
13
|
smelly.rb -- 1 warning:
|
|
14
|
-
|
|
14
|
+
UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
15
15
|
"""
|
|
@@ -3,15 +3,14 @@ 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
|
-
Given
|
|
6
|
+
Given the smelly file 'smelly.rb'
|
|
7
7
|
When I run reek smelly.rb
|
|
8
8
|
Then the exit status indicates smells
|
|
9
9
|
And it reports:
|
|
10
10
|
"""
|
|
11
|
-
smelly.rb --
|
|
12
|
-
[4
|
|
13
|
-
[
|
|
14
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
11
|
+
smelly.rb -- 2 warnings:
|
|
12
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
13
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
15
14
|
"""
|
|
16
15
|
|
|
17
16
|
Scenario: Output total number of smells when inspecting multiple files
|
|
@@ -21,18 +20,17 @@ Feature: Reports total number of code smells
|
|
|
21
20
|
And it reports:
|
|
22
21
|
"""
|
|
23
22
|
smelly/dirty_one.rb -- 2 warnings:
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
smelly/dirty_two.rb --
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
|
|
30
|
-
5 total warnings
|
|
23
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
24
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
25
|
+
smelly/dirty_two.rb -- 2 warnings:
|
|
26
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
27
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
28
|
+
4 total warnings
|
|
31
29
|
"""
|
|
32
30
|
|
|
33
31
|
Scenario: Output total number of smells even if total equals 0
|
|
34
|
-
Given a directory called '
|
|
35
|
-
When I run reek
|
|
32
|
+
Given a directory called 'clean' containing two clean files
|
|
33
|
+
When I run reek clean
|
|
36
34
|
Then it succeeds
|
|
37
35
|
And it reports:
|
|
38
36
|
"""
|
|
@@ -4,8 +4,8 @@ Feature: Masking smells using config files
|
|
|
4
4
|
I want to mask some smells using config files
|
|
5
5
|
|
|
6
6
|
Scenario: corrupt config file prevents normal output
|
|
7
|
-
Given
|
|
8
|
-
And a
|
|
7
|
+
Given the smelly file 'smelly.rb'
|
|
8
|
+
And a configuration file 'corrupt.reek'
|
|
9
9
|
When I run reek -c corrupt.reek smelly.rb
|
|
10
10
|
Then it reports the error 'Error: Invalid configuration file "corrupt.reek" -- Not a hash'
|
|
11
11
|
And the exit status indicates an error
|
|
@@ -16,44 +16,51 @@ Feature: Masking smells using config files
|
|
|
16
16
|
Then it reports the error "Error: No such file - not_here.rb"
|
|
17
17
|
|
|
18
18
|
Scenario: masking smells in the configuration file
|
|
19
|
-
Given
|
|
20
|
-
And a
|
|
21
|
-
When I run reek -c
|
|
19
|
+
Given the smelly file 'smelly.rb'
|
|
20
|
+
And a configuration file 'full_mask.reek'
|
|
21
|
+
When I run reek -c full_mask.reek smelly.rb
|
|
22
22
|
Then it succeeds
|
|
23
23
|
And it reports nothing
|
|
24
24
|
|
|
25
25
|
Scenario: allow masking some calls for duplication smell
|
|
26
|
-
Given
|
|
27
|
-
And a configuration file
|
|
28
|
-
When I run reek -c
|
|
26
|
+
Given the smelly file 'smelly.rb'
|
|
27
|
+
And a configuration file 'partial_mask.reek'
|
|
28
|
+
When I run reek -c partial_mask.reek smelly.rb
|
|
29
29
|
Then the exit status indicates smells
|
|
30
30
|
And it reports:
|
|
31
31
|
"""
|
|
32
|
-
smelly.rb --
|
|
33
|
-
[
|
|
34
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
32
|
+
smelly.rb -- 1 warning:
|
|
33
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
35
34
|
"""
|
|
36
35
|
|
|
37
36
|
Scenario: provide extra masking inline in comments
|
|
38
|
-
Given
|
|
39
|
-
And a
|
|
40
|
-
When I run reek -c
|
|
37
|
+
Given the smelly file 'smelly_with_inline_mask.rb'
|
|
38
|
+
And a configuration file 'partial_mask.reek'
|
|
39
|
+
When I run reek -c partial_mask.reek smelly_with_inline_mask.rb
|
|
40
|
+
Then it succeeds
|
|
41
|
+
And it reports nothing
|
|
42
|
+
|
|
43
|
+
Scenario: empty config file outputs normally
|
|
44
|
+
Given the smelly file 'smelly.rb'
|
|
45
|
+
And a configuration file 'empty.reek'
|
|
46
|
+
When I run reek -c empty.reek smelly.rb
|
|
41
47
|
Then the exit status indicates smells
|
|
42
48
|
And it reports:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
"""
|
|
50
|
+
smelly.rb -- 2 warnings:
|
|
51
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
52
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
53
|
+
"""
|
|
54
|
+
|
|
48
55
|
|
|
49
56
|
Scenario: Disable UtilityFunction for non-public methods
|
|
50
|
-
Given
|
|
51
|
-
And a configuration file
|
|
52
|
-
When I run reek -c
|
|
57
|
+
Given the smelly file 'smelly_with_modifiers.rb'
|
|
58
|
+
And a configuration file 'non_public_modifiers_mask.reek'
|
|
59
|
+
When I run reek -c non_public_modifiers_mask.reek smelly_with_modifiers.rb
|
|
53
60
|
Then the exit status indicates smells
|
|
54
61
|
And it reports:
|
|
55
62
|
"""
|
|
56
|
-
|
|
57
|
-
[
|
|
63
|
+
smelly_with_modifiers.rb -- 1 warning:
|
|
64
|
+
[7]:UtilityFunction: Klass#public_method doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md]
|
|
58
65
|
"""
|
|
59
66
|
But it does not report private or protected methods
|
|
@@ -11,41 +11,38 @@ Feature: Offer different ways how to load configuration
|
|
|
11
11
|
Reek will check these in order and stop after the first file found.
|
|
12
12
|
|
|
13
13
|
Scenario: Default configuration
|
|
14
|
-
Given
|
|
14
|
+
Given the smelly file 'smelly.rb'
|
|
15
15
|
When I run reek smelly.rb
|
|
16
16
|
Then the exit status indicates smells
|
|
17
17
|
And it reports:
|
|
18
18
|
"""
|
|
19
|
-
smelly.rb --
|
|
20
|
-
[4
|
|
21
|
-
[
|
|
22
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
19
|
+
smelly.rb -- 2 warnings:
|
|
20
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
21
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
23
22
|
"""
|
|
24
23
|
|
|
25
24
|
Scenario: Configuration via CLI
|
|
26
|
-
Given
|
|
27
|
-
And a
|
|
28
|
-
When I run reek -c
|
|
25
|
+
Given the smelly file 'smelly.rb'
|
|
26
|
+
And a configuration file 'full_mask.reek'
|
|
27
|
+
When I run reek -c full_mask.reek smelly.rb
|
|
29
28
|
Then it reports no errors
|
|
30
29
|
And it succeeds
|
|
31
30
|
|
|
32
31
|
Scenario: Configuration file in working directory
|
|
33
|
-
Given
|
|
34
|
-
And a
|
|
32
|
+
Given the smelly file 'smelly.rb'
|
|
33
|
+
And a configuration file 'full_mask.reek'
|
|
35
34
|
When I run reek smelly.rb
|
|
36
35
|
Then it reports no errors
|
|
37
36
|
And it succeeds
|
|
38
37
|
|
|
39
38
|
Scenario: Two opposing configuration files and we stop after the first one
|
|
40
|
-
Given
|
|
41
|
-
And
|
|
42
|
-
And a
|
|
43
|
-
When I run "reek smelly.rb" in
|
|
39
|
+
Given the smelly file 'smelly.rb' in a subdirectory
|
|
40
|
+
And a configuration file 'partial_mask.reek' in a subdirectory
|
|
41
|
+
And a configuration file 'full_mask.reek'
|
|
42
|
+
When I run "reek smelly.rb" in a subdirectory
|
|
44
43
|
Then the exit status indicates smells
|
|
45
44
|
And it reports:
|
|
46
45
|
"""
|
|
47
|
-
smelly.rb --
|
|
48
|
-
[
|
|
49
|
-
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
|
|
50
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
46
|
+
smelly.rb -- 1 warning:
|
|
47
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
51
48
|
"""
|
|
@@ -4,7 +4,7 @@ Feature: Using Reek programmatically
|
|
|
4
4
|
I want to be able to use its classes
|
|
5
5
|
|
|
6
6
|
Scenario: Accessing smells found by an examiner
|
|
7
|
-
Given
|
|
7
|
+
Given the smelly file 'smelly.rb'
|
|
8
8
|
And a file named "examine.rb" with:
|
|
9
9
|
"""
|
|
10
10
|
require 'reek'
|
|
@@ -17,13 +17,12 @@ Feature: Using Reek programmatically
|
|
|
17
17
|
Then it reports no errors
|
|
18
18
|
And it reports:
|
|
19
19
|
"""
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
has the name 'm'
|
|
20
|
+
has the name 'x'
|
|
21
|
+
has the variable name 'y'
|
|
23
22
|
"""
|
|
24
23
|
|
|
25
24
|
Scenario: Using Reek's built-in report classes
|
|
26
|
-
Given
|
|
25
|
+
Given the smelly file 'smelly.rb'
|
|
27
26
|
And a file named "examine.rb" with:
|
|
28
27
|
"""
|
|
29
28
|
require 'reek'
|
|
@@ -36,8 +35,7 @@ Feature: Using Reek programmatically
|
|
|
36
35
|
Then it reports no errors
|
|
37
36
|
And it reports:
|
|
38
37
|
"""
|
|
39
|
-
smelly.rb --
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
UncommunicativeMethodName: Smelly#m has the name 'm'
|
|
38
|
+
smelly.rb -- 2 warnings:
|
|
39
|
+
UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
40
|
+
UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
43
41
|
"""
|
|
@@ -3,7 +3,7 @@ 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
|
|
6
|
+
Given the smelly file 'smelly.rb'
|
|
7
7
|
When I run rake reek with:
|
|
8
8
|
"""
|
|
9
9
|
Reek::Rake::Task.new do |t|
|
|
@@ -14,14 +14,13 @@ Feature: Reek can be driven through its Task
|
|
|
14
14
|
Then the exit status indicates an error
|
|
15
15
|
And it reports:
|
|
16
16
|
"""
|
|
17
|
-
smelly.rb --
|
|
18
|
-
[4
|
|
19
|
-
[
|
|
20
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
17
|
+
smelly.rb -- 2 warnings:
|
|
18
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
19
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
21
20
|
"""
|
|
22
21
|
|
|
23
22
|
Scenario: source_files using a FileList instead of a String
|
|
24
|
-
Given
|
|
23
|
+
Given the smelly file 'smelly.rb'
|
|
25
24
|
When I run rake reek with:
|
|
26
25
|
"""
|
|
27
26
|
Reek::Rake::Task.new do |t|
|
|
@@ -32,14 +31,13 @@ Feature: Reek can be driven through its Task
|
|
|
32
31
|
Then the exit status indicates an error
|
|
33
32
|
And it reports:
|
|
34
33
|
"""
|
|
35
|
-
smelly.rb --
|
|
36
|
-
[4
|
|
37
|
-
[
|
|
38
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
34
|
+
smelly.rb -- 2 warnings:
|
|
35
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
36
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
39
37
|
"""
|
|
40
38
|
|
|
41
39
|
Scenario: name changes the task name
|
|
42
|
-
Given
|
|
40
|
+
Given the smelly file 'smelly.rb'
|
|
43
41
|
When I run rake silky with:
|
|
44
42
|
"""
|
|
45
43
|
Reek::Rake::Task.new('silky') do |t|
|
|
@@ -50,14 +48,13 @@ Feature: Reek can be driven through its Task
|
|
|
50
48
|
Then the exit status indicates an error
|
|
51
49
|
And it reports:
|
|
52
50
|
"""
|
|
53
|
-
smelly.rb --
|
|
54
|
-
[4
|
|
55
|
-
[
|
|
56
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
51
|
+
smelly.rb -- 2 warnings:
|
|
52
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
53
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
57
54
|
"""
|
|
58
55
|
|
|
59
56
|
Scenario: verbose prints the reek command
|
|
60
|
-
Given
|
|
57
|
+
Given the smelly file 'smelly.rb'
|
|
61
58
|
When I run rake reek with:
|
|
62
59
|
"""
|
|
63
60
|
Reek::Rake::Task.new do |t|
|
|
@@ -69,7 +66,7 @@ Feature: Reek can be driven through its Task
|
|
|
69
66
|
And stdout includes "Running 'reek' rake command"
|
|
70
67
|
|
|
71
68
|
Scenario: fail_on_error can hide the error status
|
|
72
|
-
Given
|
|
69
|
+
Given the smelly file 'smelly.rb'
|
|
73
70
|
When I run rake reek with:
|
|
74
71
|
"""
|
|
75
72
|
Reek::Rake::Task.new do |t|
|
|
@@ -82,19 +79,18 @@ Feature: Reek can be driven through its Task
|
|
|
82
79
|
And it succeeds
|
|
83
80
|
And it reports:
|
|
84
81
|
"""
|
|
85
|
-
smelly.rb --
|
|
86
|
-
[4
|
|
87
|
-
[
|
|
88
|
-
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
82
|
+
smelly.rb -- 2 warnings:
|
|
83
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
|
|
84
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
|
|
89
85
|
"""
|
|
90
86
|
|
|
91
87
|
Scenario: can be configured with config_file
|
|
92
|
-
Given
|
|
93
|
-
And a
|
|
88
|
+
Given the smelly file 'smelly.rb'
|
|
89
|
+
And a configuration file 'full_mask.reek'
|
|
94
90
|
When I run rake reek with:
|
|
95
91
|
"""
|
|
96
92
|
Reek::Rake::Task.new do |t|
|
|
97
|
-
t.config_file = '
|
|
93
|
+
t.config_file = 'full_mask.reek'
|
|
98
94
|
t.source_files = 'smelly.rb'
|
|
99
95
|
end
|
|
100
96
|
"""
|