Class: CleoQualityReview::Checks::QualityCheck
- Inherits:
-
Object
- Object
- CleoQualityReview::Checks::QualityCheck
- Defined in:
- lib/cleo_quality_review/checks/quality_check.rb
Overview
Base class for quality check implementations
Class Attribute Summary collapse
-
.check_name ⇒ String
Identifier for this check.
-
.output_extension ⇒ String
File extension for raw output.
-
.tool_name ⇒ String
Tool name for result attribution.
-
.tool_type ⇒ String
Category for this tool’s findings.
Class Method Summary collapse
-
.inherited(subclass) ⇒ void
Set default output extension for subclasses.
- .output_metadata ⇒ Object
Instance Method Summary collapse
-
#initialize(command_runner:, timestamp:) ⇒ QualityCheck
constructor
A new instance of QualityCheck.
-
#run(files) ⇒ CheckOutput
Run the quality check on the given files.
Constructor Details
#initialize(command_runner:, timestamp:) ⇒ QualityCheck
Returns a new instance of QualityCheck.
52 53 54 55 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 52 def initialize(command_runner:, timestamp:) @command_runner = command_runner @timestamp = end |
Class Attribute Details
.check_name ⇒ String
Returns identifier for this check.
16 17 18 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 16 def check_name @check_name end |
.output_extension ⇒ String
Returns file extension for raw output.
28 29 30 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 28 def output_extension @output_extension end |
.tool_name ⇒ String
Returns tool name for result attribution.
20 21 22 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 20 def tool_name @tool_name end |
.tool_type ⇒ String
Returns category for this tool’s findings.
24 25 26 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 24 def tool_type @tool_type end |
Class Method Details
.inherited(subclass) ⇒ void
This method returns an undefined value.
Set default output extension for subclasses
34 35 36 37 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 34 def inherited(subclass) super subclass.output_extension = "txt" end |
.output_metadata ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 39 def { check_name: check_name, tool_name: tool_name, tool_type: tool_type, extension: output_extension, } end |
Instance Method Details
#run(files) ⇒ CheckOutput
Run the quality check on the given files
61 62 63 64 65 66 67 68 69 |
# File 'lib/cleo_quality_review/checks/quality_check.rb', line 61 def run(files) return empty_output if files.empty? command_result = command_runner.run(*command(files)) build_output( raw_output: raw_output(command_result), results: parse(command_result.stdout, parseable_stderr(command_result)), ) end |