Skip to content

prek list description says "List available hooks" — but it lists configured hooks, not available ones #1599

@ichoosetoaccept

Description

@ichoosetoaccept

prek list description says "List available hooks" — but it lists configured hooks, not available ones

The issue

The list subcommand's help text reads:

$ prek list -h
List available hooks

This is misleading. prek list does not list hooks that are available to use — it lists hooks that are currently configured in the project's .pre-commit-config.yaml. "Available" implies a catalog of all possible hooks (especially builtins), when the actual behavior is scoped to the current config.

How this causes confusion

  1. User runs prek list in Project A, which has a local hook named no-commit-to-main
  2. Output shows .:no-commit-to-main — reads like an "available" hook
  3. User uses id: no-commit-to-main under repo: builtin in Project B
  4. prek run fails: unknown builtin hook id "no-commit-to-main"

The user reasonably assumed prek list was showing hooks they could use anywhere, because the help text says "available."

Suggestion

Change the help text from:

/// List available hooks.

to something like:

/// List hooks configured in the current project.

This is a one-line change in crates/prek/src/cli/mod.rs (line 215).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions