pub struct Engine { /* private fields */ }Expand description
Everything a run needs, built once and shared across workers.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn prepare(
config: &Config,
project_root: &Path,
rules_root: RuleRoot,
config_path: &Path,
registry: &LanguageRegistry,
typescript: Arc<dyn Language>,
javascript: Arc<dyn Language>,
) -> Result<Self, RunError>
pub fn prepare( config: &Config, project_root: &Path, rules_root: RuleRoot, config_path: &Path, registry: &LanguageRegistry, typescript: Arc<dyn Language>, javascript: Arc<dyn Language>, ) -> Result<Self, RunError>
Sourcepub const fn without_cache(self) -> Self
pub const fn without_cache(self) -> Self
Turn the cache off, for --no-cache and for tests that need a cold run.
Sourcepub const fn profiling(self) -> Self
pub const fn profiling(self) -> Self
Collect per-rule timings.
Off by default because measuring costs a clock read per handler invocation, and the path a warm run takes is the one place that matters most.
Sourcepub const fn reporting_unused_suppressions(self) -> Self
pub const fn reporting_unused_suppressions(self) -> Self
Report suppressions that silenced nothing.
Off by default because it is hygiene rather than correctness: a suppression whose violation no longer exists is debt, and debt is worth surfacing on request rather than in everyone’s inner loop.
Sourcepub const fn with_today(self, today: Date) -> Self
pub const fn with_today(self, today: Date) -> Self
Fix the date expires: is compared against.
For tests, which otherwise could not assert anything about expiry without waiting.
Sourcepub const fn without_reduce(self) -> Self
pub const fn without_reduce(self) -> Self
Skip every reduce phase.
For a run over a deliberately partial corpus. A cross-file rule consumes facts from
every file, so running one over a subset does not give a smaller answer — it gives a
wrong one. no-unused-exports over three changed files would report every export in
them as unused, because the importers were never looked at.
Skipping is therefore the only sound option, and the caller that narrowed the corpus is the one that has to say so to the user.
Sourcepub fn discover(&self) -> Vec<FilePath>
pub fn discover(&self) -> Vec<FilePath>
The files discovery selects, before any gate.
For a caller narrowing the corpus: intersecting with this is what keeps include and
exclude in force, so --staged cannot check a file the config excluded.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
How many rules will actually run. Rules set to off are dropped at preparation.
Sourcepub fn rules(&self) -> impl Iterator<Item = &RuleSpec>
pub fn rules(&self) -> impl Iterator<Item = &RuleSpec>
The rules that will run, in the order the config declared them.
The specs rather than a rendered listing: what a listing should look like is the reporter’s problem, and an engine that decided it would have to be changed for every new output format.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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