Skip to content

Add '--list-checks' flag that lists all implemented checks#324

Open
vickgoodman wants to merge 2 commits into
bemanproject:mainfrom
vickgoodman:cli-add-list-checks-flag
Open

Add '--list-checks' flag that lists all implemented checks#324
vickgoodman wants to merge 2 commits into
bemanproject:mainfrom
vickgoodman:cli-add-list-checks-flag

Conversation

@vickgoodman

Copy link
Copy Markdown
Contributor

Usage example:

$ beman-tidy --list-checks
[Requirement]    cmake.library_alias
[Recommendation] cmake.library_name
[Recommendation] cmake.project_name
[Recommendation] cpp.extension_identifiers
[Recommendation] cpp.namespace
[Requirement]    directory.docs
[Requirement]    directory.examples
[Requirement]    directory.papers
[Requirement]    directory.sources
[Requirement]    directory.tests
[Recommendation] file.copyright
[Requirement]    file.license_id
[Recommendation] file.names
[Requirement]    file.test_names
[Recommendation] library.name
[Recommendation] license.apache_llvm
[Requirement]    license.approved
[Requirement]    license.criteria
[Requirement]    readme.badges
[Recommendation] readme.implements
[Requirement]    readme.library_status
[Requirement]    readme.license
[Recommendation] readme.purpose
[Recommendation] readme.title
[Requirement]    release.github
[Recommendation] release.godbolt_trunk_version
[Recommendation] release.notes
[Requirement]    repository.code_review_rules
[Requirement]    repository.codeowners
[Requirement]    repository.default_branch
[Recommendation] repository.disallow_git_submodules
[Requirement]    repository.name
[Requirement]    toplevel.cmake
[Requirement]    toplevel.license
[Requirement]    toplevel.readme

$ beman-tidy --list-checks /path/to/repo outputs the same

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-checks handling to the CLI, printing registered check names and their types.
  • Update README --help snippet 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.

Comment thread beman_tidy/cli.py
Comment thread README.md
Comment thread beman_tidy/cli.py
@vickgoodman vickgoodman marked this pull request as ready for review July 6, 2026 22:00

@neatudarius neatudarius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread beman_tidy/cli.py
"""
Print all implemented beman-tidy checks.
"""
implemented_checks = get_registered_beman_standard_checks()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread beman_tidy/cli.py

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants