Class: Ace::Lint::Organisms::LintOrchestrator

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/lint/organisms/lint_orchestrator.rb

Overview

Orchestrates linting of multiple files Supports group-based validator configuration for Ruby files

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_groups: nil) ⇒ LintOrchestrator

Initialize orchestrator

Parameters:

  • ruby_groups (Hash, nil) (defaults to: nil)

    Ruby validator groups configuration



24
25
26
27
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 24

def initialize(ruby_groups: nil)
  @results = []
  @group_resolver = ruby_groups ? Molecules::GroupResolver.new(ruby_groups) : nil
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



20
21
22
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 20

def results
  @results
end

Instance Method Details

#any_failures?Boolean

Check if any file failed

Returns:

  • (Boolean)

    True if any file failed



64
65
66
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 64

def any_failures?
  @results.any?(&:failed?)
end

#failed_countInteger

Get count of failed files

Returns:

  • (Integer)

    Count of failed files



76
77
78
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 76

def failed_count
  @results.count(&:failed?)
end

#lint_files(file_paths, options: {}) ⇒ Array<Models::LintResult>

Lint multiple files

Parameters:

  • file_paths (Array<String>)

    Paths to files

  • options (Hash) (defaults to: {})

    Linting options

Options Hash (options:):

  • :type (Symbol)

    Force file type (:markdown, :yaml, :frontmatter)

  • :fix (Boolean)

    Apply fixes

  • :format (Boolean)

    Format files

  • :kramdown_options (Hash)

    Kramdown options

  • :validators (Array<Symbol>)

    CLI override for validators

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 38

def lint_files(file_paths, options: {})
  # Group files by type for batch processing
  files_by_type = group_files_by_type(file_paths, options: options)

  # Batch process Ruby files (performance optimization)
  @results = []

  # Process non-Ruby files individually
  non_ruby_files = files_by_type.except(:ruby)
  non_ruby_files.each do |type, paths|
    paths.each do |file_path|
      @results << lint_single_file_by_type(file_path, type, options: options)
    end
  end

  # Batch process Ruby files (with group-aware routing)
  if files_by_type[:ruby]&.any?
    ruby_results = batch_lint_ruby(files_by_type[:ruby], options: options)
    @results.concat(ruby_results)
  end

  @results
end

#passed_countInteger

Get count of passed files

Returns:

  • (Integer)

    Count of passed files



70
71
72
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 70

def passed_count
  @results.count(&:success)
end

#total_errorsInteger

Get total error count across all files

Returns:

  • (Integer)

    Total error count



82
83
84
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 82

def total_errors
  @results.sum(&:error_count)
end

#total_warningsInteger

Get total warning count across all files

Returns:

  • (Integer)

    Total warning count



88
89
90
# File 'lib/ace/lint/organisms/lint_orchestrator.rb', line 88

def total_warnings
  @results.sum(&:warning_count)
end