Class: CleoQualityReview::Result
- Inherits:
-
Struct
- Object
- Struct
- CleoQualityReview::Result
- Defined in:
- lib/cleo_quality_review/result.rb
Overview
Value object representing a single finding from a quality check
Instance Attribute Summary collapse
-
#check ⇒ String
readonly
Specific check or rule that triggered.
-
#filepath ⇒ String?
readonly
Path to the file with the issue.
-
#line ⇒ Integer?
readonly
Line number of the issue.
-
#result ⇒ String
readonly
Description of the finding.
-
#timestamp ⇒ Integer
readonly
Epoch milliseconds when the check ran.
-
#tool_name ⇒ String
readonly
Name of the tool that produced this result.
-
#tool_type ⇒ String
readonly
Category for the tool that produced this result.
Class Method Summary collapse
Instance Method Summary collapse
-
#to_h ⇒ Hash{Symbol => Object}
Convert the result to a hash, omitting nil values.
Instance Attribute Details
#check ⇒ String (readonly)
Returns specific check or rule that triggered.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
#filepath ⇒ String? (readonly)
Returns path to the file with the issue.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
#line ⇒ Integer? (readonly)
Returns line number of the issue.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
#result ⇒ String (readonly)
Returns description of the finding.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
#timestamp ⇒ Integer (readonly)
Returns epoch milliseconds when the check ran.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
#tool_name ⇒ String (readonly)
Returns name of the tool that produced this result.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
#tool_type ⇒ String (readonly)
Returns category for the tool that produced this result.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cleo_quality_review/result.rb', line 21 Result = Struct.new( :tool_name, :tool_type, :check, :timestamp, :result, :filepath, :line, keyword_init: true, ) do def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end ## # Convert the result to a hash, omitting nil values # @return [Hash{Symbol => Object}] def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end end |
Class Method Details
.from_h(hash) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cleo_quality_review/result.rb', line 31 def self.from_h(hash) new( tool_name: hash["tool_name"] || hash["tool"], tool_type: hash["tool_type"], check: hash["check"], timestamp: hash["timestamp"], result: hash["result"], filepath: hash["filepath"], line: hash["line"], ) end |
Instance Method Details
#to_h ⇒ Hash{Symbol => Object}
Convert the result to a hash, omitting nil values
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cleo_quality_review/result.rb', line 46 def to_h { tool_name: tool_name, tool_type: tool_type, check: check, timestamp: , result: result, filepath: filepath, line: line, }.compact end |