Skip to content

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

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

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 on lines 76 to +80
parser.add_argument(
"--checks", help="array of checks to run", type=str, default=None
"--list-checks",
help="list all implemented checks",
action=ListChecksAction,
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tested this locally and beman-tidy --list-checks works without repo_path. The custom ListChecksAction exits during argument parsing before argparse performs the final required positional argument validation. Normal commands such as beman-tidy --verbose still fail with the expected missing repo_path error.

Comment thread README.md
Comment on lines +51 to 56
usage: beman-tidy [-h] [--version] [--fix-inplace | --no-fix-inplace] [--verbose | --no-verbose] [--require-all | --no-require-all] [--list-checks] [--checks CHECKS] [--config CONFIG]
repo_path

positional arguments:
repo_path path to the repository to check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not relevant. See prev comment.

Comment thread beman_tidy/cli.py
Comment on lines +38 to +41
beman_standard_check_config = load_beman_standard_config()
if not beman_standard_check_config or len(beman_standard_check_config) == 0:
parser.exit(status=1, message="Failed to download the beman standard. STOP.\n")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

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