Skip to main content

Lints

Struct Lints 

Source
pub struct Lints { /* private fields */ }
Expand description

A run’s rule selection together with the -- htl: allow(...) comments of the sources it reports on: everything needed to decide whether a finding of the project layer is said.

lint.lua answers the same two questions for its own fifteen, inside report. This is the other half — the same allow syntax, read from the file a finding points into. The mechanism was never specific to Lua rules: an allow comment needs a line number and a rule name, and a project-layer finding has both.

A file is read at most once per run, and only when something was reported in it.

Implementations§

Source§

impl Lints

Source

pub fn new(sel: Selection) -> Self

A run over an already-built Selection. The allow-comment cache starts empty and fills as findings arrive, so a run that reports nothing reads no source.

Source

pub fn parse(spec: &str) -> Result<Self>

The run’s selection from a +rule,-rule spec.

Source

pub fn selection(&self) -> &Selection

The levels this run resolved to, for a caller that has to hand them somewhere else — the Lua side’s selection table, or a report of what a spec came to.

Source

pub fn on(&self, rule: &str) -> bool

Whether this run reports rule at all. Ask before doing the work a rule needs: the contract rules type-check a module and scan a crate’s Rust sources, and a run that turned them off should pay for neither.

Source

pub fn level(&self, rule: &str) -> Level

The level rule has for this run: what decides whether a finding under it fails the run, once it has been decided that the finding is said at all.

Source

pub fn keep(&self, lines: Vec<String>) -> Vec<String>

The findings of lines this run says: the rest are a rule the run has off, or a site whose line allows the rule by name.

Text with no [htl <rule>] suffix is kept. Nothing the project layer produces is in that shape, and dropping a finding because its name could not be read would be the wrong way round.

Auto Trait Implementations§

§

impl !Freeze for Lints

§

impl !RefUnwindSafe for Lints

§

impl !Sync for Lints

§

impl Send for Lints

§

impl Unpin for Lints

§

impl UnsafeUnpin for Lints

§

impl UnwindSafe for Lints

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, 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> MaybeSend for T

Source§

impl<T> MaybeSync for T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.