Class: ImproveYourCode::SmellDetectors::UncommunicativeMethodName
- Inherits:
-
BaseDetector
- Object
- BaseDetector
- ImproveYourCode::SmellDetectors::UncommunicativeMethodName
- Defined in:
- lib/improve_your_code/smell_detectors/uncommunicative_method_name.rb
Constant Summary collapse
- REJECT_KEY =
'reject'
- ACCEPT_KEY =
'accept'
- DEFAULT_REJECT_PATTERNS =
[/^[a-z]$/, /[0-9]$/, /[A-Z]/].freeze
- DEFAULT_ACCEPT_PATTERNS =
[].freeze
Constants inherited from BaseDetector
Instance Attribute Summary
Attributes inherited from BaseDetector
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseDetector
configuration_keys, contexts, descendants, inherited, #initialize, #run, #smell_type, smell_type, to_detector, todo_configuration_for, valid_detector?
Constructor Details
This class inherits a constructor from ImproveYourCode::SmellDetectors::BaseDetector
Class Method Details
.default_config ⇒ Object
13 14 15 16 17 18 |
# File 'lib/improve_your_code/smell_detectors/uncommunicative_method_name.rb', line 13 def self.default_config super.merge( REJECT_KEY => DEFAULT_REJECT_PATTERNS, ACCEPT_KEY => DEFAULT_ACCEPT_PATTERNS ) end |
Instance Method Details
#sniff ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/improve_your_code/smell_detectors/uncommunicative_method_name.rb', line 20 def sniff name = context.name.to_s return [] if acceptable_name?(name) [ smell_warning( context: context, lines: [source_line], message: "has the name '#{name}'", parameters: { name: name } ) ] end |