Class: CleoQualityReview::Run
- Inherits:
-
Struct
- Object
- Struct
- CleoQualityReview::Run
- Defined in:
- lib/cleo_quality_review/run.rb
Overview
Value object representing a quality review run with its configuration and results
Instance Attribute Summary collapse
-
#artifacts ⇒ RunArtifacts?
readonly
Artifacts associated with this run.
-
#base_ref ⇒ Object
Returns the value of attribute base_ref.
-
#checks ⇒ Array<String>
readonly
Names of checks that were run.
-
#format ⇒ String
readonly
Output format (human, agent, github).
-
#log ⇒ Object
Returns the value of attribute log.
-
#results ⇒ Array<Result>
readonly
Findings from the quality checks.
-
#review_id ⇒ String
readonly
Deterministic identifier for the reviewed diff.
-
#ruby_files ⇒ Array<String>
readonly
Ruby file paths that were analyzed.
-
#run_directory ⇒ String
readonly
Path to the directory containing run artifacts.
-
#target_files ⇒ Array<String>
readonly
File paths that were analyzed.
-
#timestamp ⇒ Integer
readonly
Epoch milliseconds when the run started.
Instance Method Summary collapse
-
#check_outputs ⇒ Array<Hash{Symbol => String}>
Build array of check output hashes for serialization.
-
#manifest_data ⇒ Hash{Symbol => Object}
Build manifest data for artifact persistence.
-
#reviewable? ⇒ Boolean
Whether the run has any files to review.
-
#to_h ⇒ Hash{Symbol => Object}
Convert the run to a hash representation.
Instance Attribute Details
#artifacts ⇒ RunArtifacts? (readonly)
Returns artifacts associated with this run.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#base_ref ⇒ Object
Returns the value of attribute base_ref
27 28 29 |
# File 'lib/cleo_quality_review/run.rb', line 27 def base_ref @base_ref end |
#checks ⇒ Array<String> (readonly)
Returns names of checks that were run.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#format ⇒ String (readonly)
Returns output format (human, agent, github).
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#log ⇒ Object
Returns the value of attribute log
27 28 29 |
# File 'lib/cleo_quality_review/run.rb', line 27 def log @log end |
#results ⇒ Array<Result> (readonly)
Returns findings from the quality checks.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#review_id ⇒ String (readonly)
Returns deterministic identifier for the reviewed diff.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#ruby_files ⇒ Array<String> (readonly)
Returns Ruby file paths that were analyzed.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#run_directory ⇒ String (readonly)
Returns path to the directory containing run artifacts.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#target_files ⇒ Array<String> (readonly)
Returns file paths that were analyzed.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
#timestamp ⇒ Integer (readonly)
Returns epoch milliseconds when the run started.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cleo_quality_review/run.rb', line 27 Run = Struct.new( :timestamp, :review_id, :base_ref, :format, :checks, :target_files, :ruby_files, :run_directory, :results, :artifacts, :log, keyword_init: true, ) do ## # Whether the run has any files to review. Runs with no target files # (e.g. a branch that only changes non-Ruby files) have nothing to analyse. # @return [Boolean] def reviewable? !Array(target_files).empty? end ## # Convert the run to a hash representation # @return [Hash{Symbol => Object}] def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end ## # Build array of check output hashes for serialization # @return [Array<Hash{Symbol => String}>] def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end ## # Build manifest data for artifact persistence # @return [Hash{Symbol => Object}] def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end private def comparison_base_ref base_ref || GitDiffBase::DEFAULT_BASE_REF end end |
Instance Method Details
#check_outputs ⇒ Array<Hash{Symbol => String}>
Build array of check output hashes for serialization
71 72 73 74 75 |
# File 'lib/cleo_quality_review/run.rb', line 71 def check_outputs return [] unless artifacts artifacts.raw_check_output_records.map(&:to_h) end |
#manifest_data ⇒ Hash{Symbol => Object}
Build manifest data for artifact persistence
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/cleo_quality_review/run.rb', line 80 def manifest_data { review_id: review_id, base_ref: comparison_base_ref, timestamp: , checks: checks, target_files: target_files, ruby_files: ruby_files, } end |
#reviewable? ⇒ Boolean
Whether the run has any files to review. Runs with no target files (e.g. a branch that only changes non-Ruby files) have nothing to analyse.
45 46 47 |
# File 'lib/cleo_quality_review/run.rb', line 45 def reviewable? !Array(target_files).empty? end |
#to_h ⇒ Hash{Symbol => Object}
Convert the run to a hash representation
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cleo_quality_review/run.rb', line 52 def to_h { timestamp: , review_id: review_id, base_ref: comparison_base_ref, format: format, checks: checks, target_files: target_files, ruby_files: ruby_files, run_directory: run_directory, changes_diff: artifacts&.changes_diff, check_outputs: check_outputs, findings: Array(results).map(&:to_h), } end |