Skip to content

proposal: add prek lint #2270

Description

@j178

Add a lightweight prek lint command for checking config/manifest issues and hosting future lint rules.

prek lint is intended to replace prek validate-config and prek validate-manifest as the primary validation entry point. The existing commands can remain as compatibility aliases/wrappers for the corresponding lint checks.

Expected rules

Rule Mode Default Fixable Purpose Issue
unknown-keys offline yes no Warn about ignored config keys n/a
mutable-rev offline yes no Warn about branch/moving revs n/a
ineffective-regex offline yes no Warn about regexes that likely do not match as intended #433
legacy-stages offline yes yes Warn about deprecated stage names (commit, merge-commit, push) and migrate them to pre-commit, pre-merge-commit, pre-push n/a
ref-version-mismatch online yes yes Check SHA rev matches the # frozen: version comment #1864
unpinned-rev offline opt-in no Require remote repo rev to be hash-pinned #2146
unsupported-hook-options offline yes no Statically report hook options that the selected language/repo kind does not support. e.g language: system with additional_dependencies. n/a

Future rule ideas

These are possible future lint rules, not necessarily part of the initial implementation.

Rule Mode Default Fixable Purpose Issue
stale-repo-url online maybe maybe Detect GitHub repo URL redirects / canonical URL mismatch #1891
ambiguous-rev offline maybe yes Warn about YAML rev values that look numeric/bool-like and should be quoted #866, #1935, #1343
useless-excludes offline maybe no Check exclude patterns that do not match any files pre-commit meta hook
unmatched-hooks online maybe no Check hooks that do not apply to any file in the repo pre-commit meta hook
unknown-hook-ids online maybe no Check configured hook ids exist in the remote manifest at the pinned rev n/a
version-drift offline/online maybe no Detect hook versions drifting from project lockfile/tool versions #1054
complex-regex offline maybe maybe Suggest regex-list style once regex lists exist #2250

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaJust an idea

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions