Module: CleoQualityReview

Defined in:
lib/cleo_quality_review.rb,
lib/cleo_quality_review/cli.rb,
lib/cleo_quality_review/run.rb,
lib/cleo_quality_review/checks.rb,
lib/cleo_quality_review/result.rb,
lib/cleo_quality_review/runner.rb,
lib/cleo_quality_review/options.rb,
lib/cleo_quality_review/version.rb,
lib/cleo_quality_review/diff_map.rb,
lib/cleo_quality_review/formatter.rb,
lib/cleo_quality_review/llm_client.rb,
lib/cleo_quality_review/llm_config.rb,
lib/cleo_quality_review/llm_errors.rb,
lib/cleo_quality_review/llm_logger.rb,
lib/cleo_quality_review/checks/flog.rb,
lib/cleo_quality_review/checks/reek.rb,
lib/cleo_quality_review/changes_diff.rb,
lib/cleo_quality_review/configuration.rb,
lib/cleo_quality_review/llm_providers.rb,
lib/cleo_quality_review/prompt_loader.rb,
lib/cleo_quality_review/run_artifacts.rb,
lib/cleo_quality_review/checks/debride.rb,
lib/cleo_quality_review/command_result.rb,
lib/cleo_quality_review/command_runner.rb,
lib/cleo_quality_review/prompt_builder.rb,
lib/cleo_quality_review/checks/fasterer.rb,
lib/cleo_quality_review/checks/registry.rb,
lib/cleo_quality_review/target_resolver.rb,
lib/cleo_quality_review/llm_providers/stub.rb,
lib/cleo_quality_review/checks/quality_check.rb,
lib/cleo_quality_review/github_review_builder.rb,
lib/cleo_quality_review/llm_providers/open_ai.rb,
lib/cleo_quality_review/llm_providers/registry.rb,
lib/cleo_quality_review/github_review_publisher.rb,
lib/cleo_quality_review/llm_providers/open_ai_config.rb,
lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb

Overview

Quality review tool for Ruby code analysis

Defined Under Namespace

Modules: Checks, LlmProviders Classes: CLI, ChangesDiff, CommandResult, CommandRunner, Configuration, DiffMap, Error, Formatter, GitHubReviewBuilder, GitHubReviewPublisher, LlmClient, LlmConfig, LlmLogger, LlmProviderError, MissingLlmConfigurationError, Options, PromptBuilder, PromptLoader, Result, Run, RunArtifacts, Runner, TargetResolver, UnsupportedLlmProviderError

Constant Summary collapse

VERSION =

Gem version

"0.1.0"

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

#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

#openaiObject

Register all supported LLM APIs for formatting output here



21
# File 'lib/cleo_quality_review.rb', line 21

LlmProviders.register("openai", LlmProviders::OpenAi::Provider)

#ReekObject

Register all supported tools for analysing code here



14
# File 'lib/cleo_quality_review.rb', line 14

Checks.register("Reek", Checks::Reek, tool_type: :smell_detection)