reek 6.0.2 → 6.1.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/.github/dependabot.yml +13 -0
- data/.github/workflows/ruby.yml +57 -0
- data/.rubocop.yml +6 -4
- data/.rubocop_todo.yml +6 -4
- data/CHANGELOG.md +42 -0
- data/CONTRIBUTING.md +4 -1
- data/Dockerfile +1 -1
- data/Gemfile +7 -7
- data/README.md +2 -2
- data/bin/code_climate_reek +2 -3
- data/lib/reek/ast/ast_node_class_map.rb +1 -1
- data/lib/reek/ast/node.rb +1 -1
- data/lib/reek/ast/sexp_extensions/arguments.rb +20 -0
- data/lib/reek/ast/sexp_extensions/case.rb +1 -1
- data/lib/reek/ast/sexp_extensions/if.rb +1 -1
- data/lib/reek/ast/sexp_extensions/send.rb +1 -1
- data/lib/reek/cli/command/todo_list_command.rb +2 -2
- data/lib/reek/cli/options.rb +6 -6
- data/lib/reek/code_comment.rb +22 -17
- data/lib/reek/configuration/configuration_file_finder.rb +2 -1
- data/lib/reek/configuration/excluded_paths.rb +2 -1
- data/lib/reek/context/code_context.rb +1 -1
- data/lib/reek/context/module_context.rb +4 -0
- data/lib/reek/context/refinement_context.rb +16 -0
- data/lib/reek/context/send_context.rb +6 -0
- data/lib/reek/context_builder.rb +17 -3
- data/lib/reek/rake/task.rb +5 -5
- data/lib/reek/report/code_climate/code_climate_configuration.yml +3 -3
- data/lib/reek/report/code_climate/code_climate_formatter.rb +1 -3
- data/lib/reek/smell_detectors/base_detector.rb +1 -1
- data/lib/reek/smell_detectors/class_variable.rb +2 -2
- data/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb +6 -6
- data/lib/reek/smell_detectors/duplicate_method_call.rb +5 -5
- data/lib/reek/smell_detectors/unused_private_method.rb +1 -0
- data/lib/reek/smell_warning.rb +1 -1
- data/lib/reek/source/source_locator.rb +1 -3
- data/lib/reek/spec/should_reek_of.rb +11 -9
- data/lib/reek/spec.rb +1 -1
- data/lib/reek/version.rb +2 -2
- data/reek.gemspec +28 -25
- metadata +13 -240
- data/.travis.yml +0 -40
- data/docs/API.md +0 -174
- data/docs/Attribute.md +0 -39
- data/docs/Basic-Smell-Options.md +0 -85
- data/docs/Boolean-Parameter.md +0 -54
- data/docs/Class-Variable.md +0 -40
- data/docs/Code-Smells.md +0 -39
- data/docs/Command-Line-Options.md +0 -119
- data/docs/Control-Couple.md +0 -26
- data/docs/Control-Parameter.md +0 -32
- data/docs/Data-Clump.md +0 -46
- data/docs/Duplicate-Method-Call.md +0 -264
- data/docs/Feature-Envy.md +0 -93
- data/docs/How-To-Write-New-Detectors.md +0 -132
- data/docs/How-reek-works-internally.md +0 -114
- data/docs/Instance-Variable-Assumption.md +0 -163
- data/docs/Irresponsible-Module.md +0 -47
- data/docs/Large-Class.md +0 -16
- data/docs/Long-Parameter-List.md +0 -39
- data/docs/Long-Yield-List.md +0 -37
- data/docs/Manual-Dispatch.md +0 -30
- data/docs/Missing-Safe-Method.md +0 -92
- data/docs/Module-Initialize.md +0 -62
- data/docs/Nested-Iterators.md +0 -59
- data/docs/Nil-Check.md +0 -47
- data/docs/RSpec-matchers.md +0 -129
- data/docs/Rake-Task.md +0 -66
- data/docs/Reek-4-to-Reek-5-migration.md +0 -188
- data/docs/Reek-Driven-Development.md +0 -46
- data/docs/Repeated-Conditional.md +0 -47
- data/docs/Simulated-Polymorphism.md +0 -16
- data/docs/Smell-Suppression.md +0 -96
- data/docs/Style-Guide.md +0 -19
- data/docs/Subclassed-From-Core-Class.md +0 -79
- data/docs/Too-Many-Constants.md +0 -37
- data/docs/Too-Many-Instance-Variables.md +0 -43
- data/docs/Too-Many-Methods.md +0 -56
- data/docs/Too-Many-Statements.md +0 -54
- data/docs/Uncommunicative-Method-Name.md +0 -94
- data/docs/Uncommunicative-Module-Name.md +0 -92
- data/docs/Uncommunicative-Name.md +0 -18
- data/docs/Uncommunicative-Parameter-Name.md +0 -90
- data/docs/Uncommunicative-Variable-Name.md +0 -96
- data/docs/Unused-Parameters.md +0 -28
- data/docs/Unused-Private-Method.md +0 -101
- data/docs/Utility-Function.md +0 -56
- data/docs/Versioning-Policy.md +0 -7
- data/docs/YAML-Reports.md +0 -93
- data/docs/defaults.reek.yml +0 -129
- data/docs/templates/default/docstring/html/public_api_marker.erb +0 -3
- data/docs/templates/default/docstring/setup.rb +0 -37
- data/docs/templates/default/fulldoc/html/css/common.css +0 -1
- data/docs/yard_plugin.rb +0 -17
- data/features/command_line_interface/basic_usage.feature +0 -15
- data/features/command_line_interface/options.feature +0 -123
- data/features/command_line_interface/show_progress.feature +0 -33
- data/features/command_line_interface/smell_selection.feature +0 -15
- data/features/command_line_interface/smells_count.feature +0 -38
- data/features/command_line_interface/stdin.feature +0 -65
- data/features/configuration_files/accept_setting.feature +0 -87
- data/features/configuration_files/directory_specific_directives.feature +0 -274
- data/features/configuration_files/exclude_directives.feature +0 -35
- data/features/configuration_files/exclude_paths_directives.feature +0 -42
- data/features/configuration_files/masking_smells.feature +0 -94
- data/features/configuration_files/mix_accept_reject_setting.feature +0 -84
- data/features/configuration_files/reject_setting.feature +0 -89
- data/features/configuration_files/schema_validation.feature +0 -59
- data/features/configuration_files/show_configuration_file.feature +0 -44
- data/features/configuration_files/unused_private_method.feature +0 -68
- data/features/configuration_loading.feature +0 -91
- data/features/configuration_via_source_comments/erroneous_source_comments.feature +0 -68
- data/features/configuration_via_source_comments/well_formed_source_comments.feature +0 -116
- data/features/locales.feature +0 -32
- data/features/programmatic_access.feature +0 -41
- data/features/rake_task/rake_task.feature +0 -138
- data/features/reports/codeclimate.feature +0 -59
- data/features/reports/json.feature +0 -59
- data/features/reports/reports.feature +0 -219
- data/features/reports/yaml.feature +0 -52
- data/features/rspec_matcher.feature +0 -41
- data/features/samples.feature +0 -305
- data/features/step_definitions/.rubocop.yml +0 -5
- data/features/step_definitions/reek_steps.rb +0 -102
- data/features/step_definitions/sample_file_steps.rb +0 -63
- data/features/support/env.rb +0 -33
- data/features/todo_list.feature +0 -108
- data/samples/checkstyle.xml +0 -7
- data/samples/clean_source/clean.rb +0 -6
- data/samples/configuration/accepts_rejects_and_excludes_for_detectors.reek.yml +0 -29
- data/samples/configuration/accepts_rejects_and_excludes_for_directory_directives.reek.yml +0 -30
- data/samples/configuration/corrupt.reek +0 -1
- data/samples/configuration/empty.reek +0 -0
- data/samples/configuration/full_configuration.reek +0 -13
- data/samples/configuration/full_mask.reek +0 -6
- data/samples/configuration/home/home.reek.yml +0 -4
- data/samples/configuration/partial_mask.reek +0 -4
- data/samples/configuration/regular_configuration/.reek.yml +0 -4
- data/samples/configuration/regular_configuration/empty_sub_directory/.gitignore +0 -0
- data/samples/configuration/with_excluded_paths.reek +0 -5
- data/samples/no_config_file/.keep +0 -0
- data/samples/paths.rb +0 -5
- data/samples/smelly_source/inline.rb +0 -704
- data/samples/smelly_source/optparse.rb +0 -1788
- data/samples/smelly_source/redcloth.rb +0 -1130
- data/samples/smelly_source/ruby.rb +0 -368
- data/samples/smelly_source/smelly.rb +0 -7
- data/samples/source_with_exclude_paths/ignore_me/uncommunicative_method_name.rb +0 -5
- data/samples/source_with_exclude_paths/nested/ignore_me_as_well/irresponsible_module.rb +0 -2
- data/samples/source_with_exclude_paths/nested/uncommunicative_parameter_name.rb +0 -6
- data/samples/source_with_exclude_paths/nested/uncommunicative_variable_name.rb +0 -6
- data/samples/source_with_hidden_directories/.hidden/hidden.rb +0 -1
- data/samples/source_with_hidden_directories/not_hidden.rb +0 -1
- data/samples/source_with_non_ruby_files/gibberish +0 -1
- data/samples/source_with_non_ruby_files/python_source.py +0 -1
- data/samples/source_with_non_ruby_files/ruby.rb +0 -6
- data/spec/performance/reek/smell_detectors/runtime_speed_spec.rb +0 -15
- data/spec/quality/documentation_spec.rb +0 -41
- data/spec/quality/reek_source_spec.rb +0 -11
- data/spec/reek/ast/node_spec.rb +0 -211
- data/spec/reek/ast/object_refs_spec.rb +0 -83
- data/spec/reek/ast/reference_collector_spec.rb +0 -47
- data/spec/reek/ast/sexp_extensions_spec.rb +0 -498
- data/spec/reek/cli/application_spec.rb +0 -168
- data/spec/reek/cli/command/report_command_spec.rb +0 -44
- data/spec/reek/cli/command/todo_list_command_spec.rb +0 -86
- data/spec/reek/cli/options_spec.rb +0 -51
- data/spec/reek/cli/silencer_spec.rb +0 -28
- data/spec/reek/code_comment_spec.rb +0 -184
- data/spec/reek/configuration/app_configuration_spec.rb +0 -195
- data/spec/reek/configuration/configuration_file_finder_spec.rb +0 -230
- data/spec/reek/configuration/default_directive_spec.rb +0 -13
- data/spec/reek/configuration/directory_directives_spec.rb +0 -122
- data/spec/reek/configuration/excluded_paths_spec.rb +0 -16
- data/spec/reek/configuration/rake_task_converter_spec.rb +0 -33
- data/spec/reek/configuration/schema_validator_spec.rb +0 -165
- data/spec/reek/context/code_context_spec.rb +0 -192
- data/spec/reek/context/ghost_context_spec.rb +0 -60
- data/spec/reek/context/method_context_spec.rb +0 -72
- data/spec/reek/context/module_context_spec.rb +0 -55
- data/spec/reek/context/root_context_spec.rb +0 -12
- data/spec/reek/context/statement_counter_spec.rb +0 -24
- data/spec/reek/context_builder_spec.rb +0 -457
- data/spec/reek/detector_repository_spec.rb +0 -22
- data/spec/reek/documentation_link_spec.rb +0 -20
- data/spec/reek/errors/base_error_spec.rb +0 -13
- data/spec/reek/examiner_spec.rb +0 -309
- data/spec/reek/logging_error_handler_spec.rb +0 -24
- data/spec/reek/rake/task_spec.rb +0 -56
- data/spec/reek/report/code_climate/code_climate_configuration_spec.rb +0 -22
- data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +0 -126
- data/spec/reek/report/code_climate/code_climate_formatter_spec.rb +0 -51
- data/spec/reek/report/code_climate/code_climate_report_spec.rb +0 -56
- data/spec/reek/report/html_report_spec.rb +0 -19
- data/spec/reek/report/json_report_spec.rb +0 -58
- data/spec/reek/report/location_formatter_spec.rb +0 -32
- data/spec/reek/report/progress_formatter_spec.rb +0 -68
- data/spec/reek/report/text_report_spec.rb +0 -89
- data/spec/reek/report/xml_report_spec.rb +0 -24
- data/spec/reek/report/yaml_report_spec.rb +0 -55
- data/spec/reek/report_spec.rb +0 -28
- data/spec/reek/smell_configuration_spec.rb +0 -56
- data/spec/reek/smell_detectors/attribute_spec.rb +0 -197
- data/spec/reek/smell_detectors/base_detector_spec.rb +0 -50
- data/spec/reek/smell_detectors/boolean_parameter_spec.rb +0 -93
- data/spec/reek/smell_detectors/class_variable_spec.rb +0 -106
- data/spec/reek/smell_detectors/control_parameter_spec.rb +0 -300
- data/spec/reek/smell_detectors/data_clump_spec.rb +0 -134
- data/spec/reek/smell_detectors/duplicate_method_call_spec.rb +0 -211
- data/spec/reek/smell_detectors/feature_envy_spec.rb +0 -295
- data/spec/reek/smell_detectors/instance_variable_assumption_spec.rb +0 -96
- data/spec/reek/smell_detectors/irresponsible_module_spec.rb +0 -226
- data/spec/reek/smell_detectors/long_parameter_list_spec.rb +0 -61
- data/spec/reek/smell_detectors/long_yield_list_spec.rb +0 -49
- data/spec/reek/smell_detectors/manual_dispatch_spec.rb +0 -75
- data/spec/reek/smell_detectors/missing_safe_method_spec.rb +0 -68
- data/spec/reek/smell_detectors/module_initialize_spec.rb +0 -77
- data/spec/reek/smell_detectors/nested_iterators_spec.rb +0 -333
- data/spec/reek/smell_detectors/nil_check_spec.rb +0 -100
- data/spec/reek/smell_detectors/repeated_conditional_spec.rb +0 -100
- data/spec/reek/smell_detectors/subclassed_from_core_class_spec.rb +0 -77
- data/spec/reek/smell_detectors/too_many_constants_spec.rb +0 -144
- data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +0 -132
- data/spec/reek/smell_detectors/too_many_methods_spec.rb +0 -54
- data/spec/reek/smell_detectors/too_many_statements_spec.rb +0 -90
- data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +0 -78
- data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +0 -78
- data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +0 -147
- data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +0 -201
- data/spec/reek/smell_detectors/unused_parameters_spec.rb +0 -114
- data/spec/reek/smell_detectors/unused_private_method_spec.rb +0 -205
- data/spec/reek/smell_detectors/utility_function_spec.rb +0 -293
- data/spec/reek/smell_warning_spec.rb +0 -137
- data/spec/reek/source/source_code_spec.rb +0 -79
- data/spec/reek/source/source_locator_spec.rb +0 -166
- data/spec/reek/spec/should_reek_of_spec.rb +0 -153
- data/spec/reek/spec/should_reek_only_of_spec.rb +0 -91
- data/spec/reek/spec/should_reek_spec.rb +0 -52
- data/spec/reek/spec/smell_matcher_spec.rb +0 -87
- data/spec/reek/tree_dresser_spec.rb +0 -46
- data/spec/spec_helper.rb +0 -110
- data/tasks/configuration.rake +0 -18
- data/tasks/console.rake +0 -5
- data/tasks/reek.rake +0 -6
- data/tasks/rubocop.rake +0 -11
- data/tasks/test.rake +0 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75ed5064f626b7d8ae34f869ee17d53960804381fb73db707c866202bb71490a
|
|
4
|
+
data.tar.gz: 07f819f93d3ac3f84deb0a0a113dfbc3136e70f9b097f72e1c535f4352fb8b7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71313200963b12c5c2edb8cd84d5ee4ea8fd99241c1fa0f6c6329e332ba41538b5a11990b54f24a136a748bc2492fd87f5ffcd78ef358bdd4f1420970bd2915b
|
|
7
|
+
data.tar.gz: 2f39a6f2ea9cf9a4d8eb629bc5542883ecccfb8811c1fc062a2c0aa8deb41ceacd47de2a76a2f9cb8f6b0e6b56da63551f403edc14e55cd35ae7bac62822a2b3
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Documentation for all configuration options:
|
|
2
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
- package-ecosystem: "bundler"
|
|
7
|
+
directory: "/"
|
|
8
|
+
schedule:
|
|
9
|
+
interval: "daily"
|
|
10
|
+
- package-ecosystem: "github-actions"
|
|
11
|
+
directory: "/"
|
|
12
|
+
schedule:
|
|
13
|
+
interval: "monthly"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and
|
|
2
|
+
# run tests with Rake
|
|
3
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
4
|
+
|
|
5
|
+
name: CI
|
|
6
|
+
|
|
7
|
+
"on":
|
|
8
|
+
push:
|
|
9
|
+
branches: [master]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [master]
|
|
12
|
+
schedule:
|
|
13
|
+
- cron: '16 4 12 * *'
|
|
14
|
+
|
|
15
|
+
env:
|
|
16
|
+
CUCUMBER_PUBLISH_QUIET: true
|
|
17
|
+
RUBYOPTS: "--disable-did-you-mean"
|
|
18
|
+
jobs:
|
|
19
|
+
test:
|
|
20
|
+
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "jruby-9.3", "jruby-9.4"]
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- name: Set up Ruby
|
|
30
|
+
uses: ruby/setup-ruby@v1
|
|
31
|
+
with:
|
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
|
33
|
+
bundler-cache: true
|
|
34
|
+
- name: Run specs
|
|
35
|
+
run: bundle exec rake test:spec
|
|
36
|
+
- name: Run performance tests
|
|
37
|
+
run: bundle exec rake test:performance
|
|
38
|
+
- name: Update default configuration
|
|
39
|
+
run: bundle exec rake configuration:update_default_configuration
|
|
40
|
+
- name: Run cucumber features
|
|
41
|
+
run: bundle exec rake test:features
|
|
42
|
+
- name: Run code quality specs
|
|
43
|
+
run: bundle exec rake test:quality
|
|
44
|
+
|
|
45
|
+
rubocop:
|
|
46
|
+
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v3
|
|
51
|
+
- name: Set up Ruby
|
|
52
|
+
uses: ruby/setup-ruby@v1
|
|
53
|
+
with:
|
|
54
|
+
ruby-version: 2.7
|
|
55
|
+
bundler-cache: true
|
|
56
|
+
- name: Run RuboCop
|
|
57
|
+
run: bundle exec rubocop -P
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
|
3
|
+
inherit_mode:
|
|
4
|
+
merge:
|
|
5
|
+
- Exclude
|
|
6
|
+
|
|
3
7
|
require:
|
|
4
8
|
- rubocop-rspec
|
|
5
9
|
- rubocop-performance
|
|
@@ -7,10 +11,8 @@ require:
|
|
|
7
11
|
AllCops:
|
|
8
12
|
Exclude:
|
|
9
13
|
- 'samples/**/*'
|
|
10
|
-
- 'tmp/**/*'
|
|
11
|
-
- 'vendor/**/*'
|
|
12
14
|
NewCops: enable
|
|
13
|
-
TargetRubyVersion: 2.
|
|
15
|
+
TargetRubyVersion: 2.6
|
|
14
16
|
|
|
15
17
|
# Tables are nice
|
|
16
18
|
Layout/HashAlignment:
|
|
@@ -46,7 +48,7 @@ Layout/MultilineOperationIndentation:
|
|
|
46
48
|
Lint/AmbiguousBlockAssociation:
|
|
47
49
|
Enabled: false
|
|
48
50
|
|
|
49
|
-
# Some of our source examples include interpolation
|
|
51
|
+
# Some of our source examples include interpolation explicitly.
|
|
50
52
|
Lint/InterpolationCheck:
|
|
51
53
|
Exclude:
|
|
52
54
|
- 'spec/**/*'
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2021-01-03 18:17:11 UTC using RuboCop version 1.7.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -13,22 +13,24 @@ Lint/MissingSuper:
|
|
|
13
13
|
- 'lib/reek/smell_detectors/base_detector.rb'
|
|
14
14
|
|
|
15
15
|
# Offense count: 2
|
|
16
|
+
# Configuration parameters: IgnoredPatterns.
|
|
17
|
+
# IgnoredPatterns: (?-mix:(exactly|at_least|at_most)\(\d+\)\.times)
|
|
16
18
|
Lint/UnreachableLoop:
|
|
17
19
|
Exclude:
|
|
18
20
|
- 'spec/reek/ast/node_spec.rb'
|
|
19
21
|
|
|
20
22
|
# Offense count: 2
|
|
21
|
-
# Configuration parameters: IgnoredMethods.
|
|
23
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
|
22
24
|
Metrics/AbcSize:
|
|
23
25
|
Max: 21
|
|
24
26
|
|
|
25
27
|
# Offense count: 1
|
|
26
28
|
# Configuration parameters: CountComments, CountAsOne.
|
|
27
29
|
Metrics/ClassLength:
|
|
28
|
-
Max:
|
|
30
|
+
Max: 170
|
|
29
31
|
|
|
30
32
|
# Offense count: 13
|
|
31
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
|
|
33
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
|
32
34
|
Metrics/MethodLength:
|
|
33
35
|
Max: 16
|
|
34
36
|
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 6.1.4 (2023-01-13)
|
|
4
|
+
|
|
5
|
+
* (mvz) Update parser dependency to the 3.2.x series
|
|
6
|
+
|
|
7
|
+
## 6.1.3 (2022-12-29)
|
|
8
|
+
|
|
9
|
+
* (gonubana) Allow failing safely when trying to recursively find a configuration
|
|
10
|
+
|
|
11
|
+
## 6.1.2 (2022-11-21)
|
|
12
|
+
|
|
13
|
+
* (mvz) Add support for keyword nil arguments
|
|
14
|
+
|
|
15
|
+
## 6.1.1 (2022-04-20)
|
|
16
|
+
|
|
17
|
+
* (ydah) UnusedPrivateMethod to be detect use of methods via `Method#to_proc`
|
|
18
|
+
|
|
19
|
+
## 6.1.0 (2022-01-14)
|
|
20
|
+
|
|
21
|
+
* (mvz) Drop support for Ruby 2.4 and 2.5
|
|
22
|
+
* (mvz) Support Ruby 3.0 and 3.1
|
|
23
|
+
* (mvz) Support argument forwarding after regular arguments
|
|
24
|
+
|
|
25
|
+
## 6.0.6 (2021-08-12)
|
|
26
|
+
|
|
27
|
+
* (mvz) Remove explicit dependency on psych. This fixes an issue where
|
|
28
|
+
installing Reek would unintentionally pull in psych 4.0
|
|
29
|
+
|
|
30
|
+
## 6.0.5 (2021-08-01)
|
|
31
|
+
|
|
32
|
+
* (dependabot) Loosen dependency on psych
|
|
33
|
+
* (Nicolás Ferrari) Fix bugs when used by codeclimate
|
|
34
|
+
|
|
35
|
+
## 6.0.4 (2021-04-27)
|
|
36
|
+
|
|
37
|
+
* (Nicolás Ferrari) Add build-base to Dockerfile
|
|
38
|
+
* (Masataka Pocke Kuwabara and Daniel Santos Dantas) Reduce gem package size
|
|
39
|
+
|
|
40
|
+
## 6.0.3 (2021-01-11)
|
|
41
|
+
|
|
42
|
+
* (mvz) Require parser 3.0
|
|
43
|
+
* (mvz) In a refinement, assign smells to the refined module or class
|
|
44
|
+
|
|
3
45
|
## 6.0.2 (2020-10-17)
|
|
4
46
|
|
|
5
47
|
* (mvz) Loosen dependency on psych. This should resolve installation problems on
|
data/CONTRIBUTING.md
CHANGED
|
@@ -27,6 +27,9 @@ version, Ruby platform (MRI, JRuby, etc.), operating system.
|
|
|
27
27
|
Try to provide a minimal example that reproduces the issue.
|
|
28
28
|
Extra kudos if you can write it as a failing test. :)
|
|
29
29
|
|
|
30
|
+
Make sure any code examples and output are properly formatted
|
|
31
|
+
using [code blocks](https://github.github.com/gfm/#fenced-code-blocks).
|
|
32
|
+
|
|
30
33
|
## Contributing features, bugfixes, documentation
|
|
31
34
|
|
|
32
35
|
### Getting started
|
|
@@ -139,7 +142,7 @@ Once you’re happy with your feature / fix – or want to
|
|
|
139
142
|
share it as a work-in-progress and request comments – once
|
|
140
143
|
again make sure all of the tests pass. This will also run
|
|
141
144
|
[RuboCop](https://github.com/bbatsov/rubocop) – fix any
|
|
142
|
-
|
|
145
|
+
offenses RuboCop finds (or discuss them in the pull request):
|
|
143
146
|
|
|
144
147
|
```
|
|
145
148
|
bundle exec rake
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -5,18 +5,18 @@ gemspec
|
|
|
5
5
|
ruby RUBY_VERSION
|
|
6
6
|
|
|
7
7
|
group :development do
|
|
8
|
-
gem 'aruba', '~> 1
|
|
8
|
+
gem 'aruba', '~> 2.1'
|
|
9
9
|
gem 'codeclimate-engine-rb', '~> 0.4.0'
|
|
10
|
-
gem 'cucumber',
|
|
10
|
+
gem 'cucumber', '~> 8.0'
|
|
11
11
|
gem 'kramdown', '~> 2.1'
|
|
12
12
|
gem 'kramdown-parser-gfm', '~> 1.0'
|
|
13
13
|
gem 'rake', '~> 13.0'
|
|
14
14
|
gem 'rspec', '~> 3.0'
|
|
15
15
|
gem 'rspec-benchmark', '~> 0.6.0'
|
|
16
|
-
gem 'rubocop', '~>
|
|
17
|
-
gem 'rubocop-performance', '~> 1.
|
|
18
|
-
gem 'rubocop-rspec', '~>
|
|
19
|
-
gem 'simplecov',
|
|
16
|
+
gem 'rubocop', '~> 1.43.0'
|
|
17
|
+
gem 'rubocop-performance', '~> 1.15.0'
|
|
18
|
+
gem 'rubocop-rspec', '~> 2.17.0'
|
|
19
|
+
gem 'simplecov', '>= 0.18.0', '< 0.23.0'
|
|
20
20
|
gem 'yard', '~> 0.9.5'
|
|
21
21
|
|
|
22
22
|
platforms :mri do
|
|
@@ -25,5 +25,5 @@ group :development do
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
group :debugging do
|
|
28
|
-
gem 'pry', '~> 0.
|
|
28
|
+
gem 'pry', '~> 0.14.0'
|
|
29
29
|
end
|
data/README.md
CHANGED
|
@@ -94,7 +94,7 @@ demo.rb -- 2 warnings:
|
|
|
94
94
|
|
|
95
95
|
## Supported Ruby versions
|
|
96
96
|
|
|
97
|
-
Reek is officially supported for CRuby 2.
|
|
97
|
+
Reek is officially supported for CRuby 2.6 through 3.1 and for JRuby 9.3.
|
|
98
98
|
Other Ruby implementations (like Rubinius) are not officially supported but
|
|
99
99
|
should work as well.
|
|
100
100
|
|
|
@@ -411,7 +411,7 @@ def smelly_method foo
|
|
|
411
411
|
end
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
This is an incredibly powerful feature and further explained under [Smell
|
|
414
|
+
This is an incredibly powerful feature and further explained under [Smell Suppression](docs/Smell-Suppression.md).
|
|
415
415
|
|
|
416
416
|
#### Debugging trouble with the configuration
|
|
417
417
|
|
data/bin/code_climate_reek
CHANGED
|
@@ -14,15 +14,14 @@ class CodeClimateToReek
|
|
|
14
14
|
# we have to exit with a zero for both failure and success.
|
|
15
15
|
ENGINE_CONFIGURATION = [
|
|
16
16
|
'--failure-exit-code', '0',
|
|
17
|
-
'--success-exit-code', '0'
|
|
18
|
-
'.'
|
|
17
|
+
'--success-exit-code', '0'
|
|
19
18
|
].freeze
|
|
20
19
|
|
|
21
20
|
attr_reader :configuration_file_path, :include_paths_key, :include_paths_default
|
|
22
21
|
|
|
23
22
|
def initialize(configuration_file_path: '/config.json',
|
|
24
23
|
include_paths_key: 'include_paths',
|
|
25
|
-
include_paths_default: [])
|
|
24
|
+
include_paths_default: ['.'])
|
|
26
25
|
@configuration_file_path = configuration_file_path
|
|
27
26
|
@include_paths_key = include_paths_key
|
|
28
27
|
@include_paths_default = include_paths_default
|
data/lib/reek/ast/node.rb
CHANGED
|
@@ -60,7 +60,7 @@ module Reek
|
|
|
60
60
|
#
|
|
61
61
|
# Returns an array with all matching nodes.
|
|
62
62
|
def each_node(target_types, ignoring = [], &blk)
|
|
63
|
-
return enum_for(:each_node, target_types, ignoring) unless
|
|
63
|
+
return enum_for(:each_node, target_types, ignoring) unless blk
|
|
64
64
|
|
|
65
65
|
look_for(Array(target_types), ignoring, &blk)
|
|
66
66
|
end
|
|
@@ -104,6 +104,26 @@ module Reek
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
107
|
+
|
|
108
|
+
# Utility methods for :forward_arg nodes.
|
|
109
|
+
# rubocop:disable Naming/ClassAndModuleCamelCase
|
|
110
|
+
module Forward_ArgNode
|
|
111
|
+
include ArgNodeBase
|
|
112
|
+
|
|
113
|
+
def anonymous_splat?
|
|
114
|
+
true
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
118
|
+
|
|
119
|
+
# Utility methods for :kwnilarg nodes.
|
|
120
|
+
module KwnilargNode
|
|
121
|
+
include ArgNodeBase
|
|
122
|
+
|
|
123
|
+
def anonymous_splat?
|
|
124
|
+
true
|
|
125
|
+
end
|
|
126
|
+
end
|
|
107
127
|
end
|
|
108
128
|
end
|
|
109
129
|
end
|
|
@@ -23,8 +23,8 @@ module Reek
|
|
|
23
23
|
puts EXISTING_FILE_MESSAGE
|
|
24
24
|
else
|
|
25
25
|
write_to_file
|
|
26
|
-
puts "\n'#{DEFAULT_CONFIGURATION_FILE_NAME}' generated! "\
|
|
27
|
-
|
|
26
|
+
puts "\n'#{DEFAULT_CONFIGURATION_FILE_NAME}' generated! " \
|
|
27
|
+
'You can now use this as a starting point.'
|
|
28
28
|
end
|
|
29
29
|
options.success_exit_code
|
|
30
30
|
end
|
data/lib/reek/cli/options.rb
CHANGED
|
@@ -110,12 +110,12 @@ module Reek
|
|
|
110
110
|
parser.on('--smell SMELL',
|
|
111
111
|
'Only look for a specific smell.',
|
|
112
112
|
'Call it like this: reek --smell MissingSafeMethod source.rb',
|
|
113
|
-
"Check out #{DocumentationLink.build('Code Smells')} "\
|
|
113
|
+
"Check out #{DocumentationLink.build('Code Smells')} " \
|
|
114
114
|
'for a list of smells') do |smell|
|
|
115
115
|
smells_to_detect << smell
|
|
116
116
|
end
|
|
117
117
|
parser.on('--stdin-filename FILE',
|
|
118
|
-
'When passing code in via pipe, assume this filename when '\
|
|
118
|
+
'When passing code in via pipe, assume this filename when ' \
|
|
119
119
|
'checking file or directory rules in the config.') do |file|
|
|
120
120
|
self.stdin_filename = file
|
|
121
121
|
end
|
|
@@ -210,12 +210,12 @@ module Reek
|
|
|
210
210
|
def set_exit_codes
|
|
211
211
|
parser.separator "\nExit codes:"
|
|
212
212
|
parser.on('--success-exit-code CODE',
|
|
213
|
-
'The exit code when no smells are found '\
|
|
213
|
+
'The exit code when no smells are found ' \
|
|
214
214
|
"(default: #{Status::DEFAULT_SUCCESS_EXIT_CODE})") do |option|
|
|
215
215
|
self.success_exit_code = Integer(option)
|
|
216
216
|
end
|
|
217
217
|
parser.on('--failure-exit-code CODE',
|
|
218
|
-
'The exit code when smells are found '\
|
|
218
|
+
'The exit code when smells are found ' \
|
|
219
219
|
"(default: #{Status::DEFAULT_FAILURE_EXIT_CODE})") do |option|
|
|
220
220
|
self.failure_exit_code = Integer(option)
|
|
221
221
|
end
|
|
@@ -231,8 +231,8 @@ module Reek
|
|
|
231
231
|
parser.on_tail('-l', '--list', 'List all available smell detectors') do
|
|
232
232
|
puts "All available smell detectors:\n\n"
|
|
233
233
|
puts DetectorRepository.available_detector_names
|
|
234
|
-
puts "\nCheck out #{DocumentationLink.build('Code Smells')} "\
|
|
235
|
-
|
|
234
|
+
puts "\nCheck out #{DocumentationLink.build('Code Smells')} " \
|
|
235
|
+
'for a details on each detector'
|
|
236
236
|
exit
|
|
237
237
|
end
|
|
238
238
|
parser.on_tail('-v', '--version', 'Show version') do
|
data/lib/reek/code_comment.rb
CHANGED
|
@@ -39,13 +39,13 @@ module Reek
|
|
|
39
39
|
|
|
40
40
|
@original_comment.scan(CONFIGURATION_REGEX) do |detector_name, separator, options|
|
|
41
41
|
escalate_legacy_separator separator
|
|
42
|
-
CodeCommentValidator.new(detector_name: detector_name,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
validator = CodeCommentValidator.new(detector_name: detector_name,
|
|
43
|
+
original_comment: original_comment,
|
|
44
|
+
line: line,
|
|
45
|
+
source: source,
|
|
46
|
+
options: options)
|
|
47
|
+
validator.validate
|
|
48
|
+
@config.merge! detector_name => validator.parsed_options
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -115,6 +115,21 @@ module Reek
|
|
|
115
115
|
escalate_unknown_configuration_key
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
+
def parsed_options
|
|
119
|
+
@parsed_options ||=
|
|
120
|
+
if Psych::VERSION < '3.1.0'
|
|
121
|
+
YAML.safe_load(options || CodeComment::DISABLE_DETECTOR_CONFIGURATION, [Regexp])
|
|
122
|
+
else
|
|
123
|
+
YAML.safe_load(options || CodeComment::DISABLE_DETECTOR_CONFIGURATION,
|
|
124
|
+
permitted_classes: [Regexp])
|
|
125
|
+
end
|
|
126
|
+
rescue Psych::SyntaxError
|
|
127
|
+
raise Errors::GarbageDetectorConfigurationInCommentError.new(detector_name: detector_name,
|
|
128
|
+
original_comment: original_comment,
|
|
129
|
+
source: source,
|
|
130
|
+
line: line)
|
|
131
|
+
end
|
|
132
|
+
|
|
118
133
|
private
|
|
119
134
|
|
|
120
135
|
attr_reader :detector_name,
|
|
@@ -124,16 +139,6 @@ module Reek
|
|
|
124
139
|
:separator,
|
|
125
140
|
:options
|
|
126
141
|
|
|
127
|
-
def parsed_options
|
|
128
|
-
@parsed_options ||= YAML.safe_load(options || CodeComment::DISABLE_DETECTOR_CONFIGURATION,
|
|
129
|
-
permitted_classes: [Regexp])
|
|
130
|
-
rescue Psych::SyntaxError
|
|
131
|
-
raise Errors::GarbageDetectorConfigurationInCommentError.new(detector_name: detector_name,
|
|
132
|
-
original_comment: original_comment,
|
|
133
|
-
source: source,
|
|
134
|
-
line: line)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
142
|
def escalate_unknown_configuration_key
|
|
138
143
|
return if given_keys_legit?
|
|
139
144
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'module_context'
|
|
4
|
+
|
|
5
|
+
module Reek
|
|
6
|
+
module Context
|
|
7
|
+
#
|
|
8
|
+
# A context wrapper for any refinement blocks found in a syntax tree.
|
|
9
|
+
#
|
|
10
|
+
class RefinementContext < ModuleContext
|
|
11
|
+
def full_name
|
|
12
|
+
exp.call.args.first.name
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/reek/context_builder.rb
CHANGED
|
@@ -5,6 +5,7 @@ require_relative 'context/class_context'
|
|
|
5
5
|
require_relative 'context/ghost_context'
|
|
6
6
|
require_relative 'context/method_context'
|
|
7
7
|
require_relative 'context/module_context'
|
|
8
|
+
require_relative 'context/refinement_context'
|
|
8
9
|
require_relative 'context/root_context'
|
|
9
10
|
require_relative 'context/send_context'
|
|
10
11
|
require_relative 'context/singleton_attribute_context'
|
|
@@ -20,7 +21,7 @@ module Reek
|
|
|
20
21
|
# counting. Ideally `ContextBuilder` would only build up the context tree and leave the
|
|
21
22
|
# statement and reference counting to the contexts.
|
|
22
23
|
#
|
|
23
|
-
# @quality :reek:TooManyMethods { max_methods:
|
|
24
|
+
# @quality :reek:TooManyMethods { max_methods: 32 }
|
|
24
25
|
# @quality :reek:UnusedPrivateMethod { exclude: [ !ruby/regexp /process_/ ] }
|
|
25
26
|
# @quality :reek:DataClump
|
|
26
27
|
class ContextBuilder
|
|
@@ -263,9 +264,16 @@ module Reek
|
|
|
263
264
|
#
|
|
264
265
|
# Counts non-empty blocks as one statement.
|
|
265
266
|
#
|
|
267
|
+
# A refinement block is handled differently and causes a RefinementContext
|
|
268
|
+
# to be opened.
|
|
269
|
+
#
|
|
266
270
|
def process_block(exp, _parent)
|
|
267
271
|
increase_statement_count_by(exp.block)
|
|
268
|
-
|
|
272
|
+
if exp.call.name == :refine
|
|
273
|
+
handle_refinement_block(exp)
|
|
274
|
+
else
|
|
275
|
+
process(exp)
|
|
276
|
+
end
|
|
269
277
|
end
|
|
270
278
|
|
|
271
279
|
# Handles `begin` and `kwbegin` nodes. `begin` nodes are created implicitly
|
|
@@ -414,7 +422,7 @@ module Reek
|
|
|
414
422
|
# See `process_rescue` for additional reference.
|
|
415
423
|
#
|
|
416
424
|
def process_resbody(exp, _parent)
|
|
417
|
-
increase_statement_count_by(exp.children[1
|
|
425
|
+
increase_statement_count_by(exp.children[1..].compact)
|
|
418
426
|
process(exp)
|
|
419
427
|
end
|
|
420
428
|
|
|
@@ -508,6 +516,12 @@ module Reek
|
|
|
508
516
|
end
|
|
509
517
|
end
|
|
510
518
|
|
|
519
|
+
def handle_refinement_block(exp)
|
|
520
|
+
inside_new_context(Context::RefinementContext, exp) do
|
|
521
|
+
process(exp)
|
|
522
|
+
end
|
|
523
|
+
end
|
|
524
|
+
|
|
511
525
|
def handle_send_for_modules(exp)
|
|
512
526
|
arg_names = exp.args.map { |arg| arg.children.first }
|
|
513
527
|
current_context.track_visibility(exp.name, arg_names)
|
data/lib/reek/rake/task.rb
CHANGED
|
@@ -69,15 +69,15 @@ module Reek
|
|
|
69
69
|
|
|
70
70
|
# @public
|
|
71
71
|
def initialize(name = :reek)
|
|
72
|
-
@config_file = ENV
|
|
72
|
+
@config_file = ENV.fetch('REEK_CFG', nil)
|
|
73
73
|
@name = name
|
|
74
|
-
@reek_opts = ENV
|
|
74
|
+
@reek_opts = ENV.fetch('REEK_OPTS', '')
|
|
75
75
|
@fail_on_error = true
|
|
76
76
|
@verbose = false
|
|
77
77
|
|
|
78
78
|
yield self if block_given?
|
|
79
79
|
|
|
80
|
-
if (reek_src = ENV
|
|
80
|
+
if (reek_src = ENV.fetch('REEK_SRC', nil))
|
|
81
81
|
@source_files = FileList[reek_src]
|
|
82
82
|
end
|
|
83
83
|
@source_files ||= FileList['lib/**/*.rb']
|
|
@@ -87,8 +87,8 @@ module Reek
|
|
|
87
87
|
# @public
|
|
88
88
|
def source_files=(files)
|
|
89
89
|
unless files.is_a?(String) || files.is_a?(FileList)
|
|
90
|
-
raise ArgumentError, 'File list should be a FileList or a String that can contain'\
|
|
91
|
-
|
|
90
|
+
raise ArgumentError, 'File list should be a FileList or a String that can contain ' \
|
|
91
|
+
"a glob pattern, e.g. '{app,lib,spec}/**/*.rb'"
|
|
92
92
|
end
|
|
93
93
|
@source_files = FileList[files]
|
|
94
94
|
end
|