Class: RubyCritic::Smell
- Inherits:
-
Object
- Object
- RubyCritic::Smell
- Defined in:
- lib/rubycritic/core/smell.rb
Constant Summary collapse
- FLAY_DOCS_URL =
'http://docs.seattlerb.org/flay/'.freeze
- FLOG_DOCS_URL =
'http://docs.seattlerb.org/flog/'.freeze
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #at_location?(other_location) ⇒ Boolean
- #doc_url ⇒ Object
- #hash ⇒ Object
- #multiple_locations? ⇒ Boolean
- #to_h ⇒ Object
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
29 30 31 |
# File 'lib/rubycritic/core/smell.rb', line 29 def ==(other) state == other.state end |
#at_location?(other_location) ⇒ Boolean
21 22 23 |
# File 'lib/rubycritic/core/smell.rb', line 21 def at_location?(other_location) locations.any? { |location| location == other_location } end |
#doc_url ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rubycritic/core/smell.rb', line 54 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 ⇒ Object
67 68 69 |
# File 'lib/rubycritic/core/smell.rb', line 67 def hash state.hash end |
#multiple_locations? ⇒ Boolean
25 26 27 |
# File 'lib/rubycritic/core/smell.rb', line 25 def multiple_locations? locations.length > 1 end |
#to_h ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubycritic/core/smell.rb', line 38 def to_h { context: context, cost: cost, locations: locations, message: , score: score, status: status, type: type } end |
#to_json(*a) ⇒ Object
50 51 52 |
# File 'lib/rubycritic/core/smell.rb', line 50 def to_json(*a) to_h.to_json(*a) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/rubycritic/core/smell.rb', line 34 def to_s "(#{type}) #{context} #{}" end |