Class: LintFu::Issue
- Inherits:
-
Object
show all
- Defined in:
- lib/lint_fu/issue.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(scan, file, sexp, confidence = 1.0) ⇒ Issue
Returns a new instance of Issue.
5
6
7
8
9
10
|
# File 'lib/lint_fu/issue.rb', line 5
def initialize(scan, file, sexp, confidence=1.0)
@scan = scan
@file = file
@sexp = sexp.deep_clone
self.confidence = confidence
end
|
Instance Attribute Details
#confidence ⇒ Object
Returns the value of attribute confidence.
3
4
5
|
# File 'lib/lint_fu/issue.rb', line 3
def confidence
@confidence
end
|
#file ⇒ Object
Returns the value of attribute file.
3
4
5
|
# File 'lib/lint_fu/issue.rb', line 3
def file
@file
end
|
#sexp ⇒ Object
Returns the value of attribute sexp.
3
4
5
|
# File 'lib/lint_fu/issue.rb', line 3
def sexp
@sexp
end
|
Instance Method Details
#brief ⇒ Object
20
21
22
|
# File 'lib/lint_fu/issue.rb', line 20
def brief
self.class.name.split('::')[-1].underscore.gsub('_', ' ').titleize
end
|
#detail ⇒ Object
24
25
26
|
# File 'lib/lint_fu/issue.rb', line 24
def detail
"There is an issue at #{file_basename}:#{line}."
end
|
#file_basename ⇒ Object
32
33
34
|
# File 'lib/lint_fu/issue.rb', line 32
def file_basename
File.basename(file)
end
|
#issue_hash ⇒ Object
36
37
38
|
# File 'lib/lint_fu/issue.rb', line 36
def issue_hash()
Digest::SHA1.hexdigest("#{self.class.name} - #{self.relative_file} - #{sexp.fingerprint}")
end
|
#line ⇒ Object
12
13
14
|
# File 'lib/lint_fu/issue.rb', line 12
def line
@sexp.line
end
|
#reference_info ⇒ Object
28
29
30
|
# File 'lib/lint_fu/issue.rb', line 28
def reference_info
"No reference information is available for #{brief}."
end
|
#relative_file ⇒ Object
16
17
18
|
# File 'lib/lint_fu/issue.rb', line 16
def relative_file
File.relative_path(@scan.fs_root, file)
end
|