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
impl Lints
Sourcepub fn new(sel: Selection) -> Self
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.
Sourcepub fn selection(&self) -> &Selection
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.
Sourcepub fn on(&self, rule: &str) -> bool
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.
Sourcepub fn level(&self, rule: &str) -> Level
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.
Sourcepub fn keep(&self, lines: Vec<String>) -> Vec<String>
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> 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> 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