reek 4.8.1 → 5.0.2
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 +5 -5
- data/.rubocop.yml +17 -3
- data/.simplecov +1 -0
- data/.travis.yml +0 -5
- data/.yardopts +1 -1
- data/CHANGELOG.md +44 -0
- data/Gemfile +1 -1
- data/README.md +115 -100
- data/Rakefile +16 -3
- data/bin/reek +1 -3
- data/docs/API.md +2 -9
- data/docs/Basic-Smell-Options.md +51 -11
- data/docs/Code-Smells.md +1 -1
- data/docs/Command-Line-Options.md +14 -4
- data/docs/Duplicate-Method-Call.md +49 -1
- data/docs/Feature-Envy.md +44 -0
- data/docs/How-To-Write-New-Detectors.md +2 -3
- data/docs/Instance-Variable-Assumption.md +1 -1
- data/docs/{Prima-Donna-Method.md → Missing-Safe-Method.md} +11 -9
- data/docs/Rake-Task.md +1 -1
- data/docs/Reek-4-to-Reek-5-migration.md +193 -0
- data/docs/Reek-Driven-Development.md +1 -1
- data/docs/Uncommunicative-Method-Name.md +45 -6
- data/docs/Uncommunicative-Module-Name.md +49 -7
- data/docs/Uncommunicative-Parameter-Name.md +43 -5
- data/docs/Uncommunicative-Variable-Name.md +73 -2
- data/docs/Unused-Private-Method.md +1 -1
- data/docs/defaults.reek.yml +129 -0
- data/docs/yard_plugin.rb +1 -0
- data/features/command_line_interface/basic_usage.feature +2 -2
- data/features/command_line_interface/options.feature +46 -4
- data/features/command_line_interface/show_progress.feature +4 -4
- data/features/command_line_interface/smell_selection.feature +1 -1
- data/features/command_line_interface/smells_count.feature +6 -6
- data/features/command_line_interface/stdin.feature +30 -8
- data/features/configuration_files/accept_setting.feature +45 -28
- data/features/configuration_files/directory_specific_directives.feature +78 -73
- data/features/configuration_files/exclude_directives.feature +11 -10
- data/features/configuration_files/exclude_paths_directives.feature +4 -4
- data/features/configuration_files/masking_smells.feature +38 -9
- data/features/configuration_files/mix_accept_reject_setting.feature +31 -28
- data/features/configuration_files/reject_setting.feature +52 -41
- data/features/configuration_files/schema_validation.feature +59 -0
- data/features/configuration_files/unused_private_method.feature +18 -16
- data/features/configuration_loading.feature +53 -10
- data/features/configuration_via_source_comments/erroneous_source_comments.feature +2 -2
- data/features/configuration_via_source_comments/well_formed_source_comments.feature +2 -2
- data/features/locales.feature +2 -2
- data/features/rake_task/rake_task.feature +15 -15
- data/features/reports/json.feature +3 -3
- data/features/reports/reports.feature +34 -34
- data/features/reports/yaml.feature +3 -3
- data/features/rspec_matcher.feature +9 -1
- data/features/samples.feature +287 -287
- data/features/step_definitions/reek_steps.rb +4 -0
- data/features/step_definitions/sample_file_steps.rb +9 -4
- data/features/support/env.rb +2 -2
- data/features/todo_list.feature +26 -23
- data/lib/reek/ast/node.rb +3 -6
- data/lib/reek/ast/object_refs.rb +1 -1
- data/lib/reek/ast/sexp_extensions/case.rb +3 -1
- data/lib/reek/ast/sexp_extensions/if.rb +2 -2
- data/lib/reek/ast/sexp_extensions/logical_operators.rb +1 -1
- data/lib/reek/ast/sexp_extensions/methods.rb +1 -1
- data/lib/reek/cli/application.rb +4 -3
- data/lib/reek/cli/command/report_command.rb +1 -2
- data/lib/reek/cli/command/todo_list_command.rb +4 -2
- data/lib/reek/cli/options.rb +29 -14
- data/lib/reek/cli/silencer.rb +14 -3
- data/lib/reek/code_comment.rb +14 -16
- data/lib/reek/configuration/app_configuration.rb +32 -28
- data/lib/reek/configuration/configuration_converter.rb +110 -0
- data/lib/reek/configuration/configuration_file_finder.rb +15 -40
- data/lib/reek/configuration/configuration_validator.rb +12 -23
- data/lib/reek/configuration/default_directive.rb +17 -3
- data/lib/reek/configuration/directory_directives.rb +17 -11
- data/lib/reek/configuration/excluded_paths.rb +1 -1
- data/lib/reek/configuration/rake_task_converter.rb +29 -0
- data/lib/reek/configuration/schema.yml +210 -0
- data/lib/reek/configuration/schema_validator.rb +38 -0
- data/lib/reek/context/attribute_context.rb +1 -1
- data/lib/reek/context/code_context.rb +4 -4
- data/lib/reek/context/method_context.rb +2 -2
- data/lib/reek/context/module_context.rb +1 -1
- data/lib/reek/context_builder.rb +9 -9
- data/lib/reek/detector_repository.rb +6 -0
- data/lib/reek/documentation_link.rb +28 -0
- data/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb +4 -3
- data/lib/reek/errors/bad_detector_in_comment_error.rb +4 -3
- data/lib/reek/errors/config_file_error.rb +11 -0
- data/lib/reek/errors/encoding_error.rb +2 -2
- data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +4 -3
- data/lib/reek/errors/incomprehensible_source_error.rb +2 -2
- data/lib/reek/errors/syntax_error.rb +41 -0
- data/lib/reek/examiner.rb +9 -19
- data/lib/reek/rake/task.rb +3 -3
- data/lib/reek/report/base_report.rb +8 -12
- data/lib/reek/report/code_climate/code_climate_configuration.yml +6 -10
- data/lib/reek/report/documentation_link_warning_formatter.rb +17 -0
- data/lib/reek/report/heading_formatter.rb +54 -0
- data/lib/reek/report/json_report.rb +1 -1
- data/lib/reek/report/location_formatter.rb +40 -0
- data/lib/reek/report/progress_formatter.rb +79 -0
- data/lib/reek/report/simple_warning_formatter.rb +34 -0
- data/lib/reek/report/text_report.rb +1 -2
- data/lib/reek/report/xml_report.rb +3 -3
- data/lib/reek/report/yaml_report.rb +1 -1
- data/lib/reek/report.rb +15 -10
- data/lib/reek/smell_configuration.rb +2 -2
- data/lib/reek/smell_detectors/attribute.rb +0 -1
- data/lib/reek/smell_detectors/base_detector.rb +8 -11
- data/lib/reek/smell_detectors/boolean_parameter.rb +0 -1
- data/lib/reek/smell_detectors/class_variable.rb +0 -1
- data/lib/reek/smell_detectors/control_parameter.rb +17 -32
- data/lib/reek/smell_detectors/data_clump.rb +3 -4
- data/lib/reek/smell_detectors/duplicate_method_call.rb +5 -6
- data/lib/reek/smell_detectors/feature_envy.rb +1 -1
- data/lib/reek/smell_detectors/instance_variable_assumption.rb +0 -1
- data/lib/reek/smell_detectors/irresponsible_module.rb +0 -1
- data/lib/reek/smell_detectors/long_parameter_list.rb +1 -2
- data/lib/reek/smell_detectors/long_yield_list.rb +2 -3
- data/lib/reek/smell_detectors/manual_dispatch.rb +2 -2
- data/lib/reek/smell_detectors/{prima_donna_method.rb → missing_safe_method.rb} +6 -7
- data/lib/reek/smell_detectors/module_initialize.rb +0 -1
- data/lib/reek/smell_detectors/nested_iterators.rb +4 -5
- data/lib/reek/smell_detectors/nil_check.rb +0 -1
- data/lib/reek/smell_detectors/repeated_conditional.rb +3 -4
- data/lib/reek/smell_detectors/subclassed_from_core_class.rb +0 -1
- data/lib/reek/smell_detectors/too_many_constants.rb +1 -2
- data/lib/reek/smell_detectors/too_many_instance_variables.rb +1 -2
- data/lib/reek/smell_detectors/too_many_methods.rb +1 -2
- data/lib/reek/smell_detectors/too_many_statements.rb +1 -2
- data/lib/reek/smell_detectors/uncommunicative_method_name.rb +2 -3
- data/lib/reek/smell_detectors/uncommunicative_module_name.rb +2 -3
- data/lib/reek/smell_detectors/uncommunicative_parameter_name.rb +2 -3
- data/lib/reek/smell_detectors/uncommunicative_variable_name.rb +4 -5
- data/lib/reek/smell_detectors/unused_parameters.rb +0 -1
- data/lib/reek/smell_detectors/unused_private_method.rb +0 -1
- data/lib/reek/smell_detectors/utility_function.rb +1 -2
- data/lib/reek/smell_detectors.rb +1 -2
- data/lib/reek/smell_warning.rb +15 -8
- data/lib/reek/source/source_code.rb +40 -55
- data/lib/reek/source/source_locator.rb +7 -7
- data/lib/reek/spec/should_reek.rb +2 -2
- data/lib/reek/spec/should_reek_of.rb +9 -16
- data/lib/reek/spec/should_reek_only_of.rb +4 -4
- data/lib/reek/spec.rb +6 -6
- data/lib/reek/tree_dresser.rb +5 -5
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +4 -4
- data/samples/checkstyle.xml +1 -1
- data/samples/configuration/accepts_rejects_and_excludes_for_detectors.reek.yml +29 -0
- data/samples/configuration/accepts_rejects_and_excludes_for_directory_directives.reek.yml +30 -0
- data/samples/configuration/full_configuration.reek +8 -4
- data/samples/configuration/full_mask.reek +5 -4
- data/samples/configuration/partial_mask.reek +3 -2
- data/samples/configuration/regular_configuration/.reek.yml +4 -0
- data/samples/paths.rb +5 -4
- data/samples/source_with_hidden_directories/.hidden/hidden.rb +1 -0
- data/samples/source_with_hidden_directories/not_hidden.rb +1 -0
- data/spec/reek/ast/node_spec.rb +5 -5
- data/spec/reek/cli/application_spec.rb +18 -4
- data/spec/reek/cli/command/todo_list_command_spec.rb +4 -2
- data/spec/reek/cli/silencer_spec.rb +28 -0
- data/spec/reek/code_comment_spec.rb +0 -7
- data/spec/reek/configuration/app_configuration_spec.rb +44 -31
- data/spec/reek/configuration/configuration_file_finder_spec.rb +141 -49
- data/spec/reek/configuration/default_directive_spec.rb +1 -1
- data/spec/reek/configuration/directory_directives_spec.rb +3 -4
- data/spec/reek/configuration/excluded_paths_spec.rb +5 -5
- data/spec/reek/configuration/rake_task_converter_spec.rb +33 -0
- data/spec/reek/configuration/schema_validator_spec.rb +165 -0
- data/spec/reek/context/code_context_spec.rb +1 -1
- data/spec/reek/documentation_link_spec.rb +20 -0
- data/spec/reek/examiner_spec.rb +28 -1
- data/spec/reek/report/json_report_spec.rb +13 -46
- data/spec/reek/report/{formatter/location_formatter_spec.rb → location_formatter_spec.rb} +5 -5
- data/spec/reek/report/{formatter/progress_formatter_spec.rb → progress_formatter_spec.rb} +4 -4
- data/spec/reek/report/text_report_spec.rb +4 -4
- data/spec/reek/report/xml_report_spec.rb +1 -1
- data/spec/reek/report/yaml_report_spec.rb +9 -38
- data/spec/reek/report_spec.rb +3 -3
- data/spec/reek/smell_detectors/feature_envy_spec.rb +47 -2
- data/spec/reek/smell_detectors/{prima_donna_method_spec.rb → missing_safe_method_spec.rb} +9 -9
- data/spec/reek/smell_detectors/too_many_constants_spec.rb +3 -3
- data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +1 -1
- data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +6 -6
- data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +6 -4
- data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +6 -4
- data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +6 -6
- data/spec/reek/smell_detectors/unused_private_method_spec.rb +1 -1
- data/spec/reek/smell_warning_spec.rb +4 -0
- data/spec/reek/source/source_code_spec.rb +16 -22
- data/spec/reek/source/source_locator_spec.rb +11 -11
- data/spec/reek/spec/should_reek_of_spec.rb +0 -4
- data/spec/reek/spec/should_reek_only_of_spec.rb +2 -2
- data/spec/reek/spec/should_reek_spec.rb +1 -1
- data/spec/reek/tree_dresser_spec.rb +2 -6
- data/spec/spec_helper.rb +3 -5
- data/tasks/configuration.rake +8 -5
- metadata +64 -36
- data/.codeclimate.yml +0 -21
- data/defaults.reek +0 -131
- data/features/configuration_files/warn_about_multiple_configuration_files.feature +0 -44
- data/lib/reek/report/formatter/heading_formatter.rb +0 -52
- data/lib/reek/report/formatter/location_formatter.rb +0 -42
- data/lib/reek/report/formatter/progress_formatter.rb +0 -81
- data/lib/reek/report/formatter/simple_warning_formatter.rb +0 -35
- data/lib/reek/report/formatter/wiki_link_warning_formatter.rb +0 -36
- data/lib/reek/report/formatter.rb +0 -33
- data/lib/reek/smell_detectors/syntax.rb +0 -37
- data/samples/configuration/non_public_modifiers_mask.reek +0 -3
- data/samples/smelly_with_inline_mask.rb +0 -8
- data/samples/smelly_with_modifiers.rb +0 -12
- data/samples/source_with_hidden_directories/.hidden/uncommunicative_method_name.rb +0 -5
- data/samples/source_with_non_ruby_files/uncommunicative_parameter_name.rb +0 -6
- data/spec/reek/smell_detectors/syntax_spec.rb +0 -17
- /data/{samples/configuration/more_than_one_configuration_file/regular.reek → .reek.yml} +0 -0
- /data/samples/{clean.rb → clean_source/clean.rb} +0 -0
- /data/samples/{exceptions.reek → configuration/home/home.reek.yml} +0 -0
- /data/samples/configuration/{more_than_one_configuration_file/todo.reek → regular_configuration/empty_sub_directory/.gitignore} +0 -0
- /data/samples/{configuration/single_configuration_file/.reek → no_config_file/.keep} +0 -0
- /data/samples/{inline.rb → smelly_source/inline.rb} +0 -0
- /data/samples/{optparse.rb → smelly_source/optparse.rb} +0 -0
- /data/samples/{redcloth.rb → smelly_source/redcloth.rb} +0 -0
- /data/samples/{smelly.rb → smelly_source/smelly.rb} +0 -0
- /data/samples/{source_with_hidden_directories/uncommunicative_parameter_name.rb → source_with_non_ruby_files/ruby.rb} +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Feature: Validate schema
|
|
2
|
+
In order to ensure that I am using the right configuration
|
|
3
|
+
As a user
|
|
4
|
+
I want to be notified when I am using a configuration that violates our schema
|
|
5
|
+
|
|
6
|
+
Scenario: Our generated default configuration
|
|
7
|
+
Given our default configuration file
|
|
8
|
+
And the clean file 'clean.rb'
|
|
9
|
+
When I run reek -c defaults.reek clean.rb
|
|
10
|
+
Then it succeeds
|
|
11
|
+
And it reports nothing
|
|
12
|
+
|
|
13
|
+
Scenario: Detectors, directories and exclude paths all mixed
|
|
14
|
+
Given a file named "config.reek" with:
|
|
15
|
+
"""
|
|
16
|
+
---
|
|
17
|
+
detectors:
|
|
18
|
+
IrresponsibleModule:
|
|
19
|
+
enabled: false
|
|
20
|
+
NestedIterators:
|
|
21
|
+
exclude:
|
|
22
|
+
- "MyWorker#self.class_method"
|
|
23
|
+
- "AnotherWorker#instance_method"
|
|
24
|
+
DataClump:
|
|
25
|
+
max_copies: 3
|
|
26
|
+
min_clump_size: 3
|
|
27
|
+
|
|
28
|
+
directories:
|
|
29
|
+
"web_app/app/controllers":
|
|
30
|
+
NestedIterators:
|
|
31
|
+
enabled: false
|
|
32
|
+
"web_app/app/helpers":
|
|
33
|
+
UtilityFunction:
|
|
34
|
+
enabled: false
|
|
35
|
+
|
|
36
|
+
exclude_paths:
|
|
37
|
+
- lib/legacy
|
|
38
|
+
- lib/rake/legacy_tasks
|
|
39
|
+
"""
|
|
40
|
+
And the clean file 'clean.rb'
|
|
41
|
+
When I run reek -c config.reek clean.rb
|
|
42
|
+
Then it succeeds
|
|
43
|
+
And it reports nothing
|
|
44
|
+
|
|
45
|
+
Scenario: Invalid detector name
|
|
46
|
+
Given a file named "config.reek" with:
|
|
47
|
+
"""
|
|
48
|
+
---
|
|
49
|
+
detectors:
|
|
50
|
+
DoesNotExist:
|
|
51
|
+
enabled: true
|
|
52
|
+
"""
|
|
53
|
+
And the clean file 'clean.rb'
|
|
54
|
+
When I run reek -c config.reek clean.rb
|
|
55
|
+
Then the exit status indicates an error
|
|
56
|
+
And stderr reports:
|
|
57
|
+
"""
|
|
58
|
+
Error: We found some problems with your configuration file: [/detectors/DoesNotExist] key 'DoesNotExist:' is undefined.
|
|
59
|
+
"""
|
|
@@ -7,12 +7,13 @@ Feature: Unused Private Method detector
|
|
|
7
7
|
Given a file named "config.reek" with:
|
|
8
8
|
"""
|
|
9
9
|
---
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
detectors:
|
|
11
|
+
IrresponsibleModule:
|
|
12
|
+
enabled: false
|
|
13
|
+
UnusedPrivateMethod:
|
|
14
|
+
enabled: true
|
|
15
|
+
exclude:
|
|
16
|
+
- Outer::Awesome#foobar
|
|
16
17
|
"""
|
|
17
18
|
And a file named "sample.rb" with:
|
|
18
19
|
"""
|
|
@@ -27,23 +28,24 @@ Feature: Unused Private Method detector
|
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
"""
|
|
30
|
-
When I run
|
|
31
|
+
When I run reek -c config.reek sample.rb
|
|
31
32
|
Then it reports:
|
|
32
33
|
"""
|
|
33
34
|
sample.rb -- 1 warning:
|
|
34
|
-
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar'
|
|
35
|
+
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar'
|
|
35
36
|
"""
|
|
36
37
|
|
|
37
38
|
Scenario: Use regexes for excluding contexts
|
|
38
39
|
Given a file named "config.reek" with:
|
|
39
40
|
"""
|
|
40
41
|
---
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
detectors:
|
|
43
|
+
IrresponsibleModule:
|
|
44
|
+
enabled: false
|
|
45
|
+
UnusedPrivateMethod:
|
|
46
|
+
enabled: true
|
|
47
|
+
exclude:
|
|
48
|
+
- wesome#foo
|
|
47
49
|
"""
|
|
48
50
|
And a file named "sample.rb" with:
|
|
49
51
|
"""
|
|
@@ -58,9 +60,9 @@ Feature: Unused Private Method detector
|
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
"""
|
|
61
|
-
When I run
|
|
63
|
+
When I run reek -c config.reek sample.rb
|
|
62
64
|
Then it reports:
|
|
63
65
|
"""
|
|
64
66
|
sample.rb -- 1 warning:
|
|
65
|
-
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar'
|
|
67
|
+
[4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar'
|
|
66
68
|
"""
|
|
@@ -3,7 +3,7 @@ Feature: Offer different ways how to load configuration
|
|
|
3
3
|
Reek can be configured in two ways:
|
|
4
4
|
- Using the cli "-c" switch to pass a configuration file on the command line.
|
|
5
5
|
- Having a Reek configuration file that is automatically found. Reek will
|
|
6
|
-
look for a file ending in .reek in the following places, in order:
|
|
6
|
+
look for a file ending in .reek.yml in the following places, in order:
|
|
7
7
|
- The current working directory
|
|
8
8
|
- The working directory's ancestor directories, traversing all the way up
|
|
9
9
|
to the root.
|
|
@@ -17,8 +17,8 @@ Feature: Offer different ways how to load configuration
|
|
|
17
17
|
And it reports:
|
|
18
18
|
"""
|
|
19
19
|
smelly.rb -- 2 warnings:
|
|
20
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
21
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
20
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
21
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
Scenario: Configuration via CLI
|
|
@@ -30,19 +30,62 @@ Feature: Offer different ways how to load configuration
|
|
|
30
30
|
|
|
31
31
|
Scenario: Configuration file in working directory
|
|
32
32
|
Given the smelly file 'smelly.rb'
|
|
33
|
-
And a
|
|
33
|
+
And a file named ".reek.yml" with:
|
|
34
|
+
"""
|
|
35
|
+
---
|
|
36
|
+
detectors:
|
|
37
|
+
UncommunicativeMethodName:
|
|
38
|
+
enabled: false
|
|
39
|
+
UncommunicativeVariableName:
|
|
40
|
+
enabled: false
|
|
41
|
+
"""
|
|
34
42
|
When I run reek smelly.rb
|
|
35
43
|
Then it reports no errors
|
|
36
44
|
And it succeeds
|
|
37
45
|
|
|
38
|
-
Scenario:
|
|
39
|
-
Given the smelly file 'smelly.rb'
|
|
40
|
-
And a
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
Scenario: Do not use the default config file when we explicitly specify one configuration file
|
|
47
|
+
Given the smelly file 'smelly.rb'
|
|
48
|
+
And a file named "config.reek" with:
|
|
49
|
+
"""
|
|
50
|
+
---
|
|
51
|
+
detectors:
|
|
52
|
+
UncommunicativeMethodName:
|
|
53
|
+
enabled: false
|
|
54
|
+
"""
|
|
55
|
+
And a file named ".reek.yml" with:
|
|
56
|
+
"""
|
|
57
|
+
---
|
|
58
|
+
UncommunicativeVariableName:
|
|
59
|
+
enabled: false
|
|
60
|
+
"""
|
|
61
|
+
When I run reek -c config.reek smelly.rb
|
|
62
|
+
Then the exit status indicates smells
|
|
63
|
+
And it reports:
|
|
64
|
+
"""
|
|
65
|
+
smelly.rb -- 1 warning:
|
|
66
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
Scenario: Prefer the default config file over other configuration files
|
|
70
|
+
Given the smelly file 'smelly.rb'
|
|
71
|
+
And a file named "config.reek" with:
|
|
72
|
+
"""
|
|
73
|
+
---
|
|
74
|
+
detectors:
|
|
75
|
+
UncommunicativeMethodName:
|
|
76
|
+
enabled: false
|
|
77
|
+
"""
|
|
78
|
+
And a file named ".reek.yml" with:
|
|
79
|
+
"""
|
|
80
|
+
---
|
|
81
|
+
detectors:
|
|
82
|
+
UncommunicativeVariableName:
|
|
83
|
+
enabled: false
|
|
84
|
+
"""
|
|
85
|
+
When I run reek smelly.rb
|
|
43
86
|
Then the exit status indicates smells
|
|
44
87
|
And it reports:
|
|
45
88
|
"""
|
|
46
89
|
smelly.rb -- 1 warning:
|
|
47
|
-
[
|
|
90
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
48
91
|
"""
|
|
@@ -33,8 +33,8 @@ Feature: Erroneous source comments are handled properly
|
|
|
33
33
|
And it reports:
|
|
34
34
|
"""
|
|
35
35
|
smelly.rb -- 2 warnings:
|
|
36
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
37
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
36
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
37
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
38
38
|
2 total warnings
|
|
39
39
|
"""
|
|
40
40
|
|
|
@@ -48,7 +48,7 @@ Feature: Well formed source comments are handled properly
|
|
|
48
48
|
And it reports:
|
|
49
49
|
"""
|
|
50
50
|
enable_detector_explicitly.rb -- 1 warning:
|
|
51
|
-
[3]:TooManyInstanceVariables: Alfa has at least 5 instance variables
|
|
51
|
+
[3]:TooManyInstanceVariables: Alfa has at least 5 instance variables
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
Scenario: Configure smell detector with the basic exclude option as string
|
|
@@ -112,5 +112,5 @@ Feature: Well formed source comments are handled properly
|
|
|
112
112
|
And it reports:
|
|
113
113
|
"""
|
|
114
114
|
configure_detector_specific_option.rb -- 1 warning:
|
|
115
|
-
[3]:TooManyInstanceVariables: Alfa has at least 3 instance variables
|
|
115
|
+
[3]:TooManyInstanceVariables: Alfa has at least 3 instance variables
|
|
116
116
|
"""
|
data/features/locales.feature
CHANGED
|
@@ -9,7 +9,7 @@ Feature: Handling different locales
|
|
|
9
9
|
"""
|
|
10
10
|
puts 'こんにちは世界'
|
|
11
11
|
"""
|
|
12
|
-
When I run
|
|
12
|
+
When I run reek -V konnichiwa.rb
|
|
13
13
|
Then it succeeds
|
|
14
14
|
And it reports no errors
|
|
15
15
|
And it reports:
|
|
@@ -23,7 +23,7 @@ Feature: Handling different locales
|
|
|
23
23
|
"""
|
|
24
24
|
puts 'こんにちは世界'
|
|
25
25
|
"""
|
|
26
|
-
When I run
|
|
26
|
+
When I run reek -V konnichiwa.rb
|
|
27
27
|
Then it succeeds
|
|
28
28
|
And it reports no errors
|
|
29
29
|
And it reports:
|
|
@@ -10,7 +10,7 @@ Feature: Reek can be driven through its Task
|
|
|
10
10
|
|
|
11
11
|
Reek::Rake::Task.new do |t|
|
|
12
12
|
t.source_files = 'smelly.rb'
|
|
13
|
-
t.reek_opts = '--no-color'
|
|
13
|
+
t.reek_opts = '--no-color --no-documentation'
|
|
14
14
|
end
|
|
15
15
|
"""
|
|
16
16
|
When I run `rake reek`
|
|
@@ -18,8 +18,8 @@ Feature: Reek can be driven through its Task
|
|
|
18
18
|
And it reports:
|
|
19
19
|
"""
|
|
20
20
|
smelly.rb -- 2 warnings:
|
|
21
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
22
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
21
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
22
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
Scenario: source_files using a FileList instead of a String
|
|
@@ -30,7 +30,7 @@ Feature: Reek can be driven through its Task
|
|
|
30
30
|
|
|
31
31
|
Reek::Rake::Task.new do |t|
|
|
32
32
|
t.source_files = FileList['smelly.*']
|
|
33
|
-
t.reek_opts = '--no-color'
|
|
33
|
+
t.reek_opts = '--no-color --no-documentation'
|
|
34
34
|
end
|
|
35
35
|
"""
|
|
36
36
|
When I run `rake reek`
|
|
@@ -38,8 +38,8 @@ Feature: Reek can be driven through its Task
|
|
|
38
38
|
And it reports:
|
|
39
39
|
"""
|
|
40
40
|
smelly.rb -- 2 warnings:
|
|
41
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
42
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
41
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
42
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
45
|
Scenario: name changes the task name
|
|
@@ -50,7 +50,7 @@ Feature: Reek can be driven through its Task
|
|
|
50
50
|
|
|
51
51
|
Reek::Rake::Task.new('silky') do |t|
|
|
52
52
|
t.source_files = 'smelly.rb'
|
|
53
|
-
t.reek_opts = '--no-color'
|
|
53
|
+
t.reek_opts = '--no-color --no-documentation'
|
|
54
54
|
end
|
|
55
55
|
"""
|
|
56
56
|
When I run `rake silky`
|
|
@@ -58,8 +58,8 @@ Feature: Reek can be driven through its Task
|
|
|
58
58
|
And it reports:
|
|
59
59
|
"""
|
|
60
60
|
smelly.rb -- 2 warnings:
|
|
61
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
62
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
61
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
62
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
63
63
|
"""
|
|
64
64
|
|
|
65
65
|
Scenario: verbose prints the reek command
|
|
@@ -86,7 +86,7 @@ Feature: Reek can be driven through its Task
|
|
|
86
86
|
Reek::Rake::Task.new do |t|
|
|
87
87
|
t.fail_on_error = false
|
|
88
88
|
t.source_files = 'smelly.rb'
|
|
89
|
-
t.reek_opts = '--no-color'
|
|
89
|
+
t.reek_opts = '--no-color --no-documentation'
|
|
90
90
|
end
|
|
91
91
|
"""
|
|
92
92
|
When I run `rake reek`
|
|
@@ -95,8 +95,8 @@ Feature: Reek can be driven through its Task
|
|
|
95
95
|
And it reports:
|
|
96
96
|
"""
|
|
97
97
|
smelly.rb -- 2 warnings:
|
|
98
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
99
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
98
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
99
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
100
100
|
"""
|
|
101
101
|
|
|
102
102
|
Scenario: can be configured with config_file
|
|
@@ -124,7 +124,7 @@ Feature: Reek can be driven through its Task
|
|
|
124
124
|
|
|
125
125
|
Reek::Rake::Task.new do |t|
|
|
126
126
|
t.source_files = 'clean.rb'
|
|
127
|
-
t.reek_opts = '--no-color'
|
|
127
|
+
t.reek_opts = '--no-color --no-documentation'
|
|
128
128
|
end
|
|
129
129
|
"""
|
|
130
130
|
When I set the environment variable "REEK_SRC" to "smelly.rb"
|
|
@@ -133,6 +133,6 @@ Feature: Reek can be driven through its Task
|
|
|
133
133
|
And it reports:
|
|
134
134
|
"""
|
|
135
135
|
smelly.rb -- 2 warnings:
|
|
136
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
137
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
136
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
137
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
138
138
|
"""
|
|
@@ -24,7 +24,7 @@ Feature: Report smells using simple JSON layout
|
|
|
24
24
|
"context": "Smelly#x",
|
|
25
25
|
"lines": [ 4 ],
|
|
26
26
|
"message": "has the name 'x'",
|
|
27
|
-
"
|
|
27
|
+
"documentation_link": "https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Method-Name.md",
|
|
28
28
|
"name": "x"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
@@ -33,7 +33,7 @@ Feature: Report smells using simple JSON layout
|
|
|
33
33
|
"context": "Smelly#x",
|
|
34
34
|
"lines": [ 5 ],
|
|
35
35
|
"message": "has the variable name 'y'",
|
|
36
|
-
"
|
|
36
|
+
"documentation_link": "https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Variable-Name.md",
|
|
37
37
|
"name": "y"
|
|
38
38
|
}
|
|
39
39
|
]
|
|
@@ -53,7 +53,7 @@ Feature: Report smells using simple JSON layout
|
|
|
53
53
|
1
|
|
54
54
|
],
|
|
55
55
|
"message": "has no descriptive comment",
|
|
56
|
-
"
|
|
56
|
+
"documentation_link": "https://github.com/troessner/reek/blob/v5.0.2/docs/Irresponsible-Module.md"
|
|
57
57
|
}
|
|
58
58
|
]
|
|
59
59
|
"""
|
|
@@ -10,11 +10,11 @@ Feature: Correctly formatted reports
|
|
|
10
10
|
And it reports:
|
|
11
11
|
"""
|
|
12
12
|
smelly/dirty_one.rb -- 2 warnings:
|
|
13
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
14
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
13
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
14
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
15
15
|
smelly/dirty_two.rb -- 2 warnings:
|
|
16
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
17
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
16
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
17
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
18
18
|
4 total warnings
|
|
19
19
|
"""
|
|
20
20
|
|
|
@@ -30,11 +30,11 @@ Feature: Correctly formatted reports
|
|
|
30
30
|
And it reports:
|
|
31
31
|
"""
|
|
32
32
|
smelly/dirty_one.rb -- 2 warnings:
|
|
33
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
34
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
33
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
34
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
35
35
|
smelly/dirty_two.rb -- 2 warnings:
|
|
36
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
37
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
36
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
37
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
38
38
|
4 total warnings
|
|
39
39
|
"""
|
|
40
40
|
|
|
@@ -51,11 +51,11 @@ Feature: Correctly formatted reports
|
|
|
51
51
|
And it reports:
|
|
52
52
|
"""
|
|
53
53
|
smelly/dirty_two.rb -- 2 warnings:
|
|
54
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
55
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
54
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
55
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
56
56
|
smelly/dirty_one.rb -- 2 warnings:
|
|
57
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
58
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
57
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
58
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
59
59
|
4 total warnings
|
|
60
60
|
"""
|
|
61
61
|
|
|
@@ -110,8 +110,8 @@ Feature: Correctly formatted reports
|
|
|
110
110
|
And it reports:
|
|
111
111
|
"""
|
|
112
112
|
smelly.rb -- 2 warnings:
|
|
113
|
-
UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
114
|
-
UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
113
|
+
UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
114
|
+
UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
115
115
|
"""
|
|
116
116
|
|
|
117
117
|
Examples:
|
|
@@ -127,8 +127,8 @@ Feature: Correctly formatted reports
|
|
|
127
127
|
And it reports:
|
|
128
128
|
"""
|
|
129
129
|
smelly.rb -- 2 warnings:
|
|
130
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
131
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
130
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
131
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
132
132
|
"""
|
|
133
133
|
|
|
134
134
|
Examples:
|
|
@@ -144,8 +144,8 @@ Feature: Correctly formatted reports
|
|
|
144
144
|
And it reports:
|
|
145
145
|
"""
|
|
146
146
|
smelly.rb -- 2 warnings:
|
|
147
|
-
smelly.rb:4: UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
148
|
-
smelly.rb:5: UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
147
|
+
smelly.rb:4: UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
148
|
+
smelly.rb:5: UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
149
149
|
"""
|
|
150
150
|
|
|
151
151
|
Examples:
|
|
@@ -162,11 +162,11 @@ Feature: Correctly formatted reports
|
|
|
162
162
|
And it reports:
|
|
163
163
|
"""
|
|
164
164
|
smelly/dirty_one.rb -- 2 warnings:
|
|
165
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
166
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
165
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
166
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
167
167
|
smelly/dirty_two.rb -- 2 warnings:
|
|
168
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
169
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
168
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x'
|
|
169
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
170
170
|
4 total warnings
|
|
171
171
|
"""
|
|
172
172
|
|
|
@@ -175,25 +175,25 @@ Feature: Correctly formatted reports
|
|
|
175
175
|
| smelly/ |
|
|
176
176
|
| smelly |
|
|
177
177
|
|
|
178
|
-
Scenario Outline: -U or --
|
|
178
|
+
Scenario Outline: -U or --documentation adds helpful links to smell warnings
|
|
179
179
|
Given the smelly file 'smelly.rb'
|
|
180
180
|
When I run reek <option> smelly.rb
|
|
181
181
|
Then the exit status indicates smells
|
|
182
182
|
And it reports:
|
|
183
183
|
"""
|
|
184
184
|
smelly.rb -- 2 warnings:
|
|
185
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/
|
|
186
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/
|
|
185
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Method-Name.md]
|
|
186
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Variable-Name.md]
|
|
187
187
|
"""
|
|
188
188
|
|
|
189
189
|
Examples:
|
|
190
|
-
| option
|
|
191
|
-
| -U
|
|
192
|
-
| --
|
|
190
|
+
| option |
|
|
191
|
+
| -U |
|
|
192
|
+
| --documentation |
|
|
193
193
|
|
|
194
|
-
Scenario: --no-
|
|
194
|
+
Scenario: --no-documentation drops links from smell warnings
|
|
195
195
|
Given the smelly file 'smelly.rb'
|
|
196
|
-
When I run reek --no-
|
|
196
|
+
When I run reek --no-documentation smelly.rb
|
|
197
197
|
Then the exit status indicates smells
|
|
198
198
|
And it reports:
|
|
199
199
|
"""
|
|
@@ -202,18 +202,18 @@ Feature: Correctly formatted reports
|
|
|
202
202
|
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y'
|
|
203
203
|
"""
|
|
204
204
|
|
|
205
|
-
Scenario Outline: --
|
|
205
|
+
Scenario Outline: --documentation is independent of --line-numbers
|
|
206
206
|
Given the smelly file 'smelly.rb'
|
|
207
207
|
When I run reek <option> smelly.rb
|
|
208
208
|
Then the exit status indicates smells
|
|
209
209
|
And it reports:
|
|
210
210
|
"""
|
|
211
211
|
smelly.rb -- 2 warnings:
|
|
212
|
-
UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/
|
|
213
|
-
UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/
|
|
212
|
+
UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Method-Name.md]
|
|
213
|
+
UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Variable-Name.md]
|
|
214
214
|
"""
|
|
215
215
|
|
|
216
216
|
Examples:
|
|
217
217
|
| option |
|
|
218
218
|
| --no-line-numbers -U |
|
|
219
|
-
| --no-line-numbers --
|
|
219
|
+
| --no-line-numbers --documentation |
|
|
@@ -25,7 +25,7 @@ Feature: Report smells using simple YAML layout
|
|
|
25
25
|
smell_type: UncommunicativeMethodName
|
|
26
26
|
source: smelly.rb
|
|
27
27
|
name: x
|
|
28
|
-
|
|
28
|
+
documentation_link: https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Method-Name.md
|
|
29
29
|
- context: Smelly#x
|
|
30
30
|
lines:
|
|
31
31
|
- 5
|
|
@@ -33,7 +33,7 @@ Feature: Report smells using simple YAML layout
|
|
|
33
33
|
smell_type: UncommunicativeVariableName
|
|
34
34
|
source: smelly.rb
|
|
35
35
|
name: y
|
|
36
|
-
|
|
36
|
+
documentation_link: https://github.com/troessner/reek/blob/v5.0.2/docs/Uncommunicative-Variable-Name.md
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
39
|
Scenario: Indicate smells and print them as yaml when using STDIN
|
|
@@ -48,5 +48,5 @@ Feature: Report smells using simple YAML layout
|
|
|
48
48
|
lines:
|
|
49
49
|
- 1
|
|
50
50
|
message: has no descriptive comment
|
|
51
|
-
|
|
51
|
+
documentation_link: https://github.com/troessner/reek/blob/v5.0.2/docs/Irresponsible-Module.md
|
|
52
52
|
"""
|
|
@@ -24,7 +24,15 @@ Feature: Use reek_of matcher
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
Scenario: Masking smells with a configuration file
|
|
27
|
-
Given a
|
|
27
|
+
Given a file named ".reek.yml" with:
|
|
28
|
+
"""
|
|
29
|
+
---
|
|
30
|
+
detectors:
|
|
31
|
+
UncommunicativeMethodName:
|
|
32
|
+
enabled: false
|
|
33
|
+
UncommunicativeVariableName:
|
|
34
|
+
enabled: false
|
|
35
|
+
"""
|
|
28
36
|
When I run `rspec reek_spec.rb`
|
|
29
37
|
Then stdout should contain:
|
|
30
38
|
"""
|