class RubyCritic::Smell
Constants
- FLAY_DOCS_URL
- FLOG_DOCS_URL
Public Instance Methods
==(other)
click to toggle source
# File lib/rubycritic/core/smell.rb, line 30 def ==(other) state == other.state end
Also aliased as: eql?
at_location?(other_location)
click to toggle source
# File lib/rubycritic/core/smell.rb, line 22 def at_location?(other_location) locations.any?(other_location) end
doc_url()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 55 def doc_url case analyser when 'reek' "https://github.com/troessner/reek/blob/master/docs/#{dasherized_type}.md" when 'flay' FLAY_DOCS_URL when 'flog' FLOG_DOCS_URL else raise "No documentation URL set for analyser '#{analyser}' smells" end end
hash()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 68 def hash state.hash end
multiple_locations?()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 26 def multiple_locations? locations.length > 1 end
to_h()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 39 def to_h { context: context, cost: cost, locations: locations, message: message, score: score, status: status, type: type } end
to_json(*options)
click to toggle source
# File lib/rubycritic/core/smell.rb, line 51 def to_json(*options) to_h.to_json(*options) end
to_s()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 35 def to_s "(#{type}) #{context} #{message}" end
Protected Instance Methods
state()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 74 def state [context, message, score, type] end
Private Instance Methods
dasherized_type()
click to toggle source
# File lib/rubycritic/core/smell.rb, line 80 def dasherized_type type.gsub(/(?<!^)([A-Z])/, '-\1') end