Class: Reek::SmellDetectors::IrresponsibleModule
- Inherits:
-
BaseDetector
- Object
- BaseDetector
- Reek::SmellDetectors::IrresponsibleModule
- Defined in:
- lib/reek/smell_detectors/irresponsible_module.rb
Overview
It is considered good practice to annotate every class and module with a brief comment outlining its responsibilities.
See Irresponsible-Module for details.
Constant Summary
Constants inherited from BaseDetector
BaseDetector::DEFAULT_EXCLUDE_SET, BaseDetector::EXCLUDE_KEY
Instance Attribute Summary
Attributes inherited from BaseDetector
Class Method Summary collapse
Instance Method Summary collapse
- #descriptive_context? ⇒ Boolean private
-
#sniff ⇒ Array<SmellWarning>
Checks the given class or module for a descriptive comment.
Methods inherited from BaseDetector
#config_for, configuration_keys, default_config, descendants, #enabled?, #exception?, #expression, inherited, #initialize, #run, #smell_type, smell_type, #smell_warning, #source_line, to_detector, todo_configuration_for, #value
Constructor Details
This class inherits a constructor from Reek::SmellDetectors::BaseDetector
Class Method Details
.contexts ⇒ Object
13 14 15 |
# File 'lib/reek/smell_detectors/irresponsible_module.rb', line 13 def self.contexts [:casgn, :class, :module] end |
Instance Method Details
#descriptive_context? ⇒ Boolean (private)
32 33 34 |
# File 'lib/reek/smell_detectors/irresponsible_module.rb', line 32 def descriptive_context? context.descriptively_commented? end |
#sniff ⇒ Array<SmellWarning>
Checks the given class or module for a descriptive comment.
22 23 24 25 26 27 28 |
# File 'lib/reek/smell_detectors/irresponsible_module.rb', line 22 def sniff return [] if descriptive_context? || context.namespace_module? [smell_warning( lines: [source_line], message: 'has no descriptive comment')] end |