Sha256: b9f77dc199f9876ec8eea31e2444a2847b7fa01dcc66eb587f3da9e25158d392
Contents?: true
Size: 925 Bytes
Versions: 3
Compression:
Stored size: 925 Bytes
Contents
module Reek module Source # # A comment header from an abstract syntax tree; found directly above # module, class and method definitions. # class CodeComment CONFIG_REGEX = /:reek:(\w+)(:\s*\{.*?\})?/ def initialize(text) @text = text.gsub(CONFIG_REGEX) do add_to_config($1, $2) '' end.gsub(/#/, '').gsub(/\n/, '').strip end def config @config ||= Hash.new { |hash, key| hash[key] = {} } end def descriptive? @text.split(/\s+/).length >= 2 end protected def add_to_config(smell, options) options ||= ': { enabled: false }' config.merge! YAML.load(smell.gsub(/(?:^|_)(.)/) { $1.upcase } + options) # TODO: extend this to all configs -------------------^ # TODO: extend to allow configuration of whole smell class, not just subclass end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reek-1.5.1 | lib/reek/source/code_comment.rb |
reek-1.5.0 | lib/reek/source/code_comment.rb |
reek-1.4.0 | lib/reek/source/code_comment.rb |