reek 4.8.1 → 5.6.0

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.
Files changed (280) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +22 -68
  3. data/.rubocop_todo.yml +63 -0
  4. data/.simplecov +8 -2
  5. data/.travis.yml +8 -8
  6. data/.yardopts +1 -1
  7. data/CHANGELOG.md +84 -0
  8. data/CONTRIBUTING.md +25 -0
  9. data/Dockerfile +1 -1
  10. data/Gemfile +14 -18
  11. data/README.md +152 -135
  12. data/Rakefile +16 -3
  13. data/bin/reek +1 -3
  14. data/docs/API.md +6 -13
  15. data/docs/Basic-Smell-Options.md +51 -11
  16. data/docs/Code-Smells.md +1 -1
  17. data/docs/Command-Line-Options.md +14 -4
  18. data/docs/Duplicate-Method-Call.md +117 -2
  19. data/docs/Feature-Envy.md +44 -0
  20. data/docs/How-To-Write-New-Detectors.md +6 -7
  21. data/docs/Instance-Variable-Assumption.md +30 -1
  22. data/docs/{Prima-Donna-Method.md → Missing-Safe-Method.md} +11 -9
  23. data/docs/Rake-Task.md +1 -1
  24. data/docs/Reek-4-to-Reek-5-migration.md +188 -0
  25. data/docs/Reek-Driven-Development.md +19 -12
  26. data/docs/Uncommunicative-Method-Name.md +45 -6
  27. data/docs/Uncommunicative-Module-Name.md +49 -7
  28. data/docs/Uncommunicative-Parameter-Name.md +43 -5
  29. data/docs/Uncommunicative-Variable-Name.md +73 -2
  30. data/docs/Unused-Private-Method.md +1 -1
  31. data/docs/defaults.reek.yml +129 -0
  32. data/docs/templates/default/docstring/setup.rb +3 -0
  33. data/docs/yard_plugin.rb +1 -0
  34. data/features/command_line_interface/basic_usage.feature +2 -2
  35. data/features/command_line_interface/options.feature +49 -5
  36. data/features/command_line_interface/show_progress.feature +4 -4
  37. data/features/command_line_interface/smell_selection.feature +1 -1
  38. data/features/command_line_interface/smells_count.feature +6 -6
  39. data/features/command_line_interface/stdin.feature +30 -8
  40. data/features/configuration_files/accept_setting.feature +45 -28
  41. data/features/configuration_files/directory_specific_directives.feature +78 -73
  42. data/features/configuration_files/exclude_directives.feature +11 -10
  43. data/features/configuration_files/exclude_paths_directives.feature +12 -13
  44. data/features/configuration_files/masking_smells.feature +38 -9
  45. data/features/configuration_files/mix_accept_reject_setting.feature +31 -28
  46. data/features/configuration_files/reject_setting.feature +52 -41
  47. data/features/configuration_files/schema_validation.feature +59 -0
  48. data/features/configuration_files/show_configuration_file.feature +44 -0
  49. data/features/configuration_files/unused_private_method.feature +18 -16
  50. data/features/configuration_loading.feature +53 -10
  51. data/features/configuration_via_source_comments/erroneous_source_comments.feature +2 -2
  52. data/features/configuration_via_source_comments/well_formed_source_comments.feature +2 -2
  53. data/features/locales.feature +2 -2
  54. data/features/rake_task/rake_task.feature +16 -16
  55. data/features/reports/json.feature +3 -3
  56. data/features/reports/reports.feature +34 -34
  57. data/features/reports/yaml.feature +3 -3
  58. data/features/rspec_matcher.feature +10 -1
  59. data/features/samples.feature +287 -287
  60. data/features/step_definitions/reek_steps.rb +4 -0
  61. data/features/step_definitions/sample_file_steps.rb +20 -11
  62. data/features/support/env.rb +3 -3
  63. data/features/todo_list.feature +60 -44
  64. data/lib/reek/ast/node.rb +7 -6
  65. data/lib/reek/ast/object_refs.rb +1 -1
  66. data/lib/reek/ast/sexp_extensions/case.rb +3 -1
  67. data/lib/reek/ast/sexp_extensions/if.rb +22 -2
  68. data/lib/reek/ast/sexp_extensions/logical_operators.rb +1 -1
  69. data/lib/reek/ast/sexp_extensions/methods.rb +2 -1
  70. data/lib/reek/ast/sexp_extensions/yield.rb +0 -4
  71. data/lib/reek/ast/sexp_extensions.rb +0 -2
  72. data/lib/reek/cli/application.rb +29 -3
  73. data/lib/reek/cli/command/report_command.rb +1 -2
  74. data/lib/reek/cli/command/todo_list_command.rb +25 -8
  75. data/lib/reek/cli/options.rb +49 -27
  76. data/lib/reek/cli/silencer.rb +14 -3
  77. data/lib/reek/code_comment.rb +33 -33
  78. data/lib/reek/configuration/app_configuration.rb +29 -28
  79. data/lib/reek/configuration/configuration_converter.rb +110 -0
  80. data/lib/reek/configuration/configuration_file_finder.rb +15 -40
  81. data/lib/reek/configuration/configuration_validator.rb +12 -23
  82. data/lib/reek/configuration/default_directive.rb +17 -3
  83. data/lib/reek/configuration/directory_directives.rb +46 -12
  84. data/lib/reek/configuration/excluded_paths.rb +4 -4
  85. data/lib/reek/configuration/rake_task_converter.rb +29 -0
  86. data/lib/reek/configuration/schema.yml +210 -0
  87. data/lib/reek/configuration/schema_validator.rb +39 -0
  88. data/lib/reek/context/attribute_context.rb +1 -1
  89. data/lib/reek/context/code_context.rb +4 -4
  90. data/lib/reek/context/method_context.rb +3 -2
  91. data/lib/reek/context/module_context.rb +6 -5
  92. data/lib/reek/context/visibility_tracker.rb +7 -4
  93. data/lib/reek/context_builder.rb +10 -9
  94. data/lib/reek/detector_repository.rb +7 -0
  95. data/lib/reek/documentation_link.rb +28 -0
  96. data/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb +4 -3
  97. data/lib/reek/errors/bad_detector_in_comment_error.rb +4 -3
  98. data/lib/reek/errors/config_file_error.rb +11 -0
  99. data/lib/reek/errors/encoding_error.rb +2 -2
  100. data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +4 -3
  101. data/lib/reek/errors/incomprehensible_source_error.rb +4 -4
  102. data/lib/reek/errors/syntax_error.rb +45 -0
  103. data/lib/reek/examiner.rb +14 -23
  104. data/lib/reek/logging_error_handler.rb +1 -1
  105. data/lib/reek/rake/task.rb +3 -3
  106. data/lib/reek/report/base_report.rb +8 -12
  107. data/lib/reek/report/code_climate/code_climate_configuration.yml +6 -10
  108. data/lib/reek/report/documentation_link_warning_formatter.rb +17 -0
  109. data/lib/reek/report/heading_formatter.rb +54 -0
  110. data/lib/reek/report/json_report.rb +1 -1
  111. data/lib/reek/report/location_formatter.rb +40 -0
  112. data/lib/reek/report/progress_formatter.rb +79 -0
  113. data/lib/reek/report/simple_warning_formatter.rb +34 -0
  114. data/lib/reek/report/text_report.rb +4 -4
  115. data/lib/reek/report/xml_report.rb +3 -3
  116. data/lib/reek/report/yaml_report.rb +1 -1
  117. data/lib/reek/report.rb +20 -15
  118. data/lib/reek/smell_configuration.rb +2 -2
  119. data/lib/reek/smell_detectors/attribute.rb +0 -1
  120. data/lib/reek/smell_detectors/base_detector.rb +10 -13
  121. data/lib/reek/smell_detectors/boolean_parameter.rb +0 -1
  122. data/lib/reek/smell_detectors/class_variable.rb +0 -1
  123. data/lib/reek/smell_detectors/control_parameter.rb +19 -128
  124. data/lib/reek/smell_detectors/control_parameter_helpers/call_in_condition_finder.rb +91 -0
  125. data/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb +38 -0
  126. data/lib/reek/smell_detectors/control_parameter_helpers/control_parameter_finder.rb +94 -0
  127. data/lib/reek/smell_detectors/data_clump.rb +4 -5
  128. data/lib/reek/smell_detectors/duplicate_method_call.rb +6 -6
  129. data/lib/reek/smell_detectors/feature_envy.rb +3 -1
  130. data/lib/reek/smell_detectors/instance_variable_assumption.rb +0 -1
  131. data/lib/reek/smell_detectors/irresponsible_module.rb +1 -1
  132. data/lib/reek/smell_detectors/long_parameter_list.rb +2 -2
  133. data/lib/reek/smell_detectors/long_yield_list.rb +2 -3
  134. data/lib/reek/smell_detectors/manual_dispatch.rb +3 -2
  135. data/lib/reek/smell_detectors/{prima_donna_method.rb → missing_safe_method.rb} +7 -7
  136. data/lib/reek/smell_detectors/module_initialize.rb +0 -1
  137. data/lib/reek/smell_detectors/nested_iterators.rb +5 -5
  138. data/lib/reek/smell_detectors/nil_check.rb +0 -1
  139. data/lib/reek/smell_detectors/repeated_conditional.rb +4 -4
  140. data/lib/reek/smell_detectors/subclassed_from_core_class.rb +3 -8
  141. data/lib/reek/smell_detectors/too_many_constants.rb +2 -3
  142. data/lib/reek/smell_detectors/too_many_instance_variables.rb +2 -2
  143. data/lib/reek/smell_detectors/too_many_methods.rb +2 -2
  144. data/lib/reek/smell_detectors/too_many_statements.rb +2 -2
  145. data/lib/reek/smell_detectors/uncommunicative_method_name.rb +2 -3
  146. data/lib/reek/smell_detectors/uncommunicative_module_name.rb +2 -3
  147. data/lib/reek/smell_detectors/uncommunicative_parameter_name.rb +2 -3
  148. data/lib/reek/smell_detectors/uncommunicative_variable_name.rb +6 -5
  149. data/lib/reek/smell_detectors/unused_parameters.rb +1 -1
  150. data/lib/reek/smell_detectors/unused_private_method.rb +0 -1
  151. data/lib/reek/smell_detectors/utility_function.rb +1 -2
  152. data/lib/reek/smell_detectors.rb +1 -2
  153. data/lib/reek/smell_warning.rb +31 -20
  154. data/lib/reek/source/source_code.rb +42 -56
  155. data/lib/reek/source/source_locator.rb +10 -7
  156. data/lib/reek/spec/should_reek.rb +2 -2
  157. data/lib/reek/spec/should_reek_of.rb +9 -16
  158. data/lib/reek/spec/should_reek_only_of.rb +5 -4
  159. data/lib/reek/spec/smell_matcher.rb +1 -0
  160. data/lib/reek/spec.rb +8 -14
  161. data/lib/reek/tree_dresser.rb +6 -5
  162. data/lib/reek/version.rb +1 -1
  163. data/lib/reek.rb +7 -0
  164. data/reek.gemspec +5 -4
  165. data/samples/checkstyle.xml +1 -1
  166. data/samples/configuration/accepts_rejects_and_excludes_for_detectors.reek.yml +29 -0
  167. data/samples/configuration/accepts_rejects_and_excludes_for_directory_directives.reek.yml +30 -0
  168. data/samples/configuration/full_configuration.reek +8 -4
  169. data/samples/configuration/full_mask.reek +5 -4
  170. data/samples/configuration/partial_mask.reek +3 -2
  171. data/samples/configuration/regular_configuration/.reek.yml +4 -0
  172. data/samples/configuration/with_excluded_paths.reek +1 -0
  173. data/samples/paths.rb +5 -4
  174. data/samples/smelly_source/ruby.rb +368 -0
  175. data/samples/{source_with_hidden_directories/.hidden/uncommunicative_method_name.rb → source_with_exclude_paths/nested/uncommunicative_variable_name.rb} +2 -1
  176. data/samples/source_with_hidden_directories/.hidden/hidden.rb +1 -0
  177. data/samples/source_with_hidden_directories/not_hidden.rb +1 -0
  178. data/spec/factories/factories.rb +12 -22
  179. data/spec/performance/reek/smell_detectors/runtime_speed_spec.rb +17 -0
  180. data/spec/quality/documentation_spec.rb +40 -0
  181. data/spec/reek/ast/node_spec.rb +7 -7
  182. data/spec/reek/ast/sexp_extensions_spec.rb +20 -20
  183. data/spec/reek/cli/application_spec.rb +48 -5
  184. data/spec/reek/cli/command/todo_list_command_spec.rb +65 -45
  185. data/spec/reek/cli/silencer_spec.rb +28 -0
  186. data/spec/reek/code_comment_spec.rb +6 -13
  187. data/spec/reek/configuration/app_configuration_spec.rb +106 -45
  188. data/spec/reek/configuration/configuration_file_finder_spec.rb +143 -49
  189. data/spec/reek/configuration/default_directive_spec.rb +1 -1
  190. data/spec/reek/configuration/directory_directives_spec.rb +45 -7
  191. data/spec/reek/configuration/excluded_paths_spec.rb +6 -9
  192. data/spec/reek/configuration/rake_task_converter_spec.rb +33 -0
  193. data/spec/reek/configuration/schema_validator_spec.rb +165 -0
  194. data/spec/reek/context/code_context_spec.rb +3 -3
  195. data/spec/reek/context_builder_spec.rb +30 -30
  196. data/spec/reek/detector_repository_spec.rb +2 -2
  197. data/spec/reek/documentation_link_spec.rb +20 -0
  198. data/spec/reek/examiner_spec.rb +39 -11
  199. data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +22 -22
  200. data/spec/reek/report/code_climate/code_climate_formatter_spec.rb +5 -5
  201. data/spec/reek/report/code_climate/code_climate_report_spec.rb +21 -21
  202. data/spec/reek/report/json_report_spec.rb +16 -49
  203. data/spec/reek/report/{formatter/location_formatter_spec.rb → location_formatter_spec.rb} +5 -5
  204. data/spec/reek/report/{formatter/progress_formatter_spec.rb → progress_formatter_spec.rb} +4 -4
  205. data/spec/reek/report/text_report_spec.rb +3 -9
  206. data/spec/reek/report/xml_report_spec.rb +1 -1
  207. data/spec/reek/report/yaml_report_spec.rb +12 -41
  208. data/spec/reek/report_spec.rb +3 -3
  209. data/spec/reek/smell_configuration_spec.rb +2 -0
  210. data/spec/reek/smell_detectors/attribute_spec.rb +32 -32
  211. data/spec/reek/smell_detectors/base_detector_spec.rb +3 -6
  212. data/spec/reek/smell_detectors/boolean_parameter_spec.rb +4 -4
  213. data/spec/reek/smell_detectors/class_variable_spec.rb +16 -16
  214. data/spec/reek/smell_detectors/control_parameter_spec.rb +33 -16
  215. data/spec/reek/smell_detectors/data_clump_spec.rb +16 -16
  216. data/spec/reek/smell_detectors/duplicate_method_call_spec.rb +20 -20
  217. data/spec/reek/smell_detectors/feature_envy_spec.rb +71 -26
  218. data/spec/reek/smell_detectors/instance_variable_assumption_spec.rb +12 -12
  219. data/spec/reek/smell_detectors/irresponsible_module_spec.rb +36 -36
  220. data/spec/reek/smell_detectors/long_parameter_list_spec.rb +6 -6
  221. data/spec/reek/smell_detectors/long_yield_list_spec.rb +6 -6
  222. data/spec/reek/smell_detectors/manual_dispatch_spec.rb +10 -10
  223. data/spec/reek/smell_detectors/{prima_donna_method_spec.rb → missing_safe_method_spec.rb} +17 -17
  224. data/spec/reek/smell_detectors/module_initialize_spec.rb +12 -12
  225. data/spec/reek/smell_detectors/nested_iterators_spec.rb +48 -48
  226. data/spec/reek/smell_detectors/nil_check_spec.rb +16 -16
  227. data/spec/reek/smell_detectors/repeated_conditional_spec.rb +8 -8
  228. data/spec/reek/smell_detectors/subclassed_from_core_class_spec.rb +10 -10
  229. data/spec/reek/smell_detectors/too_many_constants_spec.rb +25 -25
  230. data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +17 -17
  231. data/spec/reek/smell_detectors/too_many_methods_spec.rb +6 -6
  232. data/spec/reek/smell_detectors/too_many_statements_spec.rb +10 -10
  233. data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +8 -8
  234. data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +8 -6
  235. data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +11 -9
  236. data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +24 -24
  237. data/spec/reek/smell_detectors/unused_parameters_spec.rb +4 -4
  238. data/spec/reek/smell_detectors/unused_private_method_spec.rb +25 -25
  239. data/spec/reek/smell_detectors/utility_function_spec.rb +30 -30
  240. data/spec/reek/smell_warning_spec.rb +21 -28
  241. data/spec/reek/source/source_code_spec.rb +16 -22
  242. data/spec/reek/source/source_locator_spec.rb +16 -17
  243. data/spec/reek/spec/should_reek_of_spec.rb +2 -6
  244. data/spec/reek/spec/should_reek_only_of_spec.rb +8 -15
  245. data/spec/reek/spec/should_reek_spec.rb +1 -1
  246. data/spec/reek/spec/smell_matcher_spec.rb +1 -2
  247. data/spec/reek/tree_dresser_spec.rb +2 -6
  248. data/spec/spec_helper.rb +5 -5
  249. data/tasks/configuration.rake +9 -5
  250. data/tasks/test.rake +4 -0
  251. metadata +89 -43
  252. data/.codeclimate.yml +0 -21
  253. data/ataru_setup.rb +0 -13
  254. data/defaults.reek +0 -131
  255. data/features/configuration_files/warn_about_multiple_configuration_files.feature +0 -44
  256. data/lib/reek/ast/sexp_extensions/attribute_assignments.rb +0 -14
  257. data/lib/reek/ast/sexp_extensions/literal.rb +0 -14
  258. data/lib/reek/report/formatter/heading_formatter.rb +0 -52
  259. data/lib/reek/report/formatter/location_formatter.rb +0 -42
  260. data/lib/reek/report/formatter/progress_formatter.rb +0 -81
  261. data/lib/reek/report/formatter/simple_warning_formatter.rb +0 -35
  262. data/lib/reek/report/formatter/wiki_link_warning_formatter.rb +0 -36
  263. data/lib/reek/report/formatter.rb +0 -33
  264. data/lib/reek/smell_detectors/syntax.rb +0 -37
  265. data/samples/configuration/non_public_modifiers_mask.reek +0 -3
  266. data/samples/smelly_with_inline_mask.rb +0 -8
  267. data/samples/smelly_with_modifiers.rb +0 -12
  268. data/samples/source_with_non_ruby_files/uncommunicative_parameter_name.rb +0 -6
  269. data/spec/reek/smell_detectors/syntax_spec.rb +0 -17
  270. data/tasks/ataru.rake +0 -5
  271. /data/{samples/configuration/more_than_one_configuration_file/regular.reek → .reek.yml} +0 -0
  272. /data/samples/{clean.rb → clean_source/clean.rb} +0 -0
  273. /data/samples/{exceptions.reek → configuration/home/home.reek.yml} +0 -0
  274. /data/samples/configuration/{more_than_one_configuration_file/todo.reek → regular_configuration/empty_sub_directory/.gitignore} +0 -0
  275. /data/samples/{configuration/single_configuration_file/.reek → no_config_file/.keep} +0 -0
  276. /data/samples/{inline.rb → smelly_source/inline.rb} +0 -0
  277. /data/samples/{optparse.rb → smelly_source/optparse.rb} +0 -0
  278. /data/samples/{redcloth.rb → smelly_source/redcloth.rb} +0 -0
  279. /data/samples/{smelly.rb → smelly_source/smelly.rb} +0 -0
  280. /data/samples/{source_with_hidden_directories/uncommunicative_parameter_name.rb → source_with_non_ruby_files/ruby.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d66c9a36e561c26a8a5cd27af9780ded54de1fdfe9b00b289701027403330b3
4
- data.tar.gz: 592050ff0e9af5744467c2299cb085246059fbdc96358dbadbad68a0f2e36763
3
+ metadata.gz: da76dfc3aa1c997bffe832e526907dcf847cb5d86e04bc7c084abe074247e5d7
4
+ data.tar.gz: 7abc545f4176d0f561797c092bea15f1630b824a3d3ba37b99975450eb3ec3df
5
5
  SHA512:
6
- metadata.gz: 431ee00e3a0021baa1c752d0a2393b84bdf873d7be702c428f57b1b538ff9dceb11957551674be4031ddd26d9ddb7aa9a01a00b84aa53cd1650f76f045243370
7
- data.tar.gz: 58c93de891eec497652eda081101a7b77a93eee296c4824b379beb4982de4064c9488d67fa9dd9fe2cfe822f428be305befd65a80b77fe5ec3eb2a4d428a3b5a
6
+ metadata.gz: 7fe6f93cf2fe75c232327e1250c4e72c10c88707ce57879341f43b5a8a195ddb0282d9433e60cb19f635923edcb3fa52bbaadb187b5ee67d4b4cea7fc72ce901
7
+ data.tar.gz: a55abca10a6875077fda0b873667407f1dddf1840963fd6463ed918db9d9e58408fa93acf5a7e4741d9d488dede75963ad422c2150953e3d69f7af840a563dfd
data/.rubocop.yml CHANGED
@@ -1,12 +1,21 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  require:
2
4
  - rubocop-rspec
5
+ - rubocop-performance
3
6
 
4
7
  AllCops:
5
8
  Exclude:
6
9
  - 'samples/**/*'
7
10
  - 'tmp/**/*'
8
11
  - 'vendor/**/*'
9
- TargetRubyVersion: 2.1
12
+ TargetRubyVersion: 2.3
13
+
14
+ # Tables are nice
15
+ Layout/HashAlignment:
16
+ EnforcedColonStyle: table
17
+ EnforcedHashRocketStyle: table
18
+ EnforcedLastArgumentHashStyle: ignore_implicit
10
19
 
11
20
  # Place . on the previous line
12
21
  Layout/DotPosition:
@@ -16,9 +25,9 @@ Layout/DotPosition:
16
25
  Layout/EmptyLineBetweenDefs:
17
26
  AllowAdjacentOneLineDefs: true
18
27
 
19
- # Use active_support's strip_heredoc to indent heredocs
20
- Layout/IndentHeredoc:
21
- EnforcedStyle: active_support
28
+ # Be rather lenient with line length
29
+ Layout/LineLength:
30
+ Max: 120
22
31
 
23
32
  # Always put the closing brace on the last line
24
33
  Layout/MultilineMethodCallBraceLayout:
@@ -45,81 +54,28 @@ Lint/InterpolationCheck:
45
54
  Lint/BooleanSymbol:
46
55
  Enabled: false
47
56
 
48
- Lint/HandleExceptions:
49
- Exclude:
50
- - 'spec/reek/configuration/configuration_file_finder_spec.rb'
51
-
52
57
  # Spec blocks can be any size
53
58
  Metrics/BlockLength:
54
59
  Exclude:
55
60
  - 'spec/**/*'
56
61
 
57
- # FIXME: Make the class shorter
58
- Metrics/ClassLength:
59
- Exclude:
60
- - lib/reek/context_builder.rb
61
- - lib/reek/cli/options.rb
62
-
63
- # FIXME: Lower the method length by fixing the biggest offenders
64
- Metrics/MethodLength:
65
- Max: 15
66
-
67
- # Be rather lenient with line length
68
- Metrics/LineLength:
69
- Max: 120
70
-
71
62
  # Keyword arguments make long parameter lists readable
72
63
  Metrics/ParameterLists:
73
64
  CountKeywordArgs: false
74
65
 
75
- Naming/AccessorMethodName:
76
- Exclude:
77
- - 'lib/reek/context/visibility_tracker.rb'
78
-
79
- # EOS is a fine name to use in our specs
80
- Naming/HeredocDelimiterNaming:
81
- Exclude:
82
- - 'spec/**/*'
83
-
84
- # FIXME: Update specs to avoid offenses
85
- RSpec/AnyInstance:
86
- Exclude:
87
- - 'spec/reek/cli/application_spec.rb'
66
+ Naming/RescuedExceptionsVariableName:
67
+ PreferredName: error
88
68
 
89
- # This file does not test a class
69
+ # These files do not test classes or modules
90
70
  RSpec/DescribeClass:
91
71
  Exclude:
92
- - 'spec/quality/reek_source_spec.rb'
72
+ - 'spec/quality/*_spec.rb'
73
+ - 'spec/performance/reek/smell_detectors/runtime_speed_spec.rb'
93
74
 
94
75
  # Our examples are large because we have source literals in them
95
76
  RSpec/ExampleLength:
96
77
  Enabled: false
97
78
 
98
- # FIXME: Split up files to avoid offenses
99
- RSpec/MultipleDescribes:
100
- Exclude:
101
- - 'spec/reek/ast/sexp_extensions_spec.rb'
102
- - 'spec/reek/code_comment_spec.rb'
103
- - 'spec/reek/report/formatter/location_formatter_spec.rb'
104
- - 'spec/reek/report/formatter/progress_formatter_spec.rb'
105
-
106
- # FIXME: Update specs to avoid offenses
107
- RSpec/MultipleExpectations:
108
- Exclude:
109
- - 'spec/reek/cli/application_spec.rb'
110
- - 'spec/reek/code_comment_spec.rb'
111
- - 'spec/reek/configuration/app_configuration_spec.rb'
112
- - 'spec/reek/context/module_context_spec.rb'
113
- - 'spec/reek/context_builder_spec.rb'
114
- - 'spec/reek/examiner_spec.rb'
115
- - 'spec/reek/spec/should_reek_of_spec.rb'
116
-
117
- # FIXME: Update specs to avoid offenses
118
- RSpec/NestedGroups:
119
- Exclude:
120
- - 'spec/reek/report/code_climate/code_climate_fingerprint_spec.rb'
121
- - 'spec/reek/cli/application_spec.rb'
122
-
123
79
  # rubocop-rspec expects a CodeClimate namespace to go with the code_climate directory.
124
80
  RSpec/FilePath:
125
81
  Exclude:
@@ -132,12 +88,6 @@ RSpec/FilePath:
132
88
  Style/AndOr:
133
89
  EnforcedStyle: conditionals
134
90
 
135
- Style/Documentation:
136
- Exclude:
137
- - 'lib/reek/ast/sexp_extensions/send.rb'
138
- - 'lib/reek/ast/sexp_extensions/super.rb'
139
- - 'lib/reek/ast/sexp_extensions/variables.rb'
140
-
141
91
  # Require comment for files in lib and bin
142
92
  Style/FrozenStringLiteralComment:
143
93
  Include:
@@ -176,3 +126,7 @@ Style/SymbolArray:
176
126
  # Allow small arrays of words with quotes
177
127
  Style/WordArray:
178
128
  MinSize: 4
129
+
130
+ Metrics/ClassLength:
131
+ Exclude:
132
+ - 'lib/reek/cli/options.rb'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,63 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-12-22 13:19:30 +0100 using RuboCop version 0.78.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ Metrics/AbcSize:
11
+ Max: 21
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 161
17
+
18
+ # Offense count: 14
19
+ # Configuration parameters: CountComments, ExcludedMethods.
20
+ Metrics/MethodLength:
21
+ Max: 16
22
+
23
+ # Offense count: 2
24
+ RSpec/AnyInstance:
25
+ Exclude:
26
+ - 'spec/reek/cli/application_spec.rb'
27
+
28
+ # Offense count: 1
29
+ # Configuration parameters: CustomIncludeMethods.
30
+ RSpec/EmptyExampleGroup:
31
+ Exclude:
32
+ - 'spec/factories/factories.rb'
33
+
34
+ # Offense count: 1
35
+ RSpec/MissingExampleGroupArgument:
36
+ Exclude:
37
+ - 'spec/factories/factories.rb'
38
+
39
+ # Offense count: 4
40
+ RSpec/MultipleDescribes:
41
+ Exclude:
42
+ - 'spec/reek/ast/sexp_extensions_spec.rb'
43
+ - 'spec/reek/code_comment_spec.rb'
44
+ - 'spec/reek/report/location_formatter_spec.rb'
45
+ - 'spec/reek/report/progress_formatter_spec.rb'
46
+
47
+ # Offense count: 32
48
+ # Configuration parameters: AggregateFailuresByDefault.
49
+ RSpec/MultipleExpectations:
50
+ Max: 5
51
+
52
+ # Offense count: 25
53
+ RSpec/NestedGroups:
54
+ Max: 5
55
+
56
+ # Offense count: 2
57
+ # Cop supports --auto-correct.
58
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
59
+ # AllowedMethods: present?, blank?, presence, try, try!
60
+ Style/SafeNavigation:
61
+ Exclude:
62
+ - 'lib/reek/ast/node.rb'
63
+ - 'lib/reek/ast/sexp_extensions/module.rb'
data/.simplecov CHANGED
@@ -1,10 +1,16 @@
1
1
  SimpleCov.start do
2
2
  track_files 'lib/**/*.rb'
3
3
  add_filter 'lib/reek/version.rb' # version.rb is loaded too early to test
4
+ add_filter 'lib/reek/cli/options.rb' # tested mostly via integration tests
5
+ add_filter 'spec/'
6
+ add_filter 'samples/'
7
+ coverage_dir 'tmp/coverage'
4
8
  end
5
9
 
6
10
  SimpleCov.at_exit do
7
11
  SimpleCov.result.format!
8
- SimpleCov.minimum_coverage 98.9
9
- SimpleCov.minimum_coverage_by_file 81.4
12
+ unless RUBY_ENGINE == 'jruby'
13
+ SimpleCov.minimum_coverage 98.88
14
+ SimpleCov.minimum_coverage_by_file 81.4
15
+ end
10
16
  end
data/.travis.yml CHANGED
@@ -1,25 +1,25 @@
1
- sudo: false
2
1
  dist: trusty
3
2
  cache: bundler
4
3
  language: ruby
5
- before_install:
6
- - gem update --system
7
- - gem install bundler
8
4
  bundler_args: --without debugging
5
+ before_script:
6
+ # Avoid Java announcing _JAVA_OPTIONS environment variable
7
+ # See https://github.com/travis-ci/travis-ci/issues/8408
8
+ - unset _JAVA_OPTIONS
9
9
  script: bundle exec rake ci
10
10
  rvm:
11
- - 2.1
12
- - 2.2
13
11
  - 2.3
14
12
  - 2.4
15
13
  - 2.5
16
- - jruby-9.1.15.0
14
+ - 2.6
15
+ - 2.7
16
+ - jruby-9.1.17.0
17
+ - jruby-9.2.6.0
17
18
  - jruby-head
18
19
  - ruby-head
19
20
  - rubinius-3
20
21
  matrix:
21
22
  allow_failures:
22
- - rvm: jruby-9.1.15.0
23
23
  - rvm: jruby-head
24
24
  - rvm: ruby-head
25
25
  - rvm: rubinius-3
data/.yardopts CHANGED
@@ -1,4 +1,4 @@
1
- --no-private
1
+ --private
2
2
  --readme README.md
3
3
  --load ./docs/yard_plugin.rb
4
4
  -
data/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # Change log
2
2
 
3
+ ## 5.6.0 (2020-01-20)
4
+
5
+ * (mvz) Support Ruby 2.7
6
+ * (mvz) Loosen parser dependency to allow version 2.7.x
7
+
8
+ ## 5.5.0 (2019-11-13)
9
+
10
+ * (mvz) Use the Parser class matching current ruby for parsing, instead of
11
+ always picking version 2.6.
12
+
13
+ ## 5.4.1 (2019-11-12)
14
+
15
+ * (Filipe Esperandio) Bump base Docker image to a more recent ruby version
16
+ * (Fernando Contreras) Add quotes inside directory configuration example in
17
+ README
18
+
19
+ ## 5.4.0 (2019-04-24)
20
+
21
+ * (Philippe Bernery) Enable regex for directory directives.
22
+
23
+ ## 5.3.2 (2019-03-22)
24
+
25
+ * (troessner) Use Parser26.
26
+
27
+ ## 5.3.1 (2019-02-08)
28
+
29
+ * (Al Snow) Upgrade parser dependency
30
+
31
+ ## 5.3.0 (2018-12-28)
32
+
33
+ * (mvz) Add support for Ruby 2.6.
34
+ * (mvz) Add support for JRuby 9.1 and 9.2
35
+
36
+ ## 5.2.0 (2018-10-13)
37
+
38
+ * (troessner) Enable exclusion of single files.
39
+
40
+ ## 5.1.0 (2018-09-22)
41
+
42
+ * (troessner) Simplify todo list feature.
43
+ * (troessner) Show configuration path.
44
+
45
+ ## 5.0.2 (2018-07-10)
46
+
47
+ * (mvz) Parser 2.5.1.1 seems broken. Disallow it.
48
+ * (mvz) Improve control parameter recursion performance.
49
+
50
+ ## 5.0.1 (2018-07-03)
51
+
52
+ * (troessner) Fix uninitialized constant error
53
+
54
+ ## 5.0.0 (2018-06-18)
55
+
56
+ *Breaking changes:*
57
+
58
+ * (David Fisher) Change PrimaDonnaMethod to MissingSafeMethod
59
+ * (mvz) Always include documentation in JSON and YAML
60
+ * (mvz) Remove Syntax smell detector
61
+ * (mvz) Remove deprecated Examiner#description (in favor of Examiner#origin)
62
+ * (mvz) Allow only detector names in configuration hash
63
+ * (mvz) Do not accept a class as parameter for reek_of
64
+ * (mvz) Allow only .reek.yml instead of any file name ending in .reek
65
+ * (troessner) Validate our configuration by using a schema
66
+ * (troessner) Scope detectors in the configuration under `detectors`
67
+ * (troessner) Move directory directives under a special key
68
+ * (troessner) Use strings not regexes in our configuration file
69
+ * (troessner) Replace `wiki-links` flag with `documentation` flag
70
+ * (troessner) Add yml extension to Reeks configuration file
71
+ * (troessner) Drop legacy code comment separator
72
+ * (troessner) Drop Ruby 2.2 support
73
+ * (troessner) Drop Ruby 2.1 support
74
+
75
+ *Non breaking changes:*
76
+
77
+ * (Paul Sadauskas) Add support for --stdin-filename
78
+ * (mvz) Generate versioned documentation links
79
+ * (mvz) Bugfix: Only report FeatureEnvy for instance methods
80
+ * (troessner) List all smells
81
+
82
+ ## 4.8.2 (2018-06-26)
83
+
84
+ * (mvz) Only report FeatureEnvy for instance methods
85
+ * (mvz) Generate versioned documentation links
86
+
3
87
  ## 4.8.1 (2018-04-12)
4
88
 
5
89
  * (mvz) Loosen dependency on rainbow
data/CONTRIBUTING.md CHANGED
@@ -89,6 +89,14 @@ class Alfa
89
89
  end
90
90
  ```
91
91
 
92
+ We also aim to make our specs as self-reliant as possible. They should not rely on external sample
93
+ or configuration files since that makes it very hard to reason about them and introduces a tight coupling
94
+ which makes refactoring more difficult.
95
+ Unfortunately our current specs are a bit misleading in this regard since they are often doing the
96
+ opposite, relying on external sample and configuration files (indicated by using
97
+ some of the constants defined in `samples/paths.rb`).
98
+ Our goal is to reverse this development.
99
+
92
100
  ### Cucumber Features
93
101
 
94
102
  Reek uses [Cucumber](https://cucumber.io/) with
@@ -182,3 +190,20 @@ We are following [semantic versioning](http://semver.org/).
182
190
  If you're working on a change that is breaking backwards-compatibility
183
191
  just go ahead with your pull request like normal. We'll discuss this then in
184
192
  the pull request and help you to point your pull request to the right branch.
193
+
194
+ ### Releasing Reek
195
+
196
+ In this example we assume the current version is 5.3.1 and you want to update to 5.3.2.
197
+
198
+ * Create a branch with a name like "prepare-v.5.3.2"
199
+ * Update the version in `lib/reek/version.rb`
200
+ * List all relevant changes in `CHANGELOG.md`
201
+ * Update the version number in our cucumber features, otherwise the build will fail. You can do this quite easily via
202
+ ```Bash
203
+ find features/ -type f -exec sed -i '' 's/v5.3.1/v5.3.2/g' {} +
204
+ ```
205
+ * Push the branch, create a pull request, have it reviewed and merged
206
+ * Pull the latest master and then do a
207
+ ```Bash
208
+ bundle exec rake release
209
+ ```
data/Dockerfile CHANGED
@@ -3,7 +3,7 @@
3
3
  # Build and run via:
4
4
  # docker build -t codeclimate/codeclimate-reek . && docker run codeclimate/codeclimate-reek
5
5
 
6
- FROM ruby:2.3.3-alpine
6
+ FROM ruby:2.6.0-alpine
7
7
 
8
8
  MAINTAINER The Reek core team
9
9
 
data/Gemfile CHANGED
@@ -5,32 +5,28 @@ gemspec
5
5
  ruby RUBY_VERSION
6
6
 
7
7
  group :development do
8
- gem 'activesupport', '>= 4.2'
9
- gem 'aruba', '~> 0.14.0'
10
- gem 'ataru', '~> 0.2.0'
11
- gem 'cucumber', '~> 3.0'
12
- gem 'factory_bot', '~> 4.0'
13
- gem 'rake', '~> 12.0'
14
- gem 'rspec', '~> 3.0'
15
- gem 'simplecov', '~> 0.16.1'
16
- gem 'yard', '~> 0.9.5'
17
-
18
- if RUBY_VERSION >= '2.3'
19
- gem 'rubocop', '~> 0.53.0'
20
- gem 'rubocop-rspec', '~> 1.20'
21
- end
8
+ gem 'aruba', '~> 0.14.8'
9
+ gem 'cucumber', '~> 3.0'
10
+ gem 'factory_bot', '~> 5.0', '!= 5.1.0'
11
+ gem 'kramdown', '~> 2.1'
12
+ gem 'kramdown-parser-gfm', '~> 1.0'
13
+ gem 'rake', '~> 13.0'
14
+ gem 'rspec', '~> 3.0'
15
+ gem 'rspec-benchmark', '~> 0.5.0'
16
+ gem 'rubocop', '~> 0.79.0'
17
+ gem 'rubocop-performance', '~> 1.5.0'
18
+ gem 'rubocop-rspec', '~> 1.37.0'
19
+ gem 'simplecov', '~> 0.17.0'
20
+ gem 'yard', '~> 0.9.5'
22
21
 
23
22
  platforms :mri do
24
- gem 'redcarpet', '~> 3.4.0'
23
+ gem 'redcarpet', '~> 3.4'
25
24
  end
26
25
  end
27
26
 
28
27
  group :debugging do
29
- # Fixing https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X#option-4-using-a-pure-ruby-readline-implementation
30
28
  gem 'pry'
31
- gem 'rb-readline', '~> 0.5.3'
32
29
  platforms :mri do
33
30
  gem 'pry-byebug'
34
- gem 'pry-stack_explorer'
35
31
  end
36
32
  end