Crate alpm_lint

Crate alpm_lint 

Source
Expand description

§alpm-lint

This project provides a binary for all linting purposes in the scope of the ALPM project.

All lints and their respective documentation can be found on the central ALPM lints website.

§Usage

The alpm-lint binary provides help output for all of its commands. Documentation about individual lints and used options can be found on the ALPM lints website.

§Project files

alpm-lint can be run directly in any package source repository or package directory with alpm-lint check, which will automatically run all applicable lints.

§Single files

You can check individual files with alpm-lint check $PATH_TO_FILE. If the targeted file does not use its canonical name, you can explicitly specify the scope with --scope. For example: alpm-lint check --scope source-info my.srcinfo.

§Usage as a library

The alpm-lint project is not designed to be used as a library. Hence, there’re now backwards/forwards compatibility guarantees for internal types and APIs. New lint rules may be added at any point in time and lint rules may be gracefully removed as well.

Exposed data such as JSON/TOML output, however, is of course considered a part of our external API and we’ll uphold backwards compatibility and follow the best practices of semantic versioning.

§Example

The following example takes a SRCINFO file with duplicate architecture declarations and performs a lint on it.

cat > "$TEMP_TEST_DIR/.SRCINFO" << EOF
pkgbase = example
    pkgver = 1.0.0
    epoch = 1
    pkgrel = 1
    arch = x86_64
    # A second identical architecture declaration to trigger a lint rule.
    arch = x86_64

pkgname = example
EOF

cd $TEMP_TEST_DIR;
alpm-lint check > $TEMP_TEST_DIR/output

cat > "$TEMP_TEST_DIR/expected" <<EOF
warning[source_info::duplicate_architecture]
  --> in field 'arch'
   |
   | Found duplicate architecture: x86_64
   |
help: Architecture lists for packages should always be unique.

      Duplicate architecture declarations such as \`arch=(x86_64 x86_64)\` are ignored.
   = alpm-architecture specification: https://alpm.archlinux.page/specifications/alpm-architecture.7.html
   = see: https://alpm.archlinux.page/lints/index.html#source_info::duplicate_architecture
EOF

§Documentation

§Contributing

Please refer to the contribution guidelines and the architectural guide to learn how to contribute to this project.

§License

This project can be used under the terms of the Apache-2.0 or MIT. Contributions to this project, unless noted otherwise, are automatically licensed under the terms of both of those licenses.

Re-exports§

pub use crate::lint_rules::store::LintStore;

Modules§

config
Convenience re-export of alpm_lint_config types.
error 🔒
internal_prelude 🔒
Common imports that’re required for most linting rule implementations.
issue
Generic representation of a lint issue.
level 🔒
lint_rules
Lint rules covering all supported scopes.
resources 🔒
Types to gather, represent and provide data for linting.
rule 🔒
The trait definition and behavioral description of a lint rule.
scope 🔒
Representation and handling of linting scopes.

Structs§

ScopedName
The fully qualified name of a lint rule.

Enums§

Error
Errors that can occur when using alpm-lint.
Level
Represents the severity level of a lint.
LintScope
The possible scope used to categorize lint rules.
Resources
The resources used by lints during a single lint run.

Traits§

LintRule
The trait definition and behavioral description of a lint rule.