pub struct FilePresenceRule { /* private fields */ }Expand description
Ensures that specific files exist (or do not exist) in the project.
Unlike other rules, this doesn’t scan file content — it checks whether required files are present and forbidden files are absent. Useful for enforcing project conventions like “every project must have a .env.example” or “.env files should not be committed.”
The required_files config field lists relative paths that must exist.
The forbidden_files config field lists relative paths that must NOT exist.
The rule emits one violation per missing required file or present forbidden file.
Implementations§
Source§impl FilePresenceRule
impl FilePresenceRule
pub fn new(config: &RuleConfig) -> Result<Self, RuleBuildError>
Sourcepub fn check_paths(&self, root_paths: &[PathBuf]) -> Vec<Violation>
pub fn check_paths(&self, root_paths: &[PathBuf]) -> Vec<Violation>
Check which required files are missing and which forbidden files exist. Returns violations for each missing required file or present forbidden file.
Trait Implementations§
Source§impl Debug for FilePresenceRule
impl Debug for FilePresenceRule
Source§impl Rule for FilePresenceRule
impl Rule for FilePresenceRule
Auto Trait Implementations§
impl Freeze for FilePresenceRule
impl RefUnwindSafe for FilePresenceRule
impl Send for FilePresenceRule
impl Sync for FilePresenceRule
impl Unpin for FilePresenceRule
impl UnsafeUnpin for FilePresenceRule
impl UnwindSafe for FilePresenceRule
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> 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