reek 6.0.3 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +31 -26
  3. data/.rubocop.yml +5 -3
  4. data/CHANGELOG.md +22 -1
  5. data/CONTRIBUTING.md +3 -0
  6. data/Dockerfile +1 -1
  7. data/Gemfile +7 -7
  8. data/README.md +1 -1
  9. data/bin/code_climate_reek +2 -3
  10. data/lib/reek/ast/ast_node_class_map.rb +1 -1
  11. data/lib/reek/ast/sexp_extensions/arguments.rb +11 -0
  12. data/lib/reek/ast/sexp_extensions/case.rb +1 -1
  13. data/lib/reek/ast/sexp_extensions/if.rb +1 -1
  14. data/lib/reek/ast/sexp_extensions/send.rb +1 -1
  15. data/lib/reek/cli/command/todo_list_command.rb +1 -1
  16. data/lib/reek/cli/options.rb +1 -1
  17. data/lib/reek/code_comment.rb +22 -17
  18. data/lib/reek/context_builder.rb +1 -1
  19. data/lib/reek/rake/task.rb +1 -1
  20. data/lib/reek/report/code_climate/code_climate_formatter.rb +1 -3
  21. data/lib/reek/smell_detectors/base_detector.rb +1 -1
  22. data/lib/reek/smell_warning.rb +1 -1
  23. data/lib/reek/source/source_locator.rb +1 -3
  24. data/lib/reek/spec/should_reek_of.rb +6 -4
  25. data/lib/reek/version.rb +2 -2
  26. data/reek.gemspec +28 -25
  27. metadata +7 -225
  28. data/docs/API.md +0 -174
  29. data/docs/Attribute.md +0 -39
  30. data/docs/Basic-Smell-Options.md +0 -85
  31. data/docs/Boolean-Parameter.md +0 -54
  32. data/docs/Class-Variable.md +0 -40
  33. data/docs/Code-Smells.md +0 -39
  34. data/docs/Command-Line-Options.md +0 -119
  35. data/docs/Control-Couple.md +0 -26
  36. data/docs/Control-Parameter.md +0 -32
  37. data/docs/Data-Clump.md +0 -46
  38. data/docs/Duplicate-Method-Call.md +0 -264
  39. data/docs/Feature-Envy.md +0 -93
  40. data/docs/How-To-Write-New-Detectors.md +0 -132
  41. data/docs/How-reek-works-internally.md +0 -114
  42. data/docs/Instance-Variable-Assumption.md +0 -163
  43. data/docs/Irresponsible-Module.md +0 -47
  44. data/docs/Large-Class.md +0 -16
  45. data/docs/Long-Parameter-List.md +0 -39
  46. data/docs/Long-Yield-List.md +0 -37
  47. data/docs/Manual-Dispatch.md +0 -30
  48. data/docs/Missing-Safe-Method.md +0 -92
  49. data/docs/Module-Initialize.md +0 -62
  50. data/docs/Nested-Iterators.md +0 -59
  51. data/docs/Nil-Check.md +0 -47
  52. data/docs/RSpec-matchers.md +0 -129
  53. data/docs/Rake-Task.md +0 -66
  54. data/docs/Reek-4-to-Reek-5-migration.md +0 -188
  55. data/docs/Reek-Driven-Development.md +0 -46
  56. data/docs/Repeated-Conditional.md +0 -47
  57. data/docs/Simulated-Polymorphism.md +0 -16
  58. data/docs/Smell-Suppression.md +0 -96
  59. data/docs/Style-Guide.md +0 -19
  60. data/docs/Subclassed-From-Core-Class.md +0 -79
  61. data/docs/Too-Many-Constants.md +0 -37
  62. data/docs/Too-Many-Instance-Variables.md +0 -43
  63. data/docs/Too-Many-Methods.md +0 -56
  64. data/docs/Too-Many-Statements.md +0 -54
  65. data/docs/Uncommunicative-Method-Name.md +0 -94
  66. data/docs/Uncommunicative-Module-Name.md +0 -92
  67. data/docs/Uncommunicative-Name.md +0 -18
  68. data/docs/Uncommunicative-Parameter-Name.md +0 -90
  69. data/docs/Uncommunicative-Variable-Name.md +0 -96
  70. data/docs/Unused-Parameters.md +0 -28
  71. data/docs/Unused-Private-Method.md +0 -101
  72. data/docs/Utility-Function.md +0 -56
  73. data/docs/Versioning-Policy.md +0 -7
  74. data/docs/YAML-Reports.md +0 -93
  75. data/docs/defaults.reek.yml +0 -129
  76. data/docs/templates/default/docstring/html/public_api_marker.erb +0 -3
  77. data/docs/templates/default/docstring/setup.rb +0 -35
  78. data/docs/templates/default/fulldoc/html/css/common.css +0 -1
  79. data/docs/yard_plugin.rb +0 -17
  80. data/features/command_line_interface/basic_usage.feature +0 -15
  81. data/features/command_line_interface/options.feature +0 -123
  82. data/features/command_line_interface/show_progress.feature +0 -33
  83. data/features/command_line_interface/smell_selection.feature +0 -15
  84. data/features/command_line_interface/smells_count.feature +0 -38
  85. data/features/command_line_interface/stdin.feature +0 -65
  86. data/features/configuration_files/accept_setting.feature +0 -87
  87. data/features/configuration_files/directory_specific_directives.feature +0 -274
  88. data/features/configuration_files/exclude_directives.feature +0 -35
  89. data/features/configuration_files/exclude_paths_directives.feature +0 -42
  90. data/features/configuration_files/masking_smells.feature +0 -94
  91. data/features/configuration_files/mix_accept_reject_setting.feature +0 -84
  92. data/features/configuration_files/reject_setting.feature +0 -89
  93. data/features/configuration_files/schema_validation.feature +0 -59
  94. data/features/configuration_files/show_configuration_file.feature +0 -44
  95. data/features/configuration_files/unused_private_method.feature +0 -68
  96. data/features/configuration_loading.feature +0 -91
  97. data/features/configuration_via_source_comments/erroneous_source_comments.feature +0 -68
  98. data/features/configuration_via_source_comments/well_formed_source_comments.feature +0 -116
  99. data/features/locales.feature +0 -32
  100. data/features/programmatic_access.feature +0 -41
  101. data/features/rake_task/rake_task.feature +0 -138
  102. data/features/reports/codeclimate.feature +0 -59
  103. data/features/reports/json.feature +0 -59
  104. data/features/reports/reports.feature +0 -219
  105. data/features/reports/yaml.feature +0 -52
  106. data/features/rspec_matcher.feature +0 -41
  107. data/features/samples.feature +0 -305
  108. data/features/step_definitions/.rubocop.yml +0 -5
  109. data/features/step_definitions/reek_steps.rb +0 -102
  110. data/features/step_definitions/sample_file_steps.rb +0 -63
  111. data/features/support/env.rb +0 -33
  112. data/features/todo_list.feature +0 -108
  113. data/samples/checkstyle.xml +0 -7
  114. data/samples/clean_source/clean.rb +0 -6
  115. data/samples/configuration/accepts_rejects_and_excludes_for_detectors.reek.yml +0 -29
  116. data/samples/configuration/accepts_rejects_and_excludes_for_directory_directives.reek.yml +0 -30
  117. data/samples/configuration/corrupt.reek +0 -1
  118. data/samples/configuration/empty.reek +0 -0
  119. data/samples/configuration/full_configuration.reek +0 -13
  120. data/samples/configuration/full_mask.reek +0 -6
  121. data/samples/configuration/home/home.reek.yml +0 -4
  122. data/samples/configuration/partial_mask.reek +0 -4
  123. data/samples/configuration/regular_configuration/.reek.yml +0 -4
  124. data/samples/configuration/regular_configuration/empty_sub_directory/.gitignore +0 -0
  125. data/samples/configuration/with_excluded_paths.reek +0 -5
  126. data/samples/no_config_file/.keep +0 -0
  127. data/samples/paths.rb +0 -5
  128. data/samples/smelly_source/inline.rb +0 -704
  129. data/samples/smelly_source/optparse.rb +0 -1788
  130. data/samples/smelly_source/redcloth.rb +0 -1130
  131. data/samples/smelly_source/ruby.rb +0 -368
  132. data/samples/smelly_source/smelly.rb +0 -7
  133. data/samples/source_with_exclude_paths/ignore_me/uncommunicative_method_name.rb +0 -5
  134. data/samples/source_with_exclude_paths/nested/ignore_me_as_well/irresponsible_module.rb +0 -2
  135. data/samples/source_with_exclude_paths/nested/uncommunicative_parameter_name.rb +0 -6
  136. data/samples/source_with_exclude_paths/nested/uncommunicative_variable_name.rb +0 -6
  137. data/samples/source_with_hidden_directories/.hidden/hidden.rb +0 -1
  138. data/samples/source_with_hidden_directories/not_hidden.rb +0 -1
  139. data/samples/source_with_non_ruby_files/gibberish +0 -1
  140. data/samples/source_with_non_ruby_files/python_source.py +0 -1
  141. data/samples/source_with_non_ruby_files/ruby.rb +0 -6
  142. data/spec/performance/reek/smell_detectors/runtime_speed_spec.rb +0 -15
  143. data/spec/quality/documentation_spec.rb +0 -41
  144. data/spec/quality/reek_source_spec.rb +0 -11
  145. data/spec/reek/ast/node_spec.rb +0 -211
  146. data/spec/reek/ast/object_refs_spec.rb +0 -83
  147. data/spec/reek/ast/reference_collector_spec.rb +0 -47
  148. data/spec/reek/ast/sexp_extensions_spec.rb +0 -498
  149. data/spec/reek/cli/application_spec.rb +0 -168
  150. data/spec/reek/cli/command/report_command_spec.rb +0 -44
  151. data/spec/reek/cli/command/todo_list_command_spec.rb +0 -86
  152. data/spec/reek/cli/options_spec.rb +0 -51
  153. data/spec/reek/cli/silencer_spec.rb +0 -28
  154. data/spec/reek/code_comment_spec.rb +0 -184
  155. data/spec/reek/configuration/app_configuration_spec.rb +0 -195
  156. data/spec/reek/configuration/configuration_file_finder_spec.rb +0 -230
  157. data/spec/reek/configuration/default_directive_spec.rb +0 -13
  158. data/spec/reek/configuration/directory_directives_spec.rb +0 -122
  159. data/spec/reek/configuration/excluded_paths_spec.rb +0 -25
  160. data/spec/reek/configuration/rake_task_converter_spec.rb +0 -33
  161. data/spec/reek/configuration/schema_validator_spec.rb +0 -165
  162. data/spec/reek/context/code_context_spec.rb +0 -192
  163. data/spec/reek/context/ghost_context_spec.rb +0 -60
  164. data/spec/reek/context/method_context_spec.rb +0 -72
  165. data/spec/reek/context/module_context_spec.rb +0 -55
  166. data/spec/reek/context/root_context_spec.rb +0 -12
  167. data/spec/reek/context/statement_counter_spec.rb +0 -24
  168. data/spec/reek/context_builder_spec.rb +0 -457
  169. data/spec/reek/detector_repository_spec.rb +0 -22
  170. data/spec/reek/documentation_link_spec.rb +0 -20
  171. data/spec/reek/errors/base_error_spec.rb +0 -13
  172. data/spec/reek/examiner_spec.rb +0 -309
  173. data/spec/reek/logging_error_handler_spec.rb +0 -24
  174. data/spec/reek/rake/task_spec.rb +0 -56
  175. data/spec/reek/report/code_climate/code_climate_configuration_spec.rb +0 -22
  176. data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +0 -126
  177. data/spec/reek/report/code_climate/code_climate_formatter_spec.rb +0 -51
  178. data/spec/reek/report/code_climate/code_climate_report_spec.rb +0 -56
  179. data/spec/reek/report/html_report_spec.rb +0 -19
  180. data/spec/reek/report/json_report_spec.rb +0 -58
  181. data/spec/reek/report/location_formatter_spec.rb +0 -32
  182. data/spec/reek/report/progress_formatter_spec.rb +0 -68
  183. data/spec/reek/report/text_report_spec.rb +0 -89
  184. data/spec/reek/report/xml_report_spec.rb +0 -24
  185. data/spec/reek/report/yaml_report_spec.rb +0 -55
  186. data/spec/reek/report_spec.rb +0 -28
  187. data/spec/reek/smell_configuration_spec.rb +0 -56
  188. data/spec/reek/smell_detectors/attribute_spec.rb +0 -197
  189. data/spec/reek/smell_detectors/base_detector_spec.rb +0 -50
  190. data/spec/reek/smell_detectors/boolean_parameter_spec.rb +0 -93
  191. data/spec/reek/smell_detectors/class_variable_spec.rb +0 -106
  192. data/spec/reek/smell_detectors/control_parameter_spec.rb +0 -300
  193. data/spec/reek/smell_detectors/data_clump_spec.rb +0 -134
  194. data/spec/reek/smell_detectors/duplicate_method_call_spec.rb +0 -211
  195. data/spec/reek/smell_detectors/feature_envy_spec.rb +0 -295
  196. data/spec/reek/smell_detectors/instance_variable_assumption_spec.rb +0 -96
  197. data/spec/reek/smell_detectors/irresponsible_module_spec.rb +0 -226
  198. data/spec/reek/smell_detectors/long_parameter_list_spec.rb +0 -61
  199. data/spec/reek/smell_detectors/long_yield_list_spec.rb +0 -49
  200. data/spec/reek/smell_detectors/manual_dispatch_spec.rb +0 -75
  201. data/spec/reek/smell_detectors/missing_safe_method_spec.rb +0 -68
  202. data/spec/reek/smell_detectors/module_initialize_spec.rb +0 -77
  203. data/spec/reek/smell_detectors/nested_iterators_spec.rb +0 -333
  204. data/spec/reek/smell_detectors/nil_check_spec.rb +0 -100
  205. data/spec/reek/smell_detectors/repeated_conditional_spec.rb +0 -100
  206. data/spec/reek/smell_detectors/subclassed_from_core_class_spec.rb +0 -77
  207. data/spec/reek/smell_detectors/too_many_constants_spec.rb +0 -144
  208. data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +0 -132
  209. data/spec/reek/smell_detectors/too_many_methods_spec.rb +0 -54
  210. data/spec/reek/smell_detectors/too_many_statements_spec.rb +0 -90
  211. data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +0 -78
  212. data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +0 -78
  213. data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +0 -147
  214. data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +0 -201
  215. data/spec/reek/smell_detectors/unused_parameters_spec.rb +0 -114
  216. data/spec/reek/smell_detectors/unused_private_method_spec.rb +0 -205
  217. data/spec/reek/smell_detectors/utility_function_spec.rb +0 -309
  218. data/spec/reek/smell_warning_spec.rb +0 -137
  219. data/spec/reek/source/source_code_spec.rb +0 -79
  220. data/spec/reek/source/source_locator_spec.rb +0 -166
  221. data/spec/reek/spec/should_reek_of_spec.rb +0 -153
  222. data/spec/reek/spec/should_reek_only_of_spec.rb +0 -91
  223. data/spec/reek/spec/should_reek_spec.rb +0 -52
  224. data/spec/reek/spec/smell_matcher_spec.rb +0 -87
  225. data/spec/reek/tree_dresser_spec.rb +0 -46
  226. data/spec/spec_helper.rb +0 -110
  227. data/tasks/configuration.rake +0 -18
  228. data/tasks/console.rake +0 -5
  229. data/tasks/reek.rake +0 -6
  230. data/tasks/rubocop.rake +0 -11
  231. data/tasks/test.rake +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 967e95555fe823e1924a78ff2a8c94c40bdb4d16d031bacd51b885d1475bce30
4
- data.tar.gz: c9760389b64b3bb9f96f1896192a540a4de8b7f395808299b9a67e47238e8c42
3
+ metadata.gz: dbfc48f555eaab012cf855f620277247ab134517838fb4f36e608a7dce6c0f4c
4
+ data.tar.gz: 75770e4ea054b9a1f6450d43dd9b3580492e0e7de39c194b95ca4400dc15c54f
5
5
  SHA512:
6
- metadata.gz: ea4c588166903c10bed44c2a459e43e4db479943f8f489ca1eaefbb6db375605e06ff678f5411def292e19ef8c2754245bca78eb24373532474091b0ab8eadbe
7
- data.tar.gz: 9e0804841d54d4278149422d66c7e379597e3f99275ba8b9ab4aef6e7041bde6c928db5f3c62a3b5c3d1d6fc4da0216ba5d13aa5562f9e0b565ec31bb115d0fe
6
+ metadata.gz: ee11e3c7b674c7f520f329f2908f29b529d19671756f77c928e96b62b24e663528dbe7f2c33c669e59f9199cd1338b6e9c2071cf3d94984f1ae801efdabc0ef7
7
+ data.tar.gz: 41d34fe50259bae6f50675ba14ae0205d1348d6ae1a9e2b7716f87ee8f4afa773df7af6853a77af4865cf95d90dfccc0fdcc666a372957b9ade5bb1565d9b34f
@@ -2,14 +2,19 @@
2
2
  # run tests with Rake
3
3
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
4
4
 
5
- name: Ruby
5
+ name: CI
6
6
 
7
7
  on:
8
8
  push:
9
9
  branches: [ master ]
10
10
  pull_request:
11
11
  branches: [ master ]
12
+ schedule:
13
+ - cron: '16 4 12 * *'
12
14
 
15
+ env:
16
+ CUCUMBER_PUBLISH_QUIET: true
17
+ RUBYOPTS: "--disable-did-you-mean"
13
18
  jobs:
14
19
  test:
15
20
 
@@ -17,36 +22,36 @@ jobs:
17
22
 
18
23
  strategy:
19
24
  matrix:
20
- ruby: [2.4, 2.5, 2.6, 2.7, jruby-9.2]
25
+ ruby: [2.6, 2.7, "3.0", "3.1", jruby-9.3]
21
26
 
22
27
  steps:
23
- - uses: actions/checkout@v2
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: ${{ matrix.ruby }}
28
- bundler-cache: true
29
- - name: Run specs
30
- run: bundle exec rake test:spec
31
- - name: Run performance tests
32
- run: bundle exec rake test:performance
33
- - name: Update default configuration
34
- run: bundle exec rake configuration:update_default_configuration
35
- - name: Run cucumber features
36
- run: bundle exec rake test:features
37
- - name: Run code quality specs
38
- run: bundle exec rake test:quality
28
+ - uses: actions/checkout@v2
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
39
44
 
40
45
  rubocop:
41
46
 
42
47
  runs-on: ubuntu-latest
43
48
 
44
49
  steps:
45
- - uses: actions/checkout@v2
46
- - name: Set up Ruby
47
- uses: ruby/setup-ruby@v1
48
- with:
49
- ruby-version: 2.7
50
- bundler-cache: true
51
- - name: Run RuboCop
52
- run: bundle exec rubocop -P
50
+ - uses: actions/checkout@v2
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.4
15
+ TargetRubyVersion: 2.6
14
16
 
15
17
  # Tables are nice
16
18
  Layout/HashAlignment:
data/CHANGELOG.md CHANGED
@@ -1,11 +1,32 @@
1
1
  # Change log
2
2
 
3
+ ## 6.1.0 (2022-01-14)
4
+
5
+ * (mvz) Drop support for Ruby 2.4 and 2.5
6
+ * (mvz) Support Ruby 3.0 and 3.1
7
+ * (mvz) Support argument forwarding after regular arguments
8
+
9
+ ## 6.0.6 (2021-08-12)
10
+
11
+ * (mvz) Remove explicit dependency on psych. This fixes an issue where
12
+ installing Reek would unintentionally pull in psych 4.0
13
+
14
+ ## 6.0.5 (2021-08-01)
15
+
16
+ * (dependabot) Loosen dependency on psych
17
+ * (Nicolás Ferrari) Fix bugs when used by codeclimate
18
+
19
+ ## 6.0.4 (2021-04-27)
20
+
21
+ * (Nicolás Ferrari) Add build-base to Dockerfile
22
+ * (Masataka Pocke Kuwabara and Daniel Santos Dantas) Reduce gem package size
23
+
3
24
  ## 6.0.3 (2021-01-11)
4
25
 
5
26
  * (mvz) Require parser 3.0
6
27
  * (mvz) In a refinement, assign smells to the refined module or class
7
28
 
8
- ## 6.0.3 (2020-10-17)
29
+ ## 6.0.2 (2020-10-17)
9
30
 
10
31
  * (mvz) Loosen dependency on psych. This should resolve installation problems on
11
32
  mingw32
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
data/Dockerfile CHANGED
@@ -11,7 +11,7 @@ ENV code_dir /code
11
11
  ENV app_dir /usr/src/app
12
12
  ENV user app
13
13
 
14
- RUN apk --update add git
14
+ RUN apk --update add git build-base
15
15
  ADD . ${app_dir}
16
16
 
17
17
  RUN adduser -u 9000 -D ${user}
data/Gemfile CHANGED
@@ -5,18 +5,18 @@ gemspec
5
5
  ruby RUBY_VERSION
6
6
 
7
7
  group :development do
8
- gem 'aruba', '~> 1.0'
8
+ gem 'aruba', '~> 2.0'
9
9
  gem 'codeclimate-engine-rb', '~> 0.4.0'
10
- gem 'cucumber', ['>= 4.0', '< 6.0']
10
+ gem 'cucumber', '>= 4.0', '< 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', '~> 1.7.0'
17
- gem 'rubocop-performance', '~> 1.9.1'
18
- gem 'rubocop-rspec', '~> 2.1.0'
19
- gem 'simplecov', ['>= 0.18.0', '< 0.21.0']
16
+ gem 'rubocop', '~> 1.24.0'
17
+ gem 'rubocop-performance', '~> 1.13.1'
18
+ gem 'rubocop-rspec', '~> 2.7.0'
19
+ gem 'simplecov', ['>= 0.18.0', '< 0.22.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.13.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.4 to 2.7 and for JRuby 9.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
 
@@ -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
@@ -30,7 +30,7 @@ module Reek
30
30
  SexpExtensions.const_get(const)
31
31
  ]
32
32
  end
33
- Hash[assoc]
33
+ assoc.to_h
34
34
  end
35
35
  end
36
36
 
@@ -104,6 +104,17 @@ 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
107
118
  end
108
119
  end
109
120
  end
@@ -10,7 +10,7 @@ module Reek
10
10
  end
11
11
 
12
12
  def body_nodes(type, ignoring = [])
13
- children[1..-1].compact.flat_map do |child|
13
+ children[1..].compact.flat_map do |child|
14
14
  child.each_node(type, ignoring | type).to_a
15
15
  end
16
16
  end
@@ -31,7 +31,7 @@ module Reek
31
31
 
32
32
  # @quality :reek:FeatureEnvy
33
33
  def body_nodes(type, ignoring = [])
34
- children[1..-1].compact.flat_map do |child|
34
+ children[1..].compact.flat_map do |child|
35
35
  if ignoring.include? child.type
36
36
  []
37
37
  else
@@ -16,7 +16,7 @@ module Reek
16
16
  end
17
17
 
18
18
  def args
19
- children[2..-1]
19
+ children[2..]
20
20
  end
21
21
 
22
22
  def participants
@@ -24,7 +24,7 @@ module Reek
24
24
  else
25
25
  write_to_file
26
26
  puts "\n'#{DEFAULT_CONFIGURATION_FILE_NAME}' generated! "\
27
- 'You can now use this as a starting point.'
27
+ 'You can now use this as a starting point.'
28
28
  end
29
29
  options.success_exit_code
30
30
  end
@@ -232,7 +232,7 @@ module Reek
232
232
  puts "All available smell detectors:\n\n"
233
233
  puts DetectorRepository.available_detector_names
234
234
  puts "\nCheck out #{DocumentationLink.build('Code Smells')} "\
235
- 'for a details on each detector'
235
+ 'for a details on each detector'
236
236
  exit
237
237
  end
238
238
  parser.on_tail('-v', '--version', 'Show version') do
@@ -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
- original_comment: original_comment,
44
- line: line,
45
- source: source,
46
- options: options).validate
47
- @config.merge! detector_name => YAML.safe_load(options || DISABLE_DETECTOR_CONFIGURATION,
48
- permitted_classes: [Regexp])
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
 
@@ -422,7 +422,7 @@ module Reek
422
422
  # See `process_rescue` for additional reference.
423
423
  #
424
424
  def process_resbody(exp, _parent)
425
- increase_statement_count_by(exp.children[1..-1].compact)
425
+ increase_statement_count_by(exp.children[1..].compact)
426
426
  process(exp)
427
427
  end
428
428
 
@@ -88,7 +88,7 @@ module Reek
88
88
  def source_files=(files)
89
89
  unless files.is_a?(String) || files.is_a?(FileList)
90
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'"
91
+ " a glob pattern, e.g. '{app,lib,spec}/**/*.rb'"
92
92
  end
93
93
  @source_files = FileList[files]
94
94
  end
@@ -57,9 +57,7 @@ module Reek
57
57
  end
58
58
 
59
59
  def configuration
60
- @configuration ||= begin
61
- CodeClimateConfiguration.load
62
- end
60
+ @configuration ||= CodeClimateConfiguration.load
63
61
  end
64
62
  end
65
63
  end
@@ -90,7 +90,7 @@ module Reek
90
90
 
91
91
  class << self
92
92
  def smell_type
93
- @smell_type ||= name.split(/::/).last
93
+ @smell_type ||= name.split('::').last
94
94
  end
95
95
 
96
96
  def contexts
@@ -59,7 +59,7 @@ module Reek
59
59
 
60
60
  # @public
61
61
  def to_hash
62
- stringified_params = Hash[parameters.map { |key, val| [key.to_s, val] }]
62
+ stringified_params = parameters.transform_keys(&:to_s)
63
63
  base_hash.merge(stringified_params)
64
64
  end
65
65
 
@@ -62,10 +62,8 @@ module Reek
62
62
 
63
63
  false
64
64
  end
65
- elsif path_excluded?(path)
66
- true
67
65
  else
68
- false
66
+ path_excluded?(path)
69
67
  end
70
68
  end
71
69
 
@@ -70,18 +70,20 @@ module Reek
70
70
 
71
71
  def set_failure_messages_for_smell_type
72
72
  self.failure_message = "Expected #{origin} to reek of #{smell_type}, "\
73
- 'but it didn\'t'
73
+ 'but it didn\'t'
74
74
  self.failure_message_when_negated = "Expected #{origin} not to reek "\
75
- "of #{smell_type}, but it did"
75
+ "of #{smell_type}, but it did"
76
76
  end
77
77
 
78
78
  def set_failure_messages_for_smell_details
79
- self.failure_message = "Expected #{origin} to reek of #{smell_type} "\
79
+ self.failure_message =
80
+ "Expected #{origin} to reek of #{smell_type} "\
80
81
  "(which it did) with smell details #{smell_details}, which it didn't.\n"\
81
82
  "The number of smell details I had to compare with the given one was #{matching_smell_types.count} "\
82
83
  "and here they are:\n"\
83
84
  "#{all_relevant_smell_details_formatted}"
84
- self.failure_message_when_negated = "Expected #{origin} not to reek of "\
85
+ self.failure_message_when_negated =
86
+ "Expected #{origin} not to reek of "\
85
87
  "#{smell_type} with smell details #{smell_details}, but it did"
86
88
  end
87
89
 
data/lib/reek/version.rb CHANGED
@@ -3,11 +3,11 @@
3
3
  # @public
4
4
  module Reek
5
5
  #
6
- # This module holds the Reek version informations
6
+ # This module holds the Reek version information
7
7
  #
8
8
  # @public
9
9
  module Version
10
10
  # @public
11
- STRING = '6.0.3'
11
+ STRING = '6.1.0'
12
12
  end
13
13
  end
data/reek.gemspec CHANGED
@@ -1,34 +1,37 @@
1
- require File.join(File.dirname(__FILE__), 'lib/reek/version')
1
+ require_relative 'lib/reek/version'
2
2
 
3
- Gem::Specification.new do |s|
4
- s.name = 'reek'
5
- s.version = Reek::Version::STRING
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'reek'
5
+ spec.version = Reek::Version::STRING
6
+ spec.authors = ['Kevin Rutherford', 'Timo Roessner', 'Matijs van Zuijlen', 'Piotr Szotkowski']
7
+ spec.email = ['timo.roessner@googlemail.com']
6
8
 
7
- s.authors = ['Kevin Rutherford', 'Timo Roessner', 'Matijs van Zuijlen', 'Piotr Szotkowski']
8
- s.description =
9
+ spec.summary = 'Code smell detector for Ruby'
10
+ spec.description =
9
11
  'Reek is a tool that examines Ruby classes, modules and methods and reports ' \
10
12
  'any code smells it finds.'
13
+ spec.homepage = 'https://github.com/troessner/reek'
14
+ spec.license = 'MIT'
11
15
 
12
- s.license = 'MIT'
13
- s.email = ['timo.roessner@googlemail.com']
14
- s.extra_rdoc_files = ['CHANGELOG.md', 'License.txt']
15
- s.files = `git ls-files -z`.split("\0")
16
- s.executables = s.files.grep(%r{^bin/}).map { |path| File.basename(path) }
17
- s.homepage = 'https://github.com/troessner/reek'
18
- s.rdoc_options = %w(--main README.md -x assets/|bin/|config/|features/|spec/|tasks/)
19
- s.required_ruby_version = '>= 2.4.0'
20
- s.summary = 'Code smell detector for Ruby'
16
+ spec.extra_rdoc_files = ['CHANGELOG.md', 'License.txt']
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|samples|docs|tasks)/}) }
19
+ end
21
20
 
22
- s.metadata = {
23
- 'homepage_uri' => 'https://github.com/troessner/reek',
24
- 'source_code_uri' => 'https://github.com/troessner/reek',
25
- 'bug_tracker_uri' => 'https://github.com/troessner/reek/issues',
26
- 'changelog_uri' => 'https://github.com/troessner/reek/CHANGELOG.md',
27
- 'documentation_uri' => 'https://www.rubydoc.info/gems/reek'
21
+ spec.executables = spec.files.grep(%r{^bin/}).map { |path| File.basename(path) }
22
+ spec.rdoc_options = %w(--main README.md -x assets/|bin/|config/|features/|spec/|tasks/)
23
+ spec.required_ruby_version = '>= 2.6.0'
24
+
25
+ spec.metadata = {
26
+ 'homepage_uri' => 'https://github.com/troessner/reek',
27
+ 'source_code_uri' => 'https://github.com/troessner/reek',
28
+ 'bug_tracker_uri' => 'https://github.com/troessner/reek/issues',
29
+ 'changelog_uri' => 'https://github.com/troessner/reek/CHANGELOG.md',
30
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/reek',
31
+ 'rubygems_mfa_required' => 'true'
28
32
  }
29
33
 
30
- s.add_runtime_dependency 'kwalify', '~> 0.7.0'
31
- s.add_runtime_dependency 'parser', '~> 3.0.0'
32
- s.add_runtime_dependency 'psych', '~> 3.1'
33
- s.add_runtime_dependency 'rainbow', '>= 2.0', '< 4.0'
34
+ spec.add_runtime_dependency 'kwalify', '~> 0.7.0'
35
+ spec.add_runtime_dependency 'parser', '~> 3.1.0'
36
+ spec.add_runtime_dependency 'rainbow', '>= 2.0', '< 4.0'
34
37
  end