Skip to main content

FileContentMatchesRule

Struct FileContentMatchesRule 

Source
pub struct FileContentMatchesRule { /* private fields */ }

Trait Implementations§

Source§

impl Debug for FileContentMatchesRule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PerFileRule for FileContentMatchesRule

Source§

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>>

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>

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 FileContentMatchesRule

Source§

fn id(&self) -> &str

Source§

fn level(&self) -> Level

Source§

fn policy_url(&self) -> Option<&str>

Source§

fn fixer(&self) -> Option<&dyn Fixer>

Optional automatic-fix strategy. Rules whose violations can be mechanically corrected (e.g. creating a missing file, removing a forbidden one, renaming to the correct case) return a Fixer here; the default implementation reports the rule as unfixable.
Source§

fn evaluate(&self, ctx: &Context<'_>) -> Result<Vec<Violation>>

Source§

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 more
Source§

fn git_tracked_mode(&self) -> GitTrackedMode

Whether (and how) this rule narrows its iteration to git-tracked entries. Default GitTrackedMode::Off. Rule kinds that support git_tracked_only: override to return GitTrackedMode::FileOnly (file-mode rules: check set.contains(path)) or GitTrackedMode::DirAware (dir-mode rules: check dir_has_tracked_files(path, set)) when the user opts in. Read more
Source§

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

In --changed mode, return true to evaluate this rule against the full FileIndex rather than the changed-only filtered subset. Default false (per-file semantics — the rule sees only changed files in scope). Read more
Source§

fn path_scope(&self) -> Option<&Scope>

In --changed mode, return the Scope this rule is scoped to (typically the rule’s paths: field). The engine intersects the scope with the changed-set; rules whose scope doesn’t intersect are skipped, which is the optimisation --changed exists for. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more