Skip to main content

Crate unsafe_budget

Crate unsafe_budget 

Source
Expand description

§unsafe-budget

an unsafe code budget gate for ci pipelines.

tracks unsafe code usage in rust and go projects, compares it against baselines, and enforces budgets.

§quick example

use unsafe_budget::analyzer::detect_analyzer;
use unsafe_budget::model::ScanOpts;

let opts = ScanOpts::default();
let analyzer = detect_analyzer(&opts).unwrap();
let result = analyzer.run(&opts).unwrap();

println!("total unsafe: {}", result.totals.overall_unsafe);
for unit in &result.units {
    println!("  {}: {}", unit.name, unit.unsafe_count);
}

§modules

  • analyzer - analyzer trait and built-in implementations
  • budget - budget comparison engine (ratchet and caps modes)
  • config - configuration and baseline file handling
  • model - core data types (ScanResult, Unit, etc.)
  • output - text and json formatters
  • sarif - SARIF 2.1.0 conversion

Modules§

analyzer
app
budget
cli
config
error
model
core data types for unsafe-budget.
output
sarif
SARIF output conversion.