Class: FiberAudit::Audit

Inherits:
Object
  • Object
show all
Defined in:
lib/fiber_audit/audit.rb

Overview

Wave R4 WP-7: Audit coordinator.

Orchestrates the complete static analysis workflow:

1. Expand/clean root
2. Resolve target files (include/exclude globs, Ruby only, sorted, deduped)
3. Build SemanticIndex(root:)
4. Extract call sites with absolute paths (unchanged)
5. Copy call sites and parse errors to root-relative paths (portable)
6. Resolve execution contexts on root-relative call sites
7. Parse inline suppressions with root-relative paths
8. Parse YAML suppressions (relative to root unless absolute)
9. Run enabled rules via Collection publication
  1. Apply suppressions and min_severity filter
  2. Determine status and build immutable Result

Defined Under Namespace

Classes: Coverage, Result

Constant Summary collapse

STATUS_FAIL =

Status constants

'FAIL'
STATUS_REVIEW =
'REVIEW'
STATUS_PASS_WITH_WARNINGS =
'PASS_WITH_WARNINGS'
STATUS_NO_FINDINGS =
'NO_FINDINGS'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration:, root:) ⇒ Audit

Returns a new instance of Audit.

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
# File 'lib/fiber_audit/audit.rb', line 46

def initialize(configuration:, root:)
  @configuration = configuration
  expanded_root = Pathname.new(root).expand_path.cleanpath
  raise ArgumentError, "audit root is not a directory: #{expanded_root}" unless expanded_root.directory?

  @root = expanded_root.realpath
  freeze
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



55
56
57
# File 'lib/fiber_audit/audit.rb', line 55

def root
  @root
end

Instance Method Details

#callObject



57
58
59
60
61
62
63
64
# File 'lib/fiber_audit/audit.rb', line 57

def call
  pipeline = run_pipeline
  active, suppressed = pipeline.fetch(:store).apply(pipeline.fetch(:findings))
  filtered_active = filter_by_severity(active)
  filtered_suppressed = filter_by_severity(suppressed)

  build_result(pipeline, filtered_active, filtered_suppressed)
end