Class: Reek::Smells::IrresponsibleModule Private
- Inherits:
-
SmellDetector
- Object
- SmellDetector
- Reek::Smells::IrresponsibleModule
- Defined in:
- lib/reek/smells/irresponsible_module.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
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 SmellDetector
SmellDetector::DEFAULT_EXCLUDE_SET, SmellDetector::EXCLUDE_KEY
Instance Attribute Summary
Attributes inherited from SmellDetector
Class Method Summary collapse
-
.contexts ⇒ Object
private
:nodoc:.
Instance Method Summary collapse
-
#descriptive ⇒ Object
private
:nodoc:.
- #descriptive?(ctx) ⇒ Boolean private
-
#examine_context(ctx) ⇒ Array<SmellWarning>
private
Checks the given class or module for a descriptive comment.
Methods inherited from SmellDetector
#config_for, #configure_with, default_config, default_smell_category, descendants, #enabled?, #enabled_for?, #examine, #exception?, #initialize, #register, #report_on, smell_category, #smell_category, smell_type, #smell_type, #value
Constructor Details
This class inherits a constructor from Reek::Smells::SmellDetector
Class Method Details
.contexts ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
:nodoc:
13 14 15 |
# File 'lib/reek/smells/irresponsible_module.rb', line 13 def self.contexts # :nodoc: [:class] end |
Instance Method Details
#descriptive ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
:nodoc:
17 18 19 |
# File 'lib/reek/smells/irresponsible_module.rb', line 17 def descriptive # :nodoc: @descriptive ||= {} end |
#descriptive?(ctx) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 |
# File 'lib/reek/smells/irresponsible_module.rb', line 36 def descriptive?(ctx) descriptive[ctx.full_name] ||= ctx.descriptively_commented? end |
#examine_context(ctx) ⇒ Array<SmellWarning>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks the given class or module for a descriptive comment.
26 27 28 29 30 31 32 33 34 |
# File 'lib/reek/smells/irresponsible_module.rb', line 26 def examine_context(ctx) return [] if descriptive?(ctx) expression = ctx.exp [SmellWarning.new(self, context: ctx.full_name, lines: [expression.line], message: 'has no descriptive comment', parameters: { name: expression.text_name })] end |