Sha256: 7615da9f6b44e7f205ed295f9174ff235fda3263373317997dabf5a5b83f5d3f
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require 'reek/smells/smell_detector' require 'reek/smell_warning' require 'reek/source/code_comment' module Reek module Smells # # It is considered good practice to annotate every class and module # with a brief comment outlining its responsibilities. # class IrresponsibleModule < SmellDetector SMELL_CLASS = name.split(/::/)[-1] SMELL_SUBCLASS = SMELL_CLASS MODULE_NAME_KEY = 'module_name' def self.contexts # :nodoc: [:class] end def self.descriptive # :nodoc: @descriptive ||= {} end # # Checks the given class or module for a descriptive comment. # # @return [Array<SmellWarning>] # def examine_context(ctx) comment = Source::CodeComment.new(ctx.exp.comments) return [] if self.class.descriptive[ctx.full_name] ||= comment.descriptive? smell = SmellWarning.new(SMELL_CLASS, ctx.full_name, [ctx.exp.line], 'has no descriptive comment', @source, SMELL_SUBCLASS, MODULE_NAME_KEY => ctx.exp.text_name) [smell] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reek-1.5.1 | lib/reek/smells/irresponsible_module.rb |
reek-1.5.0 | lib/reek/smells/irresponsible_module.rb |
reek-1.4.0 | lib/reek/smells/irresponsible_module.rb |