Add '--list-checks' flag that lists all implemented checks#324
Add '--list-checks' flag that lists all implemented checks#324vickgoodman wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new --list-checks CLI flag intended to print all implemented Beman Standard checks (with their Requirement/Recommendation type), and updates the README’s captured --help output accordingly.
Changes:
- Add
--list-checkshandling to the CLI, printing registered check names and their types. - Update README
--helpsnippet to include--list-checks(and reflect current CLI options).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
beman_tidy/cli.py |
Adds --list-checks via a custom argparse action and implements check listing output. |
README.md |
Updates the documented --help output to include the new flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
neatudarius
left a comment
There was a problem hiding this comment.
Works and mirrors the --version action pattern. Two inline notes below. Also worth a CLI smoke test for --list-checks (asserts exit 0 + non-empty list) — there's no CLI test coverage today.
| """ | ||
| Print all implemented beman-tidy checks. | ||
| """ | ||
| implemented_checks = get_registered_beman_standard_checks() |
There was a problem hiding this comment.
This works only because the check modules' @register_... decorators run as a side effect of the from ...pipeline import run_checks_pipeline import above. If that import ever becomes lazy, --list-checks silently prints an empty list. Suggest importing the check modules explicitly here (or a comment noting the dependency).
|
|
||
| def __call__(self, parser, namespace, values, option_string=None): | ||
| beman_standard_check_config = load_beman_standard_config() | ||
| if not beman_standard_check_config or len(beman_standard_check_config) == 0: |
There was a problem hiding this comment.
Duplicates the config-load guard in main(), and the exit codes differ: here exit 1, but main()'s early return exits 0. A shared helper would keep them consistent.
Usage example:
$ beman-tidy --list-checks /path/to/repooutputs the same