rpm-spec-analyzer 0.1.1

Visitor-based static analyzer library for RPM .spec files
Documentation
//! Phase 3 "missing required %section" lints.
//!
//! Three near-identical rules (RPM016, RPM017, RPM018) — one per
//! mandatory build-script section. Generated by
//! [`crate::declare_missing_section_lint`]; each entry below is just
//! metadata + the [`rpm_spec::ast::BuildScriptKind`] variant we're
//! looking for.

// `BuildScriptKind` and `Severity` look unused here because they appear
// inside macro invocations only — they expand into the generated nested
// modules, each of which brings its own `use`s.
use crate::declare_missing_section_lint;

declare_missing_section_lint! {
    mod prep,
    struct MissingPrepSection,
    id: "RPM016",
    name: "missing-prep-section",
    description: "Spec should declare a %prep section to unpack and patch sources.",
    severity: Severity::Warn,
    kind: BuildScriptKind::Prep,
    message: "spec is missing the %prep section",
    good_fixture: "Name: x\n%prep\n",
    bad_fixture: "Name: x\n",
}

declare_missing_section_lint! {
    mod build,
    struct MissingBuildSection,
    id: "RPM017",
    name: "missing-build-section",
    description: "Spec should declare a %build section to compile sources.",
    severity: Severity::Warn,
    kind: BuildScriptKind::Build,
    message: "spec is missing the %build section",
    good_fixture: "Name: x\n%build\n",
    bad_fixture: "Name: x\n",
}

declare_missing_section_lint! {
    mod install,
    struct MissingInstallSection,
    id: "RPM018",
    name: "missing-install-section",
    description: "Spec should declare an %install section to place files into the buildroot.",
    severity: Severity::Warn,
    kind: BuildScriptKind::Install,
    message: "spec is missing the %install section",
    good_fixture: "Name: x\n%install\n",
    bad_fixture: "Name: x\n",
}

// Re-export rule structs at module level so the registry can reach
// them without naming the inner `pub mod`.
pub use build::MissingBuildSection;
pub use install::MissingInstallSection;
pub use prep::MissingPrepSection;