Class: CleoQualityReview::Run

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#artifactsRunArtifacts? (readonly)

Returns artifacts associated with this run.

Returns:

  • (RunArtifacts, nil)

    artifacts associated with this run



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#checksArray<String> (readonly)

Returns names of checks that were run.

Returns:

  • (Array<String>)

    names of checks that were run



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#formatString (readonly)

Returns output format (human, agent, github).

Returns:

  • (String)

    output format (human, agent, github)



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#logObject

Returns the value of attribute log

Returns:

  • (Object)

    the current value of log



25
26
27
# File 'lib/cleo_quality_review/run.rb', line 25

def log
  @log
end

#resultsArray<Result> (readonly)

Returns findings from the quality checks.

Returns:

  • (Array<Result>)

    findings from the quality checks



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#review_idString (readonly)

Returns deterministic identifier for the reviewed diff.

Returns:

  • (String)

    deterministic identifier for the reviewed diff



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#ruby_filesArray<String> (readonly)

Returns Ruby file paths that were analyzed.

Returns:

  • (Array<String>)

    Ruby file paths that were analyzed



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#run_directoryString (readonly)

Returns path to the directory containing run artifacts.

Returns:

  • (String)

    path to the directory containing run artifacts



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#target_filesArray<String> (readonly)

Returns file paths that were analyzed.

Returns:

  • (Array<String>)

    file paths that were analyzed



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

#timestampInteger (readonly)

Returns epoch milliseconds when the run started.

Returns:

  • (Integer)

    epoch milliseconds when the run started



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cleo_quality_review/run.rb', line 25

Run = Struct.new(
  :timestamp,
  :review_id,
  :format,
  :checks,
  :target_files,
  :ruby_files,
  :run_directory,
  :results,
  :artifacts,
  :log,
  keyword_init: true,
) do
  ##
  # Convert the run to a hash representation
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      timestamp: timestamp,
      review_id: review_id,
      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,
      timestamp: timestamp,
      checks: checks,
      target_files: target_files,
      ruby_files: ruby_files,
    }
  end
end

Instance Method Details

#check_outputsArray<Hash{Symbol => String}>

Build array of check output hashes for serialization

Returns:

  • (Array<Hash{Symbol => String}>)


59
60
61
62
63
# File 'lib/cleo_quality_review/run.rb', line 59

def check_outputs
  return [] unless artifacts

  artifacts.raw_check_output_records.map(&:to_h)
end

#manifest_dataHash{Symbol => Object}

Build manifest data for artifact persistence

Returns:

  • (Hash{Symbol => Object})


68
69
70
71
72
73
74
75
76
# File 'lib/cleo_quality_review/run.rb', line 68

def manifest_data
  {
    review_id: review_id,
    timestamp: timestamp,
    checks: checks,
    target_files: target_files,
    ruby_files: ruby_files,
  }
end

#to_hHash{Symbol => Object}

Convert the run to a hash representation

Returns:

  • (Hash{Symbol => Object})


41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cleo_quality_review/run.rb', line 41

def to_h
  {
    timestamp: timestamp,
    review_id: review_id,
    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