oparlint-linting 0.0.2

Linting infrastructure for oparlint
Documentation
// SPDX-FileCopyrightText: Politik im Blick developers
// SPDX-FileCopyrightText: Wolfgang Silbermayr <wolfgang@silbermayr.at>
//
// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2

use crate::{LintingResult, severity::Severity};

/// A trait defined on any datatype that describes and performs a lint.
pub trait Lint {
    /// The output type of this lint. This allows a lint to transform the input
    /// data into a different type, e.g. unpacking the [`Ok`] part from a [`Result`].
    type Output;

    /// The severity of the lint.
    fn severity(&self) -> Severity;

    /// The title of the lint. Should be just one line of human-readable text.
    fn title(&self) -> String;

    /// Perform the check, potentially transforming the input into the output
    /// type if the check succeeds.
    fn check(self) -> LintingResult<Self::Output>;
}