Sha256: 64448327f1bc0322cac25eb7e73b7f10ee89ec1c5e075a9ca6223eb91597abb0
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require File.join( File.dirname( File.expand_path(__FILE__)), 'smell_detector') require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'source') 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 = self.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.is_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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-1.3.1 | lib/reek/smells/irresponsible_module.rb |
reek-1.3 | lib/reek/smells/irresponsible_module.rb |