reek 4.5.1 → 5.0.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 (311) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +17 -12
  3. data/.rubocop.yml +88 -33
  4. data/.simplecov +1 -0
  5. data/.travis.yml +9 -11
  6. data/.yardopts +1 -1
  7. data/CHANGELOG.md +108 -3
  8. data/CONTRIBUTING.md +1 -1
  9. data/Dockerfile +6 -5
  10. data/Gemfile +10 -9
  11. data/README.md +118 -69
  12. data/Rakefile +16 -3
  13. data/bin/code_climate_reek +1 -0
  14. data/bin/reek +2 -3
  15. data/docs/API.md +2 -9
  16. data/docs/Basic-Smell-Options.md +51 -11
  17. data/docs/Code-Smells.md +1 -1
  18. data/docs/Command-Line-Options.md +14 -4
  19. data/docs/Duplicate-Method-Call.md +49 -1
  20. data/docs/Feature-Envy.md +44 -0
  21. data/docs/How-To-Write-New-Detectors.md +13 -13
  22. data/docs/Instance-Variable-Assumption.md +1 -1
  23. data/docs/Irresponsible-Module.md +8 -1
  24. data/docs/{Prima-Donna-Method.md → Missing-Safe-Method.md} +36 -7
  25. data/docs/Nil-Check.md +1 -1
  26. data/docs/RSpec-matchers.md +5 -10
  27. data/docs/Rake-Task.md +1 -1
  28. data/docs/Reek-4-to-Reek-5-migration.md +193 -0
  29. data/docs/Reek-Driven-Development.md +1 -1
  30. data/docs/Uncommunicative-Method-Name.md +45 -6
  31. data/docs/Uncommunicative-Module-Name.md +49 -7
  32. data/docs/Uncommunicative-Parameter-Name.md +43 -5
  33. data/docs/Uncommunicative-Variable-Name.md +73 -2
  34. data/docs/Unused-Private-Method.md +30 -3
  35. data/docs/defaults.reek.yml +129 -0
  36. data/docs/templates/default/docstring/setup.rb +1 -8
  37. data/docs/yard_plugin.rb +1 -0
  38. data/features/command_line_interface/basic_usage.feature +2 -2
  39. data/features/command_line_interface/options.feature +49 -3
  40. data/features/command_line_interface/show_progress.feature +4 -4
  41. data/features/command_line_interface/smell_selection.feature +1 -1
  42. data/features/command_line_interface/smells_count.feature +6 -6
  43. data/features/command_line_interface/stdin.feature +30 -4
  44. data/features/configuration_files/accept_setting.feature +45 -28
  45. data/features/configuration_files/directory_specific_directives.feature +80 -75
  46. data/features/configuration_files/exclude_directives.feature +11 -10
  47. data/features/configuration_files/exclude_paths_directives.feature +43 -0
  48. data/features/configuration_files/masking_smells.feature +38 -9
  49. data/features/configuration_files/mix_accept_reject_setting.feature +31 -28
  50. data/features/configuration_files/reject_setting.feature +52 -41
  51. data/features/configuration_files/schema_validation.feature +59 -0
  52. data/features/configuration_files/unused_private_method.feature +18 -16
  53. data/features/configuration_loading.feature +53 -10
  54. data/features/configuration_via_source_comments/erroneous_source_comments.feature +3 -3
  55. data/features/configuration_via_source_comments/well_formed_source_comments.feature +2 -2
  56. data/features/locales.feature +32 -0
  57. data/features/rake_task/rake_task.feature +58 -18
  58. data/features/reports/codeclimate.feature +59 -0
  59. data/features/reports/json.feature +3 -3
  60. data/features/reports/reports.feature +34 -34
  61. data/features/reports/yaml.feature +3 -3
  62. data/features/rspec_matcher.feature +40 -0
  63. data/features/samples.feature +290 -295
  64. data/features/step_definitions/reek_steps.rb +19 -7
  65. data/features/step_definitions/sample_file_steps.rb +9 -4
  66. data/features/support/env.rb +2 -11
  67. data/features/todo_list.feature +27 -25
  68. data/lib/reek/ast/ast_node_class_map.rb +1 -0
  69. data/lib/reek/ast/builder.rb +16 -0
  70. data/lib/reek/ast/node.rb +50 -58
  71. data/lib/reek/ast/object_refs.rb +2 -1
  72. data/lib/reek/ast/reference_collector.rb +4 -7
  73. data/lib/reek/ast/sexp_extensions/arguments.rb +1 -5
  74. data/lib/reek/ast/sexp_extensions/attribute_assignments.rb +1 -0
  75. data/lib/reek/ast/sexp_extensions/begin.rb +17 -0
  76. data/lib/reek/ast/sexp_extensions/block.rb +1 -0
  77. data/lib/reek/ast/sexp_extensions/case.rb +2 -1
  78. data/lib/reek/ast/sexp_extensions/constant.rb +2 -0
  79. data/lib/reek/ast/sexp_extensions/if.rb +9 -1
  80. data/lib/reek/ast/sexp_extensions/lambda.rb +1 -0
  81. data/lib/reek/ast/sexp_extensions/literal.rb +1 -0
  82. data/lib/reek/ast/sexp_extensions/logical_operators.rb +2 -1
  83. data/lib/reek/ast/sexp_extensions/methods.rb +5 -6
  84. data/lib/reek/ast/sexp_extensions/module.rb +55 -8
  85. data/lib/reek/ast/sexp_extensions/nested_assignables.rb +1 -0
  86. data/lib/reek/ast/sexp_extensions/self.rb +1 -0
  87. data/lib/reek/ast/sexp_extensions/send.rb +1 -4
  88. data/lib/reek/ast/sexp_extensions/super.rb +1 -0
  89. data/lib/reek/ast/sexp_extensions/symbols.rb +1 -0
  90. data/lib/reek/ast/sexp_extensions/variables.rb +1 -0
  91. data/lib/reek/ast/sexp_extensions/when.rb +1 -0
  92. data/lib/reek/ast/sexp_extensions/yield.rb +1 -0
  93. data/lib/reek/ast/sexp_extensions.rb +2 -0
  94. data/lib/reek/cli/application.rb +12 -11
  95. data/lib/reek/cli/command/base_command.rb +1 -0
  96. data/lib/reek/cli/command/report_command.rb +5 -3
  97. data/lib/reek/cli/command/todo_list_command.rb +9 -8
  98. data/lib/reek/cli/options.rb +56 -24
  99. data/lib/reek/cli/silencer.rb +15 -3
  100. data/lib/reek/cli/status.rb +11 -0
  101. data/lib/reek/code_comment.rb +18 -18
  102. data/lib/reek/configuration/app_configuration.rb +34 -28
  103. data/lib/reek/configuration/configuration_converter.rb +110 -0
  104. data/lib/reek/configuration/configuration_file_finder.rb +67 -31
  105. data/lib/reek/configuration/configuration_validator.rb +13 -23
  106. data/lib/reek/configuration/default_directive.rb +18 -3
  107. data/lib/reek/configuration/directory_directives.rb +18 -11
  108. data/lib/reek/configuration/excluded_paths.rb +2 -1
  109. data/lib/reek/configuration/rake_task_converter.rb +29 -0
  110. data/lib/reek/configuration/schema.yml +210 -0
  111. data/lib/reek/configuration/schema_validator.rb +38 -0
  112. data/lib/reek/context/attribute_context.rb +4 -3
  113. data/lib/reek/context/class_context.rb +1 -0
  114. data/lib/reek/context/code_context.rb +49 -44
  115. data/lib/reek/context/ghost_context.rb +1 -3
  116. data/lib/reek/context/method_context.rb +26 -18
  117. data/lib/reek/context/module_context.rb +11 -11
  118. data/lib/reek/context/root_context.rb +1 -4
  119. data/lib/reek/context/send_context.rb +3 -2
  120. data/lib/reek/context/singleton_attribute_context.rb +1 -0
  121. data/lib/reek/context/singleton_method_context.rb +1 -0
  122. data/lib/reek/context/statement_counter.rb +1 -0
  123. data/lib/reek/context/visibility_tracker.rb +1 -0
  124. data/lib/reek/context_builder.rb +68 -43
  125. data/lib/reek/detector_repository.rb +65 -0
  126. data/lib/reek/documentation_link.rb +28 -0
  127. data/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb +17 -14
  128. data/lib/reek/errors/bad_detector_in_comment_error.rb +15 -12
  129. data/lib/reek/errors/base_error.rb +12 -0
  130. data/lib/reek/errors/config_file_error.rb +11 -0
  131. data/lib/reek/errors/encoding_error.rb +43 -0
  132. data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +16 -13
  133. data/lib/reek/errors/incomprehensible_source_error.rb +46 -0
  134. data/lib/reek/errors/syntax_error.rb +41 -0
  135. data/lib/reek/examiner.rb +35 -58
  136. data/lib/reek/logging_error_handler.rb +18 -0
  137. data/lib/reek/rake/task.rb +8 -5
  138. data/lib/reek/report/base_report.rb +9 -12
  139. data/lib/reek/report/code_climate/code_climate_configuration.rb +2 -1
  140. data/lib/reek/report/code_climate/code_climate_configuration.yml +7 -7
  141. data/lib/reek/report/code_climate/code_climate_fingerprint.rb +1 -0
  142. data/lib/reek/report/code_climate/code_climate_formatter.rb +1 -0
  143. data/lib/reek/report/code_climate/code_climate_report.rb +1 -0
  144. data/lib/reek/report/code_climate.rb +1 -0
  145. data/lib/reek/report/documentation_link_warning_formatter.rb +17 -0
  146. data/lib/reek/report/heading_formatter.rb +54 -0
  147. data/lib/reek/report/html_report.rb +1 -0
  148. data/lib/reek/report/json_report.rb +2 -1
  149. data/lib/reek/report/location_formatter.rb +40 -0
  150. data/lib/reek/report/progress_formatter.rb +79 -0
  151. data/lib/reek/report/simple_warning_formatter.rb +34 -0
  152. data/lib/reek/report/text_report.rb +2 -2
  153. data/lib/reek/report/xml_report.rb +4 -3
  154. data/lib/reek/report/yaml_report.rb +2 -1
  155. data/lib/reek/report.rb +16 -10
  156. data/lib/reek/smell_configuration.rb +65 -0
  157. data/lib/reek/smell_detectors/attribute.rb +6 -13
  158. data/lib/reek/smell_detectors/base_detector.rb +36 -30
  159. data/lib/reek/smell_detectors/boolean_parameter.rb +4 -6
  160. data/lib/reek/smell_detectors/class_variable.rb +6 -15
  161. data/lib/reek/smell_detectors/control_parameter.rb +19 -34
  162. data/lib/reek/smell_detectors/data_clump.rb +16 -10
  163. data/lib/reek/smell_detectors/duplicate_method_call.rb +24 -18
  164. data/lib/reek/smell_detectors/feature_envy.rb +10 -8
  165. data/lib/reek/smell_detectors/instance_variable_assumption.rb +15 -24
  166. data/lib/reek/smell_detectors/irresponsible_module.rb +6 -13
  167. data/lib/reek/smell_detectors/long_parameter_list.rb +11 -9
  168. data/lib/reek/smell_detectors/long_yield_list.rb +11 -8
  169. data/lib/reek/smell_detectors/manual_dispatch.rb +7 -9
  170. data/lib/reek/smell_detectors/{prima_donna_method.rb → missing_safe_method.rb} +45 -15
  171. data/lib/reek/smell_detectors/module_initialize.rb +7 -11
  172. data/lib/reek/smell_detectors/nested_iterators.rb +17 -25
  173. data/lib/reek/smell_detectors/nil_check.rb +9 -16
  174. data/lib/reek/smell_detectors/repeated_conditional.rb +14 -12
  175. data/lib/reek/smell_detectors/subclassed_from_core_class.rb +8 -9
  176. data/lib/reek/smell_detectors/too_many_constants.rb +11 -10
  177. data/lib/reek/smell_detectors/too_many_instance_variables.rb +11 -7
  178. data/lib/reek/smell_detectors/too_many_methods.rb +12 -8
  179. data/lib/reek/smell_detectors/too_many_statements.rb +11 -7
  180. data/lib/reek/smell_detectors/uncommunicative_method_name.rb +11 -12
  181. data/lib/reek/smell_detectors/uncommunicative_module_name.rb +15 -19
  182. data/lib/reek/smell_detectors/uncommunicative_parameter_name.rb +18 -23
  183. data/lib/reek/smell_detectors/uncommunicative_variable_name.rb +27 -28
  184. data/lib/reek/smell_detectors/unused_parameters.rb +5 -7
  185. data/lib/reek/smell_detectors/unused_private_method.rb +14 -22
  186. data/lib/reek/smell_detectors/utility_function.rb +13 -17
  187. data/lib/reek/smell_detectors.rb +2 -1
  188. data/lib/reek/smell_warning.rb +93 -0
  189. data/lib/reek/source/source_code.rb +65 -45
  190. data/lib/reek/source/source_locator.rb +24 -11
  191. data/lib/reek/spec/should_reek.rb +3 -2
  192. data/lib/reek/spec/should_reek_of.rb +13 -26
  193. data/lib/reek/spec/should_reek_only_of.rb +5 -4
  194. data/lib/reek/spec/smell_matcher.rb +2 -1
  195. data/lib/reek/spec.rb +12 -9
  196. data/lib/reek/tree_dresser.rb +9 -8
  197. data/lib/reek/version.rb +2 -1
  198. data/lib/reek.rb +1 -0
  199. data/reek.gemspec +5 -6
  200. data/samples/checkstyle.xml +1 -1
  201. data/samples/configuration/accepts_rejects_and_excludes_for_detectors.reek.yml +29 -0
  202. data/samples/configuration/accepts_rejects_and_excludes_for_directory_directives.reek.yml +30 -0
  203. data/samples/configuration/full_configuration.reek +8 -4
  204. data/samples/configuration/full_mask.reek +5 -4
  205. data/samples/configuration/partial_mask.reek +3 -2
  206. data/samples/configuration/regular_configuration/.reek.yml +4 -0
  207. data/samples/configuration/regular_configuration/empty_sub_directory/.gitignore +0 -0
  208. data/samples/no_config_file/.keep +0 -0
  209. data/samples/paths.rb +5 -4
  210. data/samples/source_with_hidden_directories/.hidden/hidden.rb +1 -0
  211. data/samples/source_with_hidden_directories/not_hidden.rb +1 -0
  212. data/spec/factories/factories.rb +4 -23
  213. data/spec/quality/reek_source_spec.rb +5 -3
  214. data/spec/reek/ast/node_spec.rb +103 -10
  215. data/spec/reek/ast/reference_collector_spec.rb +1 -18
  216. data/spec/reek/ast/sexp_extensions_spec.rb +15 -34
  217. data/spec/reek/cli/application_spec.rb +77 -43
  218. data/spec/reek/cli/command/report_command_spec.rb +2 -2
  219. data/spec/reek/cli/command/todo_list_command_spec.rb +18 -73
  220. data/spec/reek/cli/options_spec.rb +4 -0
  221. data/spec/reek/cli/silencer_spec.rb +28 -0
  222. data/spec/reek/code_comment_spec.rb +31 -31
  223. data/spec/reek/configuration/app_configuration_spec.rb +46 -33
  224. data/spec/reek/configuration/configuration_file_finder_spec.rb +140 -35
  225. data/spec/reek/configuration/default_directive_spec.rb +1 -1
  226. data/spec/reek/configuration/directory_directives_spec.rb +6 -7
  227. data/spec/reek/configuration/excluded_paths_spec.rb +6 -6
  228. data/spec/reek/configuration/rake_task_converter_spec.rb +33 -0
  229. data/spec/reek/configuration/schema_validator_spec.rb +165 -0
  230. data/spec/reek/context/code_context_spec.rb +72 -108
  231. data/spec/reek/context/ghost_context_spec.rb +9 -9
  232. data/spec/reek/context/method_context_spec.rb +3 -3
  233. data/spec/reek/context/module_context_spec.rb +8 -4
  234. data/spec/reek/context/root_context_spec.rb +1 -1
  235. data/spec/reek/context/statement_counter_spec.rb +1 -0
  236. data/spec/reek/context_builder_spec.rb +20 -0
  237. data/spec/reek/{smell_detectors/detector_repository_spec.rb → detector_repository_spec.rb} +3 -3
  238. data/spec/reek/documentation_link_spec.rb +20 -0
  239. data/spec/reek/errors/base_error_spec.rb +13 -0
  240. data/spec/reek/examiner_spec.rb +173 -66
  241. data/spec/reek/logging_error_handler_spec.rb +24 -0
  242. data/spec/reek/rake/task_spec.rb +25 -2
  243. data/spec/reek/report/code_climate/code_climate_configuration_spec.rb +1 -1
  244. data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +83 -79
  245. data/spec/reek/report/code_climate/code_climate_formatter_spec.rb +6 -6
  246. data/spec/reek/report/code_climate/code_climate_report_spec.rb +22 -22
  247. data/spec/reek/report/json_report_spec.rb +13 -46
  248. data/spec/reek/report/{formatter/location_formatter_spec.rb → location_formatter_spec.rb} +5 -5
  249. data/spec/reek/report/{formatter/progress_formatter_spec.rb → progress_formatter_spec.rb} +4 -4
  250. data/spec/reek/report/text_report_spec.rb +4 -4
  251. data/spec/reek/report/xml_report_spec.rb +3 -3
  252. data/spec/reek/report/yaml_report_spec.rb +18 -47
  253. data/spec/reek/report_spec.rb +3 -3
  254. data/spec/reek/{smell_detectors/smell_configuration_spec.rb → smell_configuration_spec.rb} +3 -3
  255. data/spec/reek/smell_detectors/base_detector_spec.rb +4 -5
  256. data/spec/reek/smell_detectors/boolean_parameter_spec.rb +2 -2
  257. data/spec/reek/smell_detectors/class_variable_spec.rb +26 -32
  258. data/spec/reek/smell_detectors/control_parameter_spec.rb +34 -4
  259. data/spec/reek/smell_detectors/duplicate_method_call_spec.rb +5 -5
  260. data/spec/reek/smell_detectors/feature_envy_spec.rb +65 -10
  261. data/spec/reek/smell_detectors/irresponsible_module_spec.rb +59 -21
  262. data/spec/reek/smell_detectors/manual_dispatch_spec.rb +13 -0
  263. data/spec/reek/smell_detectors/missing_safe_method_spec.rb +62 -0
  264. data/spec/reek/smell_detectors/module_initialize_spec.rb +37 -2
  265. data/spec/reek/smell_detectors/nested_iterators_spec.rb +2 -2
  266. data/spec/reek/smell_detectors/subclassed_from_core_class_spec.rb +0 -5
  267. data/spec/reek/smell_detectors/too_many_constants_spec.rb +3 -3
  268. data/spec/reek/smell_detectors/too_many_instance_variables_spec.rb +1 -1
  269. data/spec/reek/smell_detectors/uncommunicative_method_name_spec.rb +6 -6
  270. data/spec/reek/smell_detectors/uncommunicative_module_name_spec.rb +6 -4
  271. data/spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb +36 -15
  272. data/spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb +11 -11
  273. data/spec/reek/smell_detectors/unused_parameters_spec.rb +4 -4
  274. data/spec/reek/smell_detectors/unused_private_method_spec.rb +21 -10
  275. data/spec/reek/smell_detectors/utility_function_spec.rb +57 -5
  276. data/spec/reek/{smell_detectors/smell_warning_spec.rb → smell_warning_spec.rb} +21 -17
  277. data/spec/reek/source/source_code_spec.rb +27 -61
  278. data/spec/reek/source/source_locator_spec.rb +95 -33
  279. data/spec/reek/spec/should_reek_of_spec.rb +25 -30
  280. data/spec/reek/spec/should_reek_only_of_spec.rb +6 -6
  281. data/spec/reek/spec/should_reek_spec.rb +8 -8
  282. data/spec/reek/spec/smell_matcher_spec.rb +23 -23
  283. data/spec/reek/tree_dresser_spec.rb +12 -17
  284. data/spec/spec_helper.rb +8 -17
  285. data/tasks/configuration.rake +10 -7
  286. metadata +91 -45
  287. data/defaults.reek +0 -128
  288. data/lib/reek/report/formatter/heading_formatter.rb +0 -51
  289. data/lib/reek/report/formatter/location_formatter.rb +0 -41
  290. data/lib/reek/report/formatter/progress_formatter.rb +0 -80
  291. data/lib/reek/report/formatter/simple_warning_formatter.rb +0 -35
  292. data/lib/reek/report/formatter/wiki_link_warning_formatter.rb +0 -35
  293. data/lib/reek/report/formatter.rb +0 -32
  294. data/lib/reek/smell_detectors/detector_repository.rb +0 -66
  295. data/lib/reek/smell_detectors/smell_configuration.rb +0 -66
  296. data/lib/reek/smell_detectors/smell_warning.rb +0 -88
  297. data/samples/configuration/non_public_modifiers_mask.reek +0 -3
  298. data/samples/smelly_with_inline_mask.rb +0 -8
  299. data/samples/smelly_with_modifiers.rb +0 -12
  300. data/samples/source_with_hidden_directories/.hidden/uncommunicative_method_name.rb +0 -5
  301. data/samples/source_with_non_ruby_files/uncommunicative_parameter_name.rb +0 -6
  302. data/spec/reek/smell_detectors/prima_donna_method_spec.rb +0 -50
  303. data/tasks/mutant.rake +0 -14
  304. /data/{samples/configuration/.reek → .reek.yml} +0 -0
  305. /data/samples/{clean.rb → clean_source/clean.rb} +0 -0
  306. /data/samples/{exceptions.reek → configuration/home/home.reek.yml} +0 -0
  307. /data/samples/{inline.rb → smelly_source/inline.rb} +0 -0
  308. /data/samples/{optparse.rb → smelly_source/optparse.rb} +0 -0
  309. /data/samples/{redcloth.rb → smelly_source/redcloth.rb} +0 -0
  310. /data/samples/{smelly.rb → smelly_source/smelly.rb} +0 -0
  311. /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
  SHA1:
3
- metadata.gz: e73dfbe510f33f5080c142589e06141d394590c4
4
- data.tar.gz: c97e989ed22ab395217099122515d0b1e02ca8e2
3
+ metadata.gz: dcc26f0cc3bb682d6af4ccd125c9968049fa7659
4
+ data.tar.gz: 3f07f95ea9d5dc2d9a3228d9720aa991ac1f5232
5
5
  SHA512:
6
- metadata.gz: 27c163213eee8653498e261dc44b3e6b8a1c7e9a17dfeb19bafdd914a7b7ec741168cc1f1505b71b7f8653c8eff889dbb0cbb3f953220bd46876ca4a12e310d4
7
- data.tar.gz: 3884c786a8deda2eab21427011f595b0484c61075ab96beb759bbe1ecbefc92f244650a9ef045850ce261783ef397516d5cf8fd16956cbdec16ab712fe86546b
6
+ metadata.gz: caeb105aa52968eb387304da206083cf07394d1f378c01a6aabf040e2aa264d0016491e69dba31910fa64982cdc8bf9902b036b63639279422c93ad934a91725
7
+ data.tar.gz: 8af65a286c9207f04770b530865755aeeca35b4162d3db66c987b0e6d5c02438faeeee3251bef91ef5e91e4b75235ec2ae23f805a07bfc64d448e7e5066610d6
data/.codeclimate.yml CHANGED
@@ -1,16 +1,21 @@
1
- engines:
1
+ version: "2"
2
+ plugins:
2
3
  rubocop:
3
4
  enabled: true
4
5
  reek:
5
6
  enabled: true
6
- ratings:
7
- paths:
8
- - lib/**/*
9
- exclude_paths:
10
- - coverage/
11
- - docs/
12
- - features/
13
- - logo/
14
- - pkg/
15
- - spec/
16
- - tmp/
7
+ duplication:
8
+ enabled: true
9
+ config:
10
+ languages:
11
+ ruby:
12
+ mass_threshold: 35
13
+ exclude_patterns:
14
+ - coverage/
15
+ - docs/
16
+ - features/
17
+ - logo/
18
+ - pkg/
19
+ - samples/
20
+ - spec/
21
+ - tmp/
data/.rubocop.yml CHANGED
@@ -6,7 +6,53 @@ AllCops:
6
6
  - 'samples/**/*'
7
7
  - 'tmp/**/*'
8
8
  - 'vendor/**/*'
9
- TargetRubyVersion: 2.1
9
+ TargetRubyVersion: 2.3
10
+
11
+ # Place . on the previous line
12
+ Layout/DotPosition:
13
+ EnforcedStyle: trailing
14
+
15
+ # Require empty lines between defs, except for one-line defs
16
+ Layout/EmptyLineBetweenDefs:
17
+ AllowAdjacentOneLineDefs: true
18
+
19
+ # Use active_support's strip_heredoc to indent heredocs
20
+ Layout/IndentHeredoc:
21
+ EnforcedStyle: active_support
22
+
23
+ # Always put the closing brace on the last line
24
+ Layout/MultilineMethodCallBraceLayout:
25
+ EnforcedStyle: same_line
26
+
27
+ # Indent one level for follow-up lines
28
+ Layout/MultilineMethodCallIndentation:
29
+ EnforcedStyle: indented
30
+
31
+ # Indent one level for follow-up lines
32
+ Layout/MultilineOperationIndentation:
33
+ EnforcedStyle: indented
34
+
35
+ # Assume the programmer knows how bracketed block syntax works
36
+ Lint/AmbiguousBlockAssociation:
37
+ Enabled: false
38
+
39
+ # Some of our source examples include interpolation explicitely.
40
+ Lint/InterpolationCheck:
41
+ Exclude:
42
+ - 'spec/**/*'
43
+
44
+ # We use :true and :false as AST node types.
45
+ Lint/BooleanSymbol:
46
+ Enabled: false
47
+
48
+ Lint/HandleExceptions:
49
+ Exclude:
50
+ - 'spec/reek/configuration/configuration_file_finder_spec.rb'
51
+
52
+ # Spec blocks can be any size
53
+ Metrics/BlockLength:
54
+ Exclude:
55
+ - 'spec/**/*'
10
56
 
11
57
  # FIXME: Make the class shorter
12
58
  Metrics/ClassLength:
@@ -14,9 +60,21 @@ Metrics/ClassLength:
14
60
  - lib/reek/context_builder.rb
15
61
  - lib/reek/cli/options.rb
16
62
 
63
+ Style/SafeNavigation:
64
+ Exclude:
65
+ - lib/reek/ast/node.rb
66
+ - lib/reek/ast/sexp_extensions/module.rb
67
+
17
68
  # FIXME: Lower the method length by fixing the biggest offenders
18
69
  Metrics/MethodLength:
19
70
  Max: 15
71
+ Exclude:
72
+ - 'lib/reek/cli/options.rb'
73
+
74
+ Metrics/AbcSize:
75
+ Exclude:
76
+ - 'lib/reek/cli/options.rb'
77
+ - 'lib/reek/configuration/configuration_converter.rb'
20
78
 
21
79
  # Be rather lenient with line length
22
80
  Metrics/LineLength:
@@ -26,6 +84,15 @@ Metrics/LineLength:
26
84
  Metrics/ParameterLists:
27
85
  CountKeywordArgs: false
28
86
 
87
+ Naming/AccessorMethodName:
88
+ Exclude:
89
+ - 'lib/reek/context/visibility_tracker.rb'
90
+
91
+ # EOS is a fine name to use in our specs
92
+ Naming/HeredocDelimiterNaming:
93
+ Exclude:
94
+ - 'spec/**/*'
95
+
29
96
  # FIXME: Update specs to avoid offenses
30
97
  RSpec/AnyInstance:
31
98
  Exclude:
@@ -45,8 +112,8 @@ RSpec/MultipleDescribes:
45
112
  Exclude:
46
113
  - 'spec/reek/ast/sexp_extensions_spec.rb'
47
114
  - 'spec/reek/code_comment_spec.rb'
48
- - 'spec/reek/report/formatter/location_formatter_spec.rb'
49
- - 'spec/reek/report/formatter/progress_formatter_spec.rb'
115
+ - 'spec/reek/report/location_formatter_spec.rb'
116
+ - 'spec/reek/report/progress_formatter_spec.rb'
50
117
 
51
118
  # FIXME: Update specs to avoid offenses
52
119
  RSpec/MultipleExpectations:
@@ -62,14 +129,10 @@ RSpec/MultipleExpectations:
62
129
  # FIXME: Update specs to avoid offenses
63
130
  RSpec/NestedGroups:
64
131
  Exclude:
132
+ - 'spec/reek/report/code_climate/code_climate_fingerprint_spec.rb'
65
133
  - 'spec/reek/cli/application_spec.rb'
66
-
67
- # FIXME: Update specs to avoid offenses
68
- RSpec/VerifiedDoubles:
69
- Exclude:
70
- - 'spec/reek/context/code_context_spec.rb'
71
- - 'spec/reek/context/method_context_spec.rb'
72
- - 'spec/reek/context/module_context_spec.rb'
134
+ - 'spec/reek/configuration/schema_validator_spec.rb'
135
+ - 'spec/reek/configuration/configuration_file_finder_spec.rb'
73
136
 
74
137
  # rubocop-rspec expects a CodeClimate namespace to go with the code_climate directory.
75
138
  RSpec/FilePath:
@@ -79,9 +142,9 @@ RSpec/FilePath:
79
142
  - 'spec/reek/report/code_climate/code_climate_formatter_spec.rb'
80
143
  - 'spec/reek/report/code_climate/code_climate_report_spec.rb'
81
144
 
82
- Style/AccessorMethodName:
83
- Exclude:
84
- - 'lib/reek/context/visibility_tracker.rb'
145
+ # Allow and/or for control flow only
146
+ Style/AndOr:
147
+ EnforcedStyle: conditionals
85
148
 
86
149
  Style/Documentation:
87
150
  Exclude:
@@ -89,14 +152,6 @@ Style/Documentation:
89
152
  - 'lib/reek/ast/sexp_extensions/super.rb'
90
153
  - 'lib/reek/ast/sexp_extensions/variables.rb'
91
154
 
92
- # Place . on the previous line
93
- Style/DotPosition:
94
- EnforcedStyle: trailing
95
-
96
- # Require empty lines between defs, except for one-line defs
97
- Style/EmptyLineBetweenDefs:
98
- AllowAdjacentOneLineDefs: true
99
-
100
155
  # Require comment for files in lib and bin
101
156
  Style/FrozenStringLiteralComment:
102
157
  Include:
@@ -108,22 +163,18 @@ Style/FrozenStringLiteralComment:
108
163
  Style/MultilineBlockChain:
109
164
  Enabled: false
110
165
 
111
- # Always put the closing brace on the last line
112
- Style/MultilineMethodCallBraceLayout:
113
- EnforcedStyle: same_line
114
-
115
- # Indent one level for follow-up lines
116
- Style/MultilineMethodCallIndentation:
117
- EnforcedStyle: indented
118
-
119
- # Indent one level for follow-up lines
120
- Style/MultilineOperationIndentation:
121
- EnforcedStyle: indented
122
-
123
166
  # There's nothing wrong with parallel assignment
124
167
  Style/ParallelAssignment:
125
168
  Enabled: false
126
169
 
170
+ Style/PercentLiteralDelimiters:
171
+ PreferredDelimiters:
172
+ default: ()
173
+ '%W': ()
174
+ '%I': ()
175
+ '%w': ()
176
+ '%i': ()
177
+
127
178
  # Allow Perl-style references to regex matches
128
179
  Style/PerlBackrefs:
129
180
  Enabled: false
@@ -132,6 +183,10 @@ Style/PerlBackrefs:
132
183
  Style/SingleLineMethods:
133
184
  Enabled: false
134
185
 
186
+ # Prefer symbols to look like symbols
187
+ Style/SymbolArray:
188
+ EnforcedStyle: brackets
189
+
135
190
  # Allow small arrays of words with quotes
136
191
  Style/WordArray:
137
192
  MinSize: 4
data/.simplecov CHANGED
@@ -1,6 +1,7 @@
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
4
5
  end
5
6
 
6
7
  SimpleCov.at_exit do
data/.travis.yml CHANGED
@@ -1,25 +1,23 @@
1
1
  sudo: false
2
+ dist: trusty
2
3
  cache: bundler
3
4
  language: ruby
4
5
  bundler_args: --without debugging
5
6
  script: bundle exec rake ci
6
7
  rvm:
7
- - 2.1
8
- - 2.2
9
- - 2.3.0
10
- - rbx-2
8
+ - 2.3
9
+ - 2.4
10
+ - 2.5
11
+ - jruby-9.1.15.0
12
+ - jruby-head
11
13
  - ruby-head
14
+ - rubinius-3
12
15
  matrix:
13
- include:
14
- - rvm: jruby
15
- env: JRUBY_OPTS='--2.0 --server -Xcompile.invokedynamic=false'
16
- - rvm: jruby-head
17
- env: JRUBY_OPTS='--server -Xcompile.invokedynamic=false'
18
16
  allow_failures:
19
- - rvm: jruby
17
+ - rvm: jruby-9.1.15.0
20
18
  - rvm: jruby-head
21
- - rvm: rbx-2
22
19
  - rvm: ruby-head
20
+ - rvm: rubinius-3
23
21
  fast_finish: true
24
22
  notifications:
25
23
  email:
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,15 +1,120 @@
1
1
  # Change log
2
2
 
3
+ ## 5.0.0 (2018-06-18)
4
+
5
+ *Breaking changes:*
6
+
7
+ * (David Fisher) Change PrimaDonnaMethod to MissingSafeMethod
8
+ * (mvz) Always include documentation in JSON and YAML
9
+ * (mvz) Remove Syntax smell detector
10
+ * (mvz) Remove deprecated Examiner#description (in favor of Examiner#origin)
11
+ * (mvz) Allow only detector names in configuration hash
12
+ * (mvz) Do not accept a class as parameter for reek_of
13
+ * (mvz) Allow only .reek.yml instead of any file name ending in .reek
14
+ * (troessner) Validate our configuration by using a schema
15
+ * (troessner) Scope detectors in the configuration under `detectors`
16
+ * (troessner) Move directory directives under a special key
17
+ * (troessner) Use strings not regexes in our configuration file
18
+ * (troessner) Replace `wiki-links` flag with `documentation` flag
19
+ * (troessner) Add yml extension to Reeks configuration file
20
+ * (troessner) Drop legacy code comment separator
21
+ * (troessner) Drop Ruby 2.2 support
22
+ * (troessner) Drop Ruby 2.1 support
23
+
24
+ *Non breaking changes:*
25
+
26
+ * (Paul Sadauskas) Add support for --stdin-filename
27
+ * (mvz) Generate versioned documentation links
28
+ * (mvz) Bugfix: Only report FeatureEnvy for instance methods
29
+ * (troessner) List all smells
30
+
31
+ ## 4.8.2 (2018-06-26)
32
+
33
+ * (mvz) Only report FeatureEnvy for instance methods
34
+ * (mvz) Generate versioned documentation links
35
+
36
+ ## 4.8.1 (2018-04-12)
37
+
38
+ * (mvz) Loosen dependency on rainbow
39
+
40
+ ## 4.8.0 (2018-03-05)
41
+
42
+ * (pocke) Support Ruby 2.5
43
+ * (mvz) Print original exception class in certain error messages
44
+ * (mvz) Only include long exception message in CLI output
45
+ * (chastell) Add official support for Ruby 2.5
46
+ * (mvz) Do not detect ModuleInitialize for nested dynamic classes
47
+
48
+ ## 4.7.3 (2017-11-05)
49
+
50
+ * (mvz) Handle UTF-8 files in all locales
51
+ * (troessner) Handle encoding and other errors when parsing the source
52
+ * (mvz) Report method source line in PrimaDonnaMethod
53
+ * (mvz) Pick up config file in reek matcher
54
+ * (mvz) Let REEK_SRC override set values in rake task
55
+
56
+ ## 4.7.2 (2017-07-24)
57
+
58
+ * (mvz) Also report unused uncommunicative parameter names
59
+ * (mvz) Track visibility correctly when using method definition visibility modifiers
60
+ * (mvz) Handle method comments when using method definition visibility modifiers
61
+
62
+ ## 4.7.1 (2017-06-12)
63
+
64
+ * (mvz) Improve IrresponsibleModule and fix some bugs along
65
+
66
+ ## 4.7.0 (2017-05-31)
67
+
68
+ * (pocke) Introduce Syntax smell detector
69
+
70
+ ## 4.6.2 (2017-04-27)
71
+
72
+ * (pocke) Prevent from breaking on a string with escape sequence incompatible with UTF-8
73
+ * (pocke) Use Ruby 2.4 parser for parsing code
74
+
75
+ ## 4.6.1 (2017-04-05)
76
+
77
+ * (IanWhitney) Properly handle absolute paths.
78
+
79
+ ## 4.6.0 (2017-04-04)
80
+
81
+ * (IanWhitney) Implement `--force-exclusion` flag
82
+ * (mvz) Raise Reek-specific error on parse errors
83
+
84
+ ## 4.5.6 (2017-02-17)
85
+
86
+ * (mvz) Raise on errors inside of Examiner#smells instead of outputting to STDERR
87
+ * (mvz) Update parser dependency
88
+
89
+ ## 4.5.5 (2017-02-05)
90
+
91
+ * (mvz) Load YAML in code comments safely
92
+ * (mvz) Combine lines for manual dispatch smells
93
+ * (mvz) Respect exclude_paths when passing sources on the command line
94
+ * (mvz) Ensure explicit arguments of super() are processed
95
+
96
+ ## 4.5.4 (2017-01-17)
97
+
98
+ * (troessner) Improve documentation and fix PrimaDonnaMethod detector configuration via comment.
99
+
100
+ ## 4.5.3 (2016-12-05)
101
+
102
+ * (jhubert) Stop reporting FeatureEnvy with super and arguments.
103
+
104
+ ## 4.5.2 (2016-11-06)
105
+
106
+ * (troessner) Warn about multiple configuration files.
107
+
3
108
  ## 4.5.1 (2016-10-16)
4
109
 
5
110
  * (troessner) Validate configuration keys in code comments.
6
111
 
7
112
  ## 4.5.0 (2016-10-12)
8
113
 
9
- * (maxjacobson) Emit fingerprints in Code Climate reporter
10
- * (mvz) Disable progress for piped output
11
- * (mvz) Update progress formatter to match changed file location
12
114
  * (jhubert) Add progress formatters for showing progress on each file
115
+ * (mvz) Update progress formatter to match changed file location
116
+ * (mvz) Disable progress for piped output
117
+ * (maxjacobson) Emit fingerprints in Code Climate reporter
13
118
 
14
119
  ## 4.4.4 (2016-09-29)
15
120
 
data/CONTRIBUTING.md CHANGED
@@ -111,7 +111,7 @@ regard than if it were run in a terminal.
111
111
 
112
112
  #### Failing Cucumber Scenarios
113
113
 
114
- If there is a failing scenario and you can not figure out why it is failing,
114
+ If there is a failing scenario and you cannot figure out why it is failing,
115
115
  just run the failing scenario: `bundle exec cucumber
116
116
  features/failing_scenario.feature:line`. By doing so Aruba will leave its set
117
117
  up in the `tmp/aruba` directory. You can then `cd` into this directory and run
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 codeclimate/alpine-ruby:b38
6
+ FROM ruby:2.3.3-alpine
7
7
 
8
8
  MAINTAINER The Reek core team
9
9
 
@@ -12,17 +12,18 @@ ENV app_dir /usr/src/app
12
12
  ENV user app
13
13
 
14
14
  RUN apk --update add git
15
-
16
15
  ADD . ${app_dir}
17
16
 
17
+ RUN adduser -u 9000 -D ${user}
18
+ RUN chown -R ${user}:${user} ${app_dir}
19
+ USER ${user}
20
+
18
21
  WORKDIR ${app_dir}
19
22
 
23
+ RUN gem install rake
20
24
  RUN bundle install --without debugging development
21
- RUN adduser -u 9000 -D ${user}
22
- RUN chown -R ${user}:${user} ${app_dir}
23
25
 
24
26
  VOLUME ${code_dir}
25
27
  WORKDIR ${code_dir}
26
- USER ${user}
27
28
 
28
29
  CMD [ "/usr/src/app/bin/code_climate_reek" ]
data/Gemfile CHANGED
@@ -2,25 +2,26 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ ruby RUBY_VERSION
6
+
5
7
  group :development do
8
+ gem 'activesupport', '>= 4.2'
6
9
  gem 'aruba', '~> 0.14.0'
7
10
  gem 'ataru', '~> 0.2.0'
8
- gem 'cucumber', '~> 2.0'
9
- gem 'factory_girl', '~> 4.0'
10
- gem 'mutant-rspec', '~> 0.8.8'
11
- gem 'rake', '~> 11.1'
11
+ gem 'cucumber', '~> 3.0'
12
+ gem 'factory_bot', '~> 4.0'
13
+ gem 'rake', '~> 12.0'
12
14
  gem 'rspec', '~> 3.0'
13
- gem 'simplecov', '~> 0.12.0'
15
+ gem 'simplecov', '~> 0.16.1'
14
16
  gem 'yard', '~> 0.9.5'
15
- gem 'activesupport', '~> 4.2'
16
17
 
17
18
  if RUBY_VERSION >= '2.3'
18
- gem 'rubocop', '~> 0.42.0'
19
- gem 'rubocop-rspec', '~> 1.7'
19
+ gem 'rubocop', '~> 0.57.1'
20
+ gem 'rubocop-rspec', '~> 1.20'
20
21
  end
21
22
 
22
23
  platforms :mri do
23
- gem 'redcarpet', '~> 3.3.1'
24
+ gem 'redcarpet', '~> 3.4.0'
24
25
  end
25
26
  end
26
27