reek 4.4.2 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +10 -1
  3. data/CHANGELOG.md +16 -0
  4. data/CONTRIBUTING.md +52 -23
  5. data/README.md +16 -3
  6. data/ataru_setup.rb +1 -1
  7. data/docs/API.md +1 -4
  8. data/docs/How-reek-works-internally.md +5 -5
  9. data/docs/Style-Guide.md +7 -0
  10. data/features/command_line_interface/options.feature +1 -0
  11. data/features/command_line_interface/show_progress.feature +33 -0
  12. data/features/configuration_files/masking_smells.feature +0 -1
  13. data/features/configuration_via_source_comments/erroneous_source_comments.feature +18 -4
  14. data/features/configuration_via_source_comments/well_formed_source_comments.feature +116 -0
  15. data/features/step_definitions/sample_file_steps.rb +5 -0
  16. data/features/todo_list.feature +42 -14
  17. data/lib/reek.rb +1 -1
  18. data/lib/reek/cli/application.rb +5 -0
  19. data/lib/reek/cli/command/report_command.rb +6 -1
  20. data/lib/reek/cli/command/todo_list_command.rb +1 -2
  21. data/lib/reek/cli/options.rb +19 -3
  22. data/lib/reek/code_comment.rb +83 -11
  23. data/lib/reek/configuration/configuration_validator.rb +2 -2
  24. data/lib/reek/errors/bad_detector_in_comment_error.rb +35 -0
  25. data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +34 -0
  26. data/lib/reek/examiner.rb +36 -14
  27. data/lib/reek/report.rb +28 -9
  28. data/lib/reek/report/base_report.rb +77 -0
  29. data/lib/reek/report/code_climate.rb +4 -0
  30. data/lib/reek/report/code_climate/code_climate_fingerprint.rb +48 -0
  31. data/lib/reek/report/code_climate/code_climate_formatter.rb +5 -0
  32. data/lib/reek/report/code_climate/code_climate_report.rb +19 -0
  33. data/lib/reek/report/formatter.rb +5 -56
  34. data/lib/reek/report/{heading_formatter.rb → formatter/heading_formatter.rb} +4 -4
  35. data/lib/reek/report/formatter/location_formatter.rb +41 -0
  36. data/lib/reek/report/formatter/progress_formatter.rb +80 -0
  37. data/lib/reek/report/formatter/simple_warning_formatter.rb +35 -0
  38. data/lib/reek/report/formatter/wiki_link_warning_formatter.rb +35 -0
  39. data/lib/reek/report/html_report.rb +21 -0
  40. data/lib/reek/report/{html_report.html.erb → html_report/html_report.html.erb} +0 -0
  41. data/lib/reek/report/json_report.rb +18 -0
  42. data/lib/reek/report/text_report.rb +68 -0
  43. data/lib/reek/report/xml_report.rb +61 -0
  44. data/lib/reek/report/yaml_report.rb +18 -0
  45. data/lib/reek/smell_detectors.rb +30 -0
  46. data/lib/reek/{smells → smell_detectors}/attribute.rb +3 -3
  47. data/lib/reek/{smells/smell_detector.rb → smell_detectors/base_detector.rb} +3 -3
  48. data/lib/reek/{smells → smell_detectors}/boolean_parameter.rb +3 -3
  49. data/lib/reek/{smells → smell_detectors}/class_variable.rb +3 -3
  50. data/lib/reek/{smells → smell_detectors}/control_parameter.rb +3 -3
  51. data/lib/reek/{smells → smell_detectors}/data_clump.rb +3 -3
  52. data/lib/reek/{smells/smell_repository.rb → smell_detectors/detector_repository.rb} +9 -9
  53. data/lib/reek/{smells → smell_detectors}/duplicate_method_call.rb +3 -3
  54. data/lib/reek/{smells → smell_detectors}/feature_envy.rb +3 -3
  55. data/lib/reek/{smells → smell_detectors}/instance_variable_assumption.rb +3 -3
  56. data/lib/reek/{smells → smell_detectors}/irresponsible_module.rb +3 -3
  57. data/lib/reek/{smells → smell_detectors}/long_parameter_list.rb +3 -3
  58. data/lib/reek/{smells → smell_detectors}/long_yield_list.rb +3 -3
  59. data/lib/reek/{smells → smell_detectors}/manual_dispatch.rb +3 -3
  60. data/lib/reek/{smells → smell_detectors}/module_initialize.rb +3 -3
  61. data/lib/reek/{smells → smell_detectors}/nested_iterators.rb +3 -3
  62. data/lib/reek/{smells → smell_detectors}/nil_check.rb +3 -3
  63. data/lib/reek/{smells → smell_detectors}/prima_donna_method.rb +3 -3
  64. data/lib/reek/{smells → smell_detectors}/repeated_conditional.rb +3 -3
  65. data/lib/reek/{smells → smell_detectors}/smell_configuration.rb +1 -1
  66. data/lib/reek/{smells → smell_detectors}/smell_warning.rb +1 -1
  67. data/lib/reek/{smells → smell_detectors}/subclassed_from_core_class.rb +3 -3
  68. data/lib/reek/{smells → smell_detectors}/too_many_constants.rb +3 -3
  69. data/lib/reek/{smells → smell_detectors}/too_many_instance_variables.rb +3 -3
  70. data/lib/reek/{smells → smell_detectors}/too_many_methods.rb +3 -3
  71. data/lib/reek/{smells → smell_detectors}/too_many_statements.rb +3 -3
  72. data/lib/reek/{smells → smell_detectors}/uncommunicative_method_name.rb +3 -3
  73. data/lib/reek/{smells → smell_detectors}/uncommunicative_module_name.rb +3 -3
  74. data/lib/reek/{smells → smell_detectors}/uncommunicative_parameter_name.rb +3 -3
  75. data/lib/reek/{smells → smell_detectors}/uncommunicative_variable_name.rb +3 -3
  76. data/lib/reek/{smells → smell_detectors}/unused_parameters.rb +3 -3
  77. data/lib/reek/{smells → smell_detectors}/unused_private_method.rb +3 -3
  78. data/lib/reek/{smells → smell_detectors}/utility_function.rb +3 -3
  79. data/lib/reek/spec/should_reek_of.rb +1 -1
  80. data/lib/reek/version.rb +1 -1
  81. data/reek.gemspec +1 -1
  82. data/spec/factories/factories.rb +6 -6
  83. data/spec/reek/cli/command/report_command_spec.rb +3 -1
  84. data/spec/reek/cli/options_spec.rb +12 -2
  85. data/spec/reek/code_comment_spec.rb +18 -6
  86. data/spec/reek/configuration/app_configuration_spec.rb +12 -12
  87. data/spec/reek/configuration/default_directive_spec.rb +1 -1
  88. data/spec/reek/configuration/directory_directives_spec.rb +2 -2
  89. data/spec/reek/examiner_spec.rb +56 -28
  90. data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +122 -0
  91. data/spec/reek/report/{code_climate_formatter_spec.rb → code_climate/code_climate_formatter_spec.rb} +6 -2
  92. data/spec/reek/report/{code_climate_report_spec.rb → code_climate/code_climate_report_spec.rb} +7 -5
  93. data/spec/reek/report/{location_formatter_spec.rb → formatter/location_formatter_spec.rb} +4 -4
  94. data/spec/reek/report/formatter/progress_formatter_spec.rb +68 -0
  95. data/spec/reek/report/html_report_spec.rb +1 -1
  96. data/spec/reek/report/json_report_spec.rb +2 -2
  97. data/spec/reek/report/text_report_spec.rb +3 -4
  98. data/spec/reek/report/xml_report_spec.rb +1 -1
  99. data/spec/reek/report/yaml_report_spec.rb +2 -2
  100. data/spec/reek/report_spec.rb +3 -3
  101. data/spec/reek/{smells → smell_detectors}/attribute_spec.rb +2 -2
  102. data/spec/reek/{smells/smell_detector_spec.rb → smell_detectors/base_detector_spec.rb} +5 -5
  103. data/spec/reek/{smells → smell_detectors}/boolean_parameter_spec.rb +2 -2
  104. data/spec/reek/{smells → smell_detectors}/class_variable_spec.rb +2 -2
  105. data/spec/reek/{smells → smell_detectors}/control_parameter_spec.rb +2 -2
  106. data/spec/reek/{smells → smell_detectors}/data_clump_spec.rb +2 -2
  107. data/spec/reek/smell_detectors/detector_repository_spec.rb +22 -0
  108. data/spec/reek/{smells → smell_detectors}/duplicate_method_call_spec.rb +6 -6
  109. data/spec/reek/{smells → smell_detectors}/feature_envy_spec.rb +2 -2
  110. data/spec/reek/{smells → smell_detectors}/instance_variable_assumption_spec.rb +2 -2
  111. data/spec/reek/{smells → smell_detectors}/irresponsible_module_spec.rb +2 -2
  112. data/spec/reek/{smells → smell_detectors}/long_parameter_list_spec.rb +2 -2
  113. data/spec/reek/{smells → smell_detectors}/long_yield_list_spec.rb +2 -2
  114. data/spec/reek/{smells → smell_detectors}/manual_dispatch_spec.rb +2 -2
  115. data/spec/reek/{smells → smell_detectors}/module_initialize_spec.rb +2 -2
  116. data/spec/reek/{smells → smell_detectors}/nested_iterators_spec.rb +4 -4
  117. data/spec/reek/{smells → smell_detectors}/nil_check_spec.rb +2 -2
  118. data/spec/reek/{smells → smell_detectors}/prima_donna_method_spec.rb +2 -2
  119. data/spec/reek/{smells → smell_detectors}/repeated_conditional_spec.rb +2 -2
  120. data/spec/reek/{smells → smell_detectors}/smell_configuration_spec.rb +2 -2
  121. data/spec/reek/{smells → smell_detectors}/smell_warning_spec.rb +3 -3
  122. data/spec/reek/{smells → smell_detectors}/subclassed_from_core_class_spec.rb +2 -2
  123. data/spec/reek/{smells → smell_detectors}/too_many_constants_spec.rb +3 -3
  124. data/spec/reek/{smells → smell_detectors}/too_many_instance_variables_spec.rb +3 -3
  125. data/spec/reek/{smells → smell_detectors}/too_many_methods_spec.rb +3 -3
  126. data/spec/reek/{smells → smell_detectors}/too_many_statements_spec.rb +3 -3
  127. data/spec/reek/{smells → smell_detectors}/uncommunicative_method_name_spec.rb +2 -2
  128. data/spec/reek/{smells → smell_detectors}/uncommunicative_module_name_spec.rb +2 -2
  129. data/spec/reek/{smells → smell_detectors}/uncommunicative_parameter_name_spec.rb +2 -2
  130. data/spec/reek/{smells → smell_detectors}/uncommunicative_variable_name_spec.rb +2 -2
  131. data/spec/reek/{smells → smell_detectors}/unused_parameters_spec.rb +2 -2
  132. data/spec/reek/{smells → smell_detectors}/unused_private_method_spec.rb +4 -4
  133. data/spec/reek/{smells → smell_detectors}/utility_function_spec.rb +3 -3
  134. data/spec/reek/spec/should_reek_of_spec.rb +3 -3
  135. data/tasks/configuration.rake +2 -2
  136. metadata +95 -81
  137. data/features/smells/subclassed_from_core_class.feature +0 -14
  138. data/features/smells/too_many_constants.feature +0 -19
  139. data/lib/reek/errors.rb +0 -32
  140. data/lib/reek/report/location_formatter.rb +0 -39
  141. data/lib/reek/report/report.rb +0 -229
  142. data/lib/reek/smells.rb +0 -30
  143. data/spec/reek/smells/smell_repository_spec.rb +0 -22
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # Duplication occurs when two fragments of code look nearly identical,
9
9
  # or when two fragments of code have nearly identical effects
@@ -18,7 +18,7 @@ module Reek
18
18
  # end
19
19
  #
20
20
  # See {file:docs/Duplicate-Method-Call.md} for details.
21
- class DuplicateMethodCall < SmellDetector
21
+ class DuplicateMethodCall < BaseDetector
22
22
  # The name of the config field that sets the maximum number of
23
23
  # identical calls to be permitted within any single method.
24
24
  MAX_ALLOWED_CALLS_KEY = 'max_calls'.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # Feature Envy occurs when a code fragment references another object
9
9
  # more often than it references itself, or when several clients do
@@ -35,7 +35,7 @@ module Reek
35
35
  # reported instead.
36
36
  #
37
37
  # See {file:docs/Feature-Envy.md} for details.
38
- class FeatureEnvy < SmellDetector
38
+ class FeatureEnvy < BaseDetector
39
39
  #
40
40
  # Checks whether the given +context+ includes any code fragment that
41
41
  # might "belong" on another class.
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # The +InstanceVariableAssumption+ class is responsible for
9
9
  # detecting directly access of instance variables in a class
10
10
  # that does not define them in its initialize method.
11
11
  #
12
- class InstanceVariableAssumption < SmellDetector
12
+ class InstanceVariableAssumption < BaseDetector
13
13
  def self.contexts
14
14
  [:class]
15
15
  end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # It is considered good practice to annotate every class and module
9
9
  # with a brief comment outlining its responsibilities.
10
10
  #
11
11
  # See {file:docs/Irresponsible-Module.md} for details.
12
- class IrresponsibleModule < SmellDetector
12
+ class IrresponsibleModule < BaseDetector
13
13
  def self.contexts
14
14
  [:casgn, :class, :module]
15
15
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative 'smell_configuration'
3
- require_relative 'smell_detector'
3
+ require_relative 'base_detector'
4
4
  require_relative 'smell_warning'
5
5
 
6
6
  module Reek
7
- module Smells
7
+ module SmellDetectors
8
8
  #
9
9
  # A Long Parameter List occurs when a method has more than one
10
10
  # or two parameters, or when a method yields more than one or
@@ -14,7 +14,7 @@ module Reek
14
14
  # many parameters.
15
15
  #
16
16
  # See {file:docs/Long-Parameter-List.md} for details.
17
- class LongParameterList < SmellDetector
17
+ class LongParameterList < BaseDetector
18
18
  # The name of the config field that sets the maximum number of
19
19
  # parameters permitted in any method or block.
20
20
  MAX_ALLOWED_PARAMS_KEY = 'max_params'.freeze
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A variant on LongParameterList that checks the number of items
9
9
  # passed to a block by a +yield+ call.
10
10
  #
11
11
  # See {file:docs/Long-Yield-List.md} for details.
12
- class LongYieldList < SmellDetector
12
+ class LongYieldList < BaseDetector
13
13
  # The name of the config field that sets the maximum number of
14
14
  # parameters permitted in any method or block.
15
15
  MAX_ALLOWED_PARAMS_KEY = 'max_params'.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A Manual Dispatch occurs when a method is only called after a
9
9
  # manual check that the method receiver is of the correct type.
@@ -11,7 +11,7 @@ module Reek
11
11
  # The +ManualDispatch+ checker reports any invocation of +respond_to?+
12
12
  #
13
13
  # See {file:docs/Manual-Dispatch.md} for details.
14
- class ManualDispatch < SmellDetector
14
+ class ManualDispatch < BaseDetector
15
15
  MESSAGE = 'manually dispatches method call'.freeze
16
16
 
17
17
  #
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # a module is usually a mixin, so when initialize method is present it is
9
9
  # hard to tell initialization order and parameters so having 'initialize'
10
10
  # in a module is usually a bad idea
11
11
  #
12
12
  # See {file:docs/Module-Initialize.md} for details.
13
- class ModuleInitialize < SmellDetector
13
+ class ModuleInitialize < BaseDetector
14
14
  def self.contexts # :nodoc:
15
15
  [:module]
16
16
  end
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A Nested Iterator occurs when a block contains another block.
9
9
  #
10
10
  # +NestedIterators+ reports failing methods only once.
11
11
  #
12
12
  # See {file:docs/Nested-Iterators.md} for details.
13
- class NestedIterators < SmellDetector
13
+ class NestedIterators < BaseDetector
14
14
  # Struct for conveniently associating iterators with their depth (that is, their nesting).
15
15
  Iterator = Struct.new :exp, :depth do
16
16
  def line
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  # Checking for nil is a special kind of type check, and therefore a case of
8
8
  # SimulatedPolymorphism.
9
9
  #
10
10
  # See {file:docs/Nil-Check.md} for details.
11
- class NilCheck < SmellDetector
11
+ class NilCheck < BaseDetector
12
12
  def sniff(ctx)
13
13
  lines = NodeDetector.new(ctx).detect.map(&:line)
14
14
  if lines.any?
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  # Excerpt from:
8
8
  # http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist
9
9
  # since this sums it up really well:
@@ -24,7 +24,7 @@ module Reek
24
24
  # Such a method is called PrimaDonnaMethod and is reported as a smell.
25
25
  #
26
26
  # See {file:docs/Prima-Donna-Method.md} for details.
27
- class PrimaDonnaMethod < SmellDetector
27
+ class PrimaDonnaMethod < BaseDetector
28
28
  def self.contexts # :nodoc:
29
29
  [:class]
30
30
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative '../ast/node'
3
- require_relative 'smell_detector'
3
+ require_relative 'base_detector'
4
4
  require_relative 'smell_warning'
5
5
 
6
6
  module Reek
7
- module Smells
7
+ module SmellDetectors
8
8
  #
9
9
  # Simulated Polymorphism occurs when
10
10
  # * code uses a case statement (especially on a type field);
@@ -25,7 +25,7 @@ module Reek
25
25
  # testing the same value throughout a single class.
26
26
  #
27
27
  # See {file:docs/Repeated-Conditional.md} for details.
28
- class RepeatedConditional < SmellDetector
28
+ class RepeatedConditional < BaseDetector
29
29
  # The name of the config field that sets the maximum number of
30
30
  # identical conditionals permitted within any single class.
31
31
  MAX_IDENTICAL_IFS_KEY = 'max_ifs'.freeze
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Reek
3
- module Smells
3
+ module SmellDetectors
4
4
  #
5
5
  # Represents a single set of configuration options for a smell detector
6
6
  #
@@ -3,7 +3,7 @@ require 'forwardable'
3
3
 
4
4
  module Reek
5
5
  # @public
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # Reports a warning that a smell has been found.
9
9
  #
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # Subclassing core classes in Ruby can lead to unexpected side effects.
9
9
  # Knowing that Ruby has a core library, which is written in C, and a standard
@@ -12,7 +12,7 @@ module Reek
12
12
  #
13
13
  # Source: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
14
14
  #
15
- class SubclassedFromCoreClass < SmellDetector
15
+ class SubclassedFromCoreClass < BaseDetector
16
16
  CORE_CLASSES = ['Array', 'Hash', 'String'].freeze
17
17
 
18
18
  def self.contexts
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A Large Class is a class or module that has a large number of
9
9
  # instance variables, methods, constants or lines of code.
@@ -12,7 +12,7 @@ module Reek
12
12
  # configurable number of constants.
13
13
  #
14
14
  # See {file:docs/Too-Many-Constants.md} for details.
15
- class TooManyConstants < SmellDetector
15
+ class TooManyConstants < BaseDetector
16
16
  # The name of the config field that sets the maximum number
17
17
  # of constants permitted in a class.
18
18
  MAX_ALLOWED_CONSTANTS_KEY = 'max_constants'.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A Large Class is a class or module that has a large number of
9
9
  # instance variables, methods or lines of code.
@@ -12,7 +12,7 @@ module Reek
12
12
  # configurable number of instance variables.
13
13
  #
14
14
  # See {file:docs/Too-Many-Instance-Variables.md} for details.
15
- class TooManyInstanceVariables < SmellDetector
15
+ class TooManyInstanceVariables < BaseDetector
16
16
  # The name of the config field that sets the maximum number of instance
17
17
  # variables permitted in a class.
18
18
  MAX_ALLOWED_IVARS_KEY = 'max_instance_variables'.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A Large Class is a class or module that has a large number of
9
9
  # instance variables, methods or lines of code.
@@ -14,7 +14,7 @@ module Reek
14
14
  # modules.
15
15
  #
16
16
  # See {file:docs/Too-Many-Methods.md} for details.
17
- class TooManyMethods < SmellDetector
17
+ class TooManyMethods < BaseDetector
18
18
  # The name of the config field that sets the maximum number of methods
19
19
  # permitted in a class.
20
20
  MAX_ALLOWED_METHODS_KEY = 'max_methods'.freeze
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # A Long Method is any method that has a large number of lines.
9
9
  #
10
10
  # +TooManyStatements+ reports any method with more than 5 statements.
11
11
  #
12
12
  # See {file:docs/Too-Many-Statements.md} for details.
13
- class TooManyStatements < SmellDetector
13
+ class TooManyStatements < BaseDetector
14
14
  # The name of the config field that sets the maximum number of
15
15
  # statements permitted in any method.
16
16
  MAX_ALLOWED_STATEMENTS_KEY = 'max_statements'.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # An Uncommunicative Name is a name that doesn't communicate its intent
9
9
  # well enough.
@@ -19,7 +19,7 @@ module Reek
19
19
  # * names containing a capital letter (assuming camelCase)
20
20
  #
21
21
  # See {file:docs/Uncommunicative-Method-Name.md} for details.
22
- class UncommunicativeMethodName < SmellDetector
22
+ class UncommunicativeMethodName < BaseDetector
23
23
  REJECT_KEY = 'reject'.freeze
24
24
  ACCEPT_KEY = 'accept'.freeze
25
25
  DEFAULT_REJECT_PATTERNS = [/^[a-z]$/, /[0-9]$/, /[A-Z]/].freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # An Uncommunicative Name is a name that doesn't communicate its intent
9
9
  # well enough.
@@ -18,7 +18,7 @@ module Reek
18
18
  # * names ending with a number
19
19
  #
20
20
  # See {file:docs/Uncommunicative-Module-Name.md} for details.
21
- class UncommunicativeModuleName < SmellDetector
21
+ class UncommunicativeModuleName < BaseDetector
22
22
  # The name of the config field that lists the regexps of
23
23
  # smelly names to be reported.
24
24
  REJECT_KEY = 'reject'.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # An Uncommunicative Name is a name that doesn't communicate its intent
9
9
  # well enough.
@@ -20,7 +20,7 @@ module Reek
20
20
  # * names containing a capital letter (assuming camelCase)
21
21
  #
22
22
  # See {file:docs/Uncommunicative-Parameter-Name.md} for details.
23
- class UncommunicativeParameterName < SmellDetector
23
+ class UncommunicativeParameterName < BaseDetector
24
24
  REJECT_KEY = 'reject'.freeze
25
25
  DEFAULT_REJECT_PATTERNS = [/^.$/, /[0-9]$/, /[A-Z]/, /^_/].freeze
26
26
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'smell_detector'
2
+ require_relative 'base_detector'
3
3
  require_relative 'smell_warning'
4
4
 
5
5
  module Reek
6
- module Smells
6
+ module SmellDetectors
7
7
  #
8
8
  # An Uncommunicative Name is a name that doesn't communicate its intent
9
9
  # well enough.
@@ -22,7 +22,7 @@ module Reek
22
22
  # See {file:docs/Uncommunicative-Variable-Name.md} for details.
23
23
  #
24
24
  # :reek:DataClump: { max_copies: 4 }
25
- class UncommunicativeVariableName < SmellDetector
25
+ class UncommunicativeVariableName < BaseDetector
26
26
  # The name of the config field that lists the regexps of
27
27
  # smelly names to be reported.
28
28
  REJECT_KEY = 'reject'.freeze