reek 4.2.3 → 4.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +6 -0
  4. data/CONTRIBUTING.md +7 -6
  5. data/Gemfile +2 -2
  6. data/README.md +8 -15
  7. data/Rakefile +1 -1
  8. data/defaults.reek +1 -0
  9. data/features/command_line_interface/basic_usage.feature +8 -14
  10. data/features/command_line_interface/smell_selection.feature +4 -4
  11. data/features/command_line_interface/smells_count.feature +12 -14
  12. data/features/configuration_files/masking_smells.feature +31 -24
  13. data/features/configuration_loading.feature +15 -18
  14. data/features/programmatic_access.feature +7 -9
  15. data/features/rake_task/rake_task.feature +20 -24
  16. data/features/reports/json.feature +16 -28
  17. data/features/reports/reports.feature +56 -67
  18. data/features/reports/yaml.feature +13 -26
  19. data/features/samples.feature +3 -3
  20. data/features/step_definitions/sample_file_steps.rb +22 -156
  21. data/features/todo_list.feature +13 -14
  22. data/lib/reek/cli/options.rb +1 -1
  23. data/lib/reek/examiner.rb +45 -10
  24. data/lib/reek/smells/attribute.rb +3 -4
  25. data/lib/reek/smells/boolean_parameter.rb +2 -2
  26. data/lib/reek/smells/class_variable.rb +1 -1
  27. data/lib/reek/smells/control_parameter.rb +4 -4
  28. data/lib/reek/smells/data_clump.rb +2 -3
  29. data/lib/reek/smells/duplicate_method_call.rb +1 -1
  30. data/lib/reek/smells/feature_envy.rb +2 -2
  31. data/lib/reek/smells/irresponsible_module.rb +2 -3
  32. data/lib/reek/smells/long_parameter_list.rb +1 -1
  33. data/lib/reek/smells/long_yield_list.rb +1 -1
  34. data/lib/reek/smells/module_initialize.rb +1 -1
  35. data/lib/reek/smells/nested_iterators.rb +2 -2
  36. data/lib/reek/smells/nil_check.rb +1 -1
  37. data/lib/reek/smells/prima_donna_method.rb +5 -2
  38. data/lib/reek/smells/repeated_conditional.rb +1 -1
  39. data/lib/reek/smells/smell_detector.rb +1 -1
  40. data/lib/reek/smells/smell_warning.rb +6 -5
  41. data/lib/reek/smells/subclassed_from_core_class.rb +3 -3
  42. data/lib/reek/smells/too_many_constants.rb +1 -1
  43. data/lib/reek/smells/too_many_instance_variables.rb +1 -1
  44. data/lib/reek/smells/too_many_methods.rb +1 -1
  45. data/lib/reek/smells/too_many_statements.rb +1 -1
  46. data/lib/reek/smells/uncommunicative_method_name.rb +1 -1
  47. data/lib/reek/smells/uncommunicative_module_name.rb +1 -1
  48. data/lib/reek/smells/uncommunicative_parameter_name.rb +1 -1
  49. data/lib/reek/smells/uncommunicative_variable_name.rb +1 -1
  50. data/lib/reek/smells/unused_parameters.rb +1 -1
  51. data/lib/reek/smells/unused_private_method.rb +1 -1
  52. data/lib/reek/smells/utility_function.rb +2 -3
  53. data/lib/reek/spec/should_reek_of.rb +14 -1
  54. data/lib/reek/version.rb +1 -1
  55. data/samples/checkstyle.xml +7 -0
  56. data/samples/clean.rb +6 -0
  57. data/samples/configuration/.reek +0 -0
  58. data/samples/configuration/corrupt.reek +1 -0
  59. data/samples/configuration/empty.reek +0 -0
  60. data/samples/configuration/full_configuration.reek +9 -0
  61. data/{spec/samples/configuration/simple_configuration.reek → samples/configuration/full_mask.reek} +2 -2
  62. data/samples/configuration/non_public_modifiers_mask.reek +3 -0
  63. data/samples/configuration/partial_mask.reek +3 -0
  64. data/samples/configuration/with_excluded_paths.reek +4 -0
  65. data/{spec/samples → samples}/exceptions.reek +0 -0
  66. data/{spec/samples → samples}/inline.rb +0 -0
  67. data/{spec/samples → samples}/optparse.rb +0 -0
  68. data/samples/paths.rb +4 -0
  69. data/{spec/samples → samples}/redcloth.rb +0 -0
  70. data/samples/smelly.rb +7 -0
  71. data/samples/smelly_with_inline_mask.rb +8 -0
  72. data/samples/smelly_with_modifiers.rb +12 -0
  73. data/{spec/samples → samples}/source_with_exclude_paths/ignore_me/uncommunicative_method_name.rb +0 -0
  74. data/{spec/samples → samples}/source_with_exclude_paths/nested/ignore_me_as_well/irresponsible_module.rb +0 -0
  75. data/{spec/samples → samples}/source_with_exclude_paths/nested/uncommunicative_parameter_name.rb +0 -0
  76. data/{spec/samples → samples}/source_with_hidden_directories/.hidden/uncommunicative_method_name.rb +0 -0
  77. data/{spec/samples → samples}/source_with_hidden_directories/uncommunicative_parameter_name.rb +0 -0
  78. data/{spec/samples → samples}/source_with_non_ruby_files/gibberish +0 -0
  79. data/{spec/samples → samples}/source_with_non_ruby_files/python_source.py +0 -0
  80. data/{spec/samples → samples}/source_with_non_ruby_files/uncommunicative_parameter_name.rb +0 -0
  81. data/spec/reek/cli/application_spec.rb +1 -1
  82. data/spec/reek/cli/command/report_command_spec.rb +2 -5
  83. data/spec/reek/configuration/app_configuration_spec.rb +10 -8
  84. data/spec/reek/configuration/configuration_file_finder_spec.rb +24 -17
  85. data/spec/reek/examiner_spec.rb +84 -5
  86. data/spec/reek/report/json_report_spec.rb +1 -3
  87. data/spec/reek/report/xml_report_spec.rb +2 -3
  88. data/spec/reek/report/yaml_report_spec.rb +0 -2
  89. data/spec/reek/smells/attribute_spec.rb +21 -10
  90. data/spec/reek/smells/boolean_parameter_spec.rb +13 -12
  91. data/spec/reek/smells/class_variable_spec.rb +4 -4
  92. data/spec/reek/smells/control_parameter_spec.rb +25 -18
  93. data/spec/reek/smells/data_clump_spec.rb +5 -5
  94. data/spec/reek/smells/duplicate_method_call_spec.rb +1 -1
  95. data/spec/reek/smells/feature_envy_spec.rb +8 -2
  96. data/spec/reek/smells/irresponsible_module_spec.rb +16 -14
  97. data/spec/reek/smells/long_parameter_list_spec.rb +5 -1
  98. data/spec/reek/smells/long_yield_list_spec.rb +5 -2
  99. data/spec/reek/smells/nested_iterators_spec.rb +37 -13
  100. data/spec/reek/smells/nil_check_spec.rb +50 -53
  101. data/spec/reek/smells/prima_donna_method_spec.rb +9 -1
  102. data/spec/reek/smells/too_many_instance_variables_spec.rb +1 -1
  103. data/spec/reek/smells/too_many_methods_spec.rb +4 -4
  104. data/spec/reek/smells/too_many_statements_spec.rb +1 -1
  105. data/spec/reek/smells/uncommunicative_method_name_spec.rb +3 -3
  106. data/spec/reek/smells/uncommunicative_module_name_spec.rb +3 -3
  107. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +3 -3
  108. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +3 -3
  109. data/spec/reek/smells/utility_function_spec.rb +12 -8
  110. data/spec/reek/source/source_locator_spec.rb +5 -1
  111. data/spec/reek/spec/should_reek_of_spec.rb +20 -13
  112. data/spec/reek/spec/should_reek_spec.rb +6 -11
  113. data/spec/spec_helper.rb +2 -2
  114. metadata +28 -36
  115. data/spec/samples/all_but_one_masked/clean_one.rb +0 -7
  116. data/spec/samples/all_but_one_masked/dirty.rb +0 -8
  117. data/spec/samples/all_but_one_masked/masked.reek +0 -9
  118. data/spec/samples/checkstyle.xml +0 -13
  119. data/spec/samples/clean_due_to_masking/clean_one.rb +0 -7
  120. data/spec/samples/clean_due_to_masking/clean_three.rb +0 -7
  121. data/spec/samples/clean_due_to_masking/clean_two.rb +0 -7
  122. data/spec/samples/clean_due_to_masking/dirty_one.rb +0 -7
  123. data/spec/samples/clean_due_to_masking/dirty_two.rb +0 -7
  124. data/spec/samples/clean_due_to_masking/masked.reek +0 -11
  125. data/spec/samples/configuration/full_configuration.reek +0 -9
  126. data/spec/samples/configuration/with_excluded_paths.reek +0 -4
  127. data/spec/samples/masked_by_dotfile/.reek +0 -9
  128. data/spec/samples/masked_by_dotfile/dirty.rb +0 -8
  129. data/spec/samples/no_config_file/dirty.rb +0 -8
  130. data/spec/samples/three_clean_files/clean_one.rb +0 -7
  131. data/spec/samples/three_clean_files/clean_three.rb +0 -7
  132. data/spec/samples/three_clean_files/clean_two.rb +0 -7
  133. data/spec/samples/two_smelly_files/dirty_one.rb +0 -8
  134. data/spec/samples/two_smelly_files/dirty_two.rb +0 -8
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- # smelly class for testing purposes
2
- class Dirty
3
- def a
4
- puts @s.title
5
- @s = fred.map {|x| x.each {|key| key += 3}}
6
- puts @s.title
7
- end
8
- end
@@ -1,9 +0,0 @@
1
- ---
2
- DuplicateMethodCall:
3
- enabled: false
4
- UncommunicativeVariableName:
5
- enabled: false
6
- UncommunicativeMethodName:
7
- enabled: false
8
- UncommunicativeParameterName:
9
- enabled: false
@@ -1,13 +0,0 @@
1
- <?xml version='1.0'?>
2
- <checkstyle>
3
- <file name='spec/samples/two_smelly_files/dirty_one.rb'>
4
- <error column='0' line='4' message='calls @s.title 2 times' severity='warning' source='DuplicateMethodCall'/>
5
- <error column='0' line='6' message='calls @s.title 2 times' severity='warning' source='DuplicateMethodCall'/>
6
- <error column='0' line='4' message='calls puts @s.title 2 times' severity='warning' source='DuplicateMethodCall'/>
7
- <error column='0' line='6' message='calls puts @s.title 2 times' severity='warning' source='DuplicateMethodCall'/>
8
- <error column='0' line='5' message='contains iterators nested 2 deep' severity='warning' source='NestedIterators'/>
9
- <error column='0' line='3' message='has the name &apos;a&apos;' severity='warning' source='UncommunicativeMethodName'/>
10
- <error column='0' line='5' message='has the variable name &apos;@s&apos;' severity='warning' source='UncommunicativeVariableName'/>
11
- <error column='0' line='5' message='has the variable name &apos;x&apos;' severity='warning' source='UncommunicativeVariableName'/>
12
- </file>
13
- </checkstyle>
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- class Dirty
2
- def a
3
- puts @s.title
4
- @s = fred.map {|x| x.each {|key| key += 3}}
5
- puts @s.title
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- class Dirty
2
- def a
3
- puts @s.title
4
- @s = fred.map {|x| x.each {|key| key += 3}}
5
- puts @s.title
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- ---
2
- DuplicateMethodCall:
3
- enabled: false
4
- IrresponsibleModule:
5
- enabled: false
6
- NestedIterators:
7
- enabled: false
8
- UncommunicativeVariableName:
9
- enabled: false
10
- UncommunicativeMethodName:
11
- enabled: false
@@ -1,9 +0,0 @@
1
- ---
2
- IrresponsibleModule:
3
- enabled: false
4
- "spec/samples/three_clean_files/":
5
- UtilityFunction:
6
- enabled: false
7
- exclude_paths:
8
- - "spec/samples/two_smelly_files/"
9
- - "spec/samples/source_with_non_ruby_files/"
@@ -1,4 +0,0 @@
1
- ---
2
- exclude_paths:
3
- - spec/samples/source_with_exclude_paths/ignore_me/
4
- - spec/samples/source_with_exclude_paths/nested/ignore_me_as_well
@@ -1,9 +0,0 @@
1
- ---
2
- DuplicateMethodCall:
3
- enabled: false
4
- UncommunicativeVariableName:
5
- enabled: false
6
- UncommunicativeMethodName:
7
- enabled: false
8
- UncommunicativeParameterName:
9
- enabled: false
@@ -1,8 +0,0 @@
1
- # smelly class for testing purposes
2
- class Dirty
3
- def a
4
- puts @s.title
5
- @s = fred.map {|x| x.each {|key| key += 3}}
6
- puts @s.title
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- # smelly class for testing purposes
2
- class Dirty
3
- def a
4
- puts @s.title
5
- @s = fred.map {|x| x.each {|key| key += 3}}
6
- puts @s.title
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # clean class for testing purposes
2
- class Clean
3
- def assign
4
- puts @sub.title
5
- @sub.map {|para| para.name }
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- # smelly class for testing purposes
2
- class Dirty
3
- def a
4
- puts @s.title
5
- @s = puts.map {|x| x.each {|key| key += 3}}
6
- puts @s.title
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- # smelly class for testing purposes
2
- class Dirty
3
- def a
4
- puts @s.title
5
- @s = p.map {|x| x.each {|key| key += 3}}
6
- puts @s.title
7
- end
8
- end