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(*options) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
30 31 32 |
# File 'lib/rubycritic/core/smell.rb', line 30 def ==(other) state == other.state end |
#at_location?(other_location) ⇒ Boolean
22 23 24 |
# File 'lib/rubycritic/core/smell.rb', line 22 def at_location?(other_location) locations.any?(other_location) end |
#doc_url ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# 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 ⇒ Object
68 69 70 |
# File 'lib/rubycritic/core/smell.rb', line 68 def hash state.hash end |
#multiple_locations? ⇒ Boolean
26 27 28 |
# File 'lib/rubycritic/core/smell.rb', line 26 def multiple_locations? locations.length > 1 end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rubycritic/core/smell.rb', line 39 def to_h { context: context, cost: cost, locations: locations, message: , score: score, status: status, type: type } end |
#to_json(*options) ⇒ Object
51 52 53 |
# File 'lib/rubycritic/core/smell.rb', line 51 def to_json(*) to_h.to_json(*) end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/rubycritic/core/smell.rb', line 35 def to_s "(#{type}) #{context} #{}" end |