pub enum LintScope {
SourceRepository,
Package,
BuildInfo,
PackageBuild,
PackageInfo,
SourceInfo,
}Expand description
The possible scope used to categorize lint rules.
Scopes are used to determine what lints should be executed based on a specific linting
operation. For example, selecting LintScope::SourceInfo will run all
SourceInfo specific linting rules. Linting scopes can also be
fully enabled or disabled via configuration files.
Variants§
SourceRepository
Lint rules with this scope are specific to an alpm-source-repo.
Such lint rules check the consistency of an Arch Linux package source repository. This includes the consistency of data between several metadata files.
When this scope is selected, the following lint scopes are implied:
Package
Lint rules with this scope are specific to an alpm-package.
Such lint rules check the consistency of an Arch Linux package file. This includes the consistency of data between various metadata files.
When this scope is selected, the following lint scopes are implied:
BuildInfo
Lint rules with this scope are specific to a single BUILDINFO file.
PackageBuild
Lint rules with this scope are specific to a single PKGBUILD file.
PackageInfo
Lint rules with this scope are specific to a single PKGINFO file.
SourceInfo
Lint rules with this scope are specific to a single SRCINFO file.
Implementations§
Source§impl LintScope
impl LintScope
Sourcepub fn contains(&self, other: &LintScope) -> bool
pub fn contains(&self, other: &LintScope) -> bool
Determines whether a LintScope contains or matches another.
In this context “contains” and “matches” means that either self is identical to other,
or that the scope of other is contained in the scope of self.
§Examples
use alpm_lint::LintScope;
let source_info = LintScope::SourceInfo;
let source_repo = LintScope::SourceRepository;
assert!(source_repo.contains(&source_info));
assert!(source_info.contains(&source_info));
assert!(!source_info.contains(&source_repo));Sourcepub fn detect(path: &Path) -> Result<LintScope, Error>
pub fn detect(path: &Path) -> Result<LintScope, Error>
Attempts to return all applicable lint scopes based on a provided path.
Usually, when calling alpm-lint check, LintScope::detect is used to
automatically determine the available linting scope based on files in the specified
directory. The current scope can also be overridden by the user.
Based on that scope, files will be loaded and linting rules are selected for execution.
§Errors
- The path cannot be read/accessed
- The scope cannot be determined based on the file/s at the given path.
Sourcepub fn is_single_file(&self) -> bool
pub fn is_single_file(&self) -> bool
Checks whether the LintScope is for a single file.