LintScope

Enum LintScope 

Source
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

Source

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));
Source

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.
Source

pub fn is_single_file(&self) -> bool

Checks whether the LintScope is for a single file.

Trait Implementations§

Source§

impl Clone for LintScope

Source§

fn clone(&self) -> LintScope

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LintScope

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for LintScope

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for LintScope

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for LintScope

Source§

fn eq(&self, other: &LintScope) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for LintScope

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ValueEnum for LintScope

Source§

fn value_variants<'a>() -> &'a [Self]

All possible argument values, in display order.
Source§

fn to_possible_value<'a>(&self) -> Option<PossibleValue>

The canonical argument value. Read more
§

fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>

Parse an argument into Self.
Source§

impl VariantArray for LintScope

Source§

const VARIANTS: &'static [Self]

Source§

impl Copy for LintScope

Source§

impl StructuralPartialEq for LintScope

Auto Trait Implementations§

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
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,