Skip to main content

Adapter

Trait Adapter 

Source
pub trait Adapter: Sync + Debug {
    // Required methods
    fn analyzer(&self) -> &'static str;
    fn summary(&self) -> &'static str;
    fn languages(&self) -> &'static [&'static str];
    fn asset_ids(&self) -> &'static [&'static str];
    fn command(&self, assets: &AssetPaths<'_>) -> Invocation;
    fn normalize(
        &self,
        native: &[u8],
        ctx: &NativeContext<'_>,
    ) -> Result<NormalizedReport, ExecError>;
}
Expand description

One analyzer’s native output format and invocation.

Required Methods§

Source

fn analyzer(&self) -> &'static str

The analyzer id — the value that appears in every layer key and finding key this adapter produces.

Source

fn summary(&self) -> &'static str

A one-line description of what it looks for, for roteiro security status and --help.

Source

fn languages(&self) -> &'static [&'static str]

The languages this adapter produces findings for, as the coverage matrix in ADR-0018 states them. Reported by the CLI so the claim is inspectable rather than only documented.

Source

fn asset_ids(&self) -> &'static [&'static str]

Which pinned assets the analyzer needs before it can run offline (see crate::assets). An empty slice means it needs none.

Source

fn command(&self, assets: &AssetPaths<'_>) -> Invocation

The argv that makes the analyzer emit the native format Adapter::normalize parses, with egress configured off.

assets maps an id from Adapter::asset_ids to the verified local path it was provisioned to.

Source

fn normalize( &self, native: &[u8], ctx: &NativeContext<'_>, ) -> Result<NormalizedReport, ExecError>

Parse native output into a normalized report.

§Errors

Returns ExecError::MalformedReport when the bytes are not this analyzer’s format, or ExecError::Json when they are not JSON at all. A partially-parsed report is never returned: either the whole thing converts or the run fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§