pub struct FindingEvent {
pub trigger: Trigger,
pub policy: PolicyId,
pub severity: Severity,
pub code: &'static str,
pub message: String,
pub path: Option<EventPath>,
pub location: Option<FindingLocation>,
pub fix_available: bool,
}Expand description
What:
One policy finding as it is reported.
String is owned UTF-8 text (sibling &str
borrows);
Option<T> is “a value or nothing”;
&'static str is text baked into
the program.
Why:
The record owns its message and path because events outlive the check that made
them.
The code is compiled-in text,
so a shipped policy cannot emit an empty or
misspelled code at run time.
In TS you’d write (pseudocode):
type FindingEvent = { trigger; policyId; severity: 'warn' | 'error'; code; message; path?; pathBytes?; location?; fix: 'none' | 'available' };Fields§
§trigger: TriggerThe lifecycle point that ran the policy.
policy: PolicyIdThe policy that reported.
severity: SeverityThe effective severity,
Warn or Error.
code: &'static strThe policy-local code; rendering prefixes the policy name.
message: StringThe explanation for the person who ran the command.
path: Option<EventPath>The repository path the finding is about, when it has one.
location: Option<FindingLocation>The byte range the finding is about, when it has one.
fix_available: boolWhether the engine holds a correction for this finding.
Trait Implementations§
Source§impl Clone for FindingEvent
impl Clone for FindingEvent
Source§impl Debug for FindingEvent
impl Debug for FindingEvent
impl Eq for FindingEvent
Source§impl PartialEq for FindingEvent
impl PartialEq for FindingEvent
impl StructuralPartialEq for FindingEvent
Auto Trait Implementations§
impl Freeze for FindingEvent
impl RefUnwindSafe for FindingEvent
impl Send for FindingEvent
impl Sync for FindingEvent
impl Unpin for FindingEvent
impl UnsafeUnpin for FindingEvent
impl UnwindSafe for FindingEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more