pub struct FileContentForbiddenRule { /* private fields */ }Trait Implementations§
Source§impl Debug for FileContentForbiddenRule
impl Debug for FileContentForbiddenRule
Source§impl PerFileRule for FileContentForbiddenRule
impl PerFileRule for FileContentForbiddenRule
Source§fn path_scope(&self) -> &Scope
fn path_scope(&self) -> &Scope
The rule’s scope. The engine checks
path_scope().matches(path) before calling
evaluate_file; a rule that returns
Scope::match_all is
in scope for every file.Source§fn evaluate_file(
&self,
_ctx: &Context<'_>,
path: &Path,
bytes: &[u8],
) -> Result<Vec<Violation>>
fn evaluate_file( &self, _ctx: &Context<'_>, path: &Path, bytes: &[u8], ) -> Result<Vec<Violation>>
Evaluate one file given the engine’s already-read byte
content. The
path is the relative path from the lint
root; the rule should with_path(path.into()) (or clone
the matched FileEntry::path
if it has one in hand) on emitted violations.Source§fn max_bytes_needed(&self) -> Option<usize>
fn max_bytes_needed(&self) -> Option<usize>
Optional lower bound on the bytes the rule needs to
evaluate. Default
None means “I need the whole file.”
Used as a hint; the engine in v0.9.3 reads the whole
file regardless and hands it to every applicable rule —
the hint is reserved for a future engine-side bounded-
read optimisation.Source§impl Rule for FileContentForbiddenRule
impl Rule for FileContentForbiddenRule
fn id(&self) -> &str
fn level(&self) -> Level
fn policy_url(&self) -> Option<&str>
fn evaluate(&self, ctx: &Context<'_>) -> Result<Vec<Violation>>
Source§fn as_per_file(&self) -> Option<&dyn PerFileRule>
fn as_per_file(&self) -> Option<&dyn PerFileRule>
Opt into the file-major dispatch path. Per-file rules that
can evaluate one file at a time given a pre-loaded byte
slice override this to return
Some(self); cross-file
rules and any rule with requires_full_index() == true
leave it as None and keep evaluating under the rule-
major loop. Read moreSource§fn scope_filter(&self) -> Option<&ScopeFilter>
fn scope_filter(&self) -> Option<&ScopeFilter>
Per-file ancestor-manifest gate. Default
None (no
filter); existing rules don’t change behaviour.
Per-file rules whose spec carries a scope_filter:
field override to return Some(&self.scope_filter). Read moreSource§fn wants_git_tracked(&self) -> bool
fn wants_git_tracked(&self) -> bool
Whether this rule needs the git-tracked-paths set on
Context. Default false; rule kinds that support
git_tracked_only override to return true only when
the user actually opted in. The engine collects the set
(via git ls-files) once per run when ANY rule returns
true, so the cost is paid at most once even if many
rules opt in.Source§fn wants_git_blame(&self) -> bool
fn wants_git_blame(&self) -> bool
Whether this rule needs
git blame output on
Context. Default false; the git_blame_age rule
kind overrides to return true. The engine builds the
shared crate::git::BlameCache once per run when any
rule opts in, so multiple blame-aware rules over
overlapping paths: re-use the parsed result.Source§fn requires_full_index(&self) -> bool
fn requires_full_index(&self) -> bool
Source§fn path_scope(&self) -> Option<&Scope>
fn path_scope(&self) -> Option<&Scope>
Auto Trait Implementations§
impl Freeze for FileContentForbiddenRule
impl RefUnwindSafe for FileContentForbiddenRule
impl Send for FileContentForbiddenRule
impl Sync for FileContentForbiddenRule
impl Unpin for FileContentForbiddenRule
impl UnsafeUnpin for FileContentForbiddenRule
impl UnwindSafe for FileContentForbiddenRule
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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