Class: CodeHunter::Warning
- Inherits:
-
Object
- Object
- CodeHunter::Warning
- Defined in:
- lib/code_hunter/warning.rb
Instance Method Summary collapse
- #author ⇒ Object
- #email ⇒ Object
-
#git_metadata ⇒ Object
Fetch @git_metadata only once.
- #has_git_metadata? ⇒ Boolean
- #ignore? ⇒ Boolean
-
#initialize(attributes) ⇒ Warning
constructor
A new instance of Warning.
- #line ⇒ Object
- #message ⇒ Object
- #modified_at ⇒ Object
- #path ⇒ Object
- #service ⇒ Object
- #sha1 ⇒ Object
- #to_hash ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Warning
Returns a new instance of Warning.
3 4 5 |
# File 'lib/code_hunter/warning.rb', line 3 def initialize(attributes) @attributes = attributes end |
Instance Method Details
#author ⇒ Object
45 46 47 |
# File 'lib/code_hunter/warning.rb', line 45 def @git_metadata[:author] end |
#email ⇒ Object
49 50 51 |
# File 'lib/code_hunter/warning.rb', line 49 def email @git_metadata[:email] end |
#git_metadata ⇒ Object
Fetch @git_metadata only once.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/code_hunter/warning.rb', line 58 def case @git_metadata when nil @git_metadata = GitBlamer.new(@attributes).blame || false when false nil else @git_metadata end end |
#has_git_metadata? ⇒ Boolean
69 70 71 |
# File 'lib/code_hunter/warning.rb', line 69 def !! end |
#ignore? ⇒ Boolean
73 74 75 |
# File 'lib/code_hunter/warning.rb', line 73 def ignore? path && line && has_ignore_annotation? end |
#line ⇒ Object
21 22 23 |
# File 'lib/code_hunter/warning.rb', line 21 def line @attributes[:line] end |
#message ⇒ Object
25 26 27 |
# File 'lib/code_hunter/warning.rb', line 25 def @attributes[:message] end |
#modified_at ⇒ Object
53 54 55 |
# File 'lib/code_hunter/warning.rb', line 53 def modified_at @git_metadata[:modified_at] end |
#path ⇒ Object
29 30 31 |
# File 'lib/code_hunter/warning.rb', line 29 def path @attributes[:path] end |
#service ⇒ Object
33 34 35 |
# File 'lib/code_hunter/warning.rb', line 33 def service @attributes[:service] end |
#sha1 ⇒ Object
41 42 43 |
# File 'lib/code_hunter/warning.rb', line 41 def sha1 @git_metadata[:sha1] end |
#to_hash ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/code_hunter/warning.rb', line 7 def to_hash { :line => line, :message => , :path => path, :service => service, :url => url, :sha1 => sha1, :author => , :email => email, :modified_at => modified_at, } end |
#url ⇒ Object
37 38 39 |
# File 'lib/code_hunter/warning.rb', line 37 def url @attributes[:url] end |