Skip to content

Conversation

@2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Nov 1, 2025

Allows the CLI to be structured using nested structs and enums. Help messages are set using the doc strings for instance attributes.

Behavioral changes

Same behavior as before except:

  • -h shows a shorter help message while --help shows the same long help message
  • -extensions will error if a blank string is passed. cpp-linter v1.x just silently ignores blank file extensions

Other Changes

  • updated python dependencies (and uv.lock)
  • added support for fre-threaded python builds
  • adjusted docs' cli-gen binding accordingly for -h vs --help output (favoring the later when available).
  • adopt PEP639 about License info in Python package metadata.

Allows the CLI to be structured using nested structs and enums. Help messages are set using the doc strings for instance attributes.

## Behavioral changes

Same behavior as before expect:

* `-h` shows a shorter help message while `--help` shows the same long help message
* `-extensions` will error if a blank string is passed. cpp-linter v1.x just silently ignores blank file extensions

## Other Changes

- updated python dependencies (and uv.lock)
- added support for fre-threaded python builds
- adjusted docs' cli-gen binding accordingly for `-h` vs `--help` output (favoring the later when available).
- adopt PEP639 about License info in Python package metadata.
@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.61%. Comparing base (c9b1b1c) to head (29e490c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #204      +/-   ##
==========================================
- Coverage   96.87%   96.61%   -0.26%     
==========================================
  Files          14       14              
  Lines        3131     2891     -240     
==========================================
- Hits         3033     2793     -240     
  Misses         98       98              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

and rename subcommands struct to something more descriptive
@2bndy5 2bndy5 force-pushed the clap-derive-struct branch from 20f2094 to 29e490c Compare November 1, 2025 07:58
@2bndy5 2bndy5 merged commit 106a0e9 into main Nov 1, 2025
77 checks passed
@2bndy5 2bndy5 deleted the clap-derive-struct branch November 1, 2025 09:34
2bndy5 added a commit that referenced this pull request Nov 4, 2025
- Allow boolean options to be treated as flags if their default value is false.
- Some other CLI options can now accept no value (like a flag) including `--verbosity`
- Use `std::str::FromStr` trait to parse the given version:
    * if no value is given, then behave exactly like the `cpp-linter version` subcommand (print version and exit)
    * if a path is given look for clang-tools in that path. This only ensures the given path exists, not if the clang- tool is present; that is done later if the tool is needed.
    * expand support for version specifiers using `semver::VersionReq`. This removes the need for `lenient_semver` dependency and allows the user to specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`, or simply `16` (would be treated as `=16`). See [semver::VersionReq docs][ver-req-docs] for more detail.
- adjust docs to better describe accepted/possible values.

Due to the changes in parsing the user-given version, there is a new enum, `ClangTool` that enforces type-safety about finding the clang tools (when they are needed).

* Instead of passing the tool name (as a str), the `ClangTool` enum is used to avoid typos and convey explicit support for only clang-tidy and clang-format.
* Getting the clang tool's path and version are now instance methods of the `ClangTool` enum.

[ver-req-docs]: https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
2bndy5 added a commit that referenced this pull request Nov 4, 2025
A follow-up to #204

- Allow boolean options to be treated as flags if their default value is false.
- Some other CLI options can now accept no value (like a flag) including `--verbosity`
- Use `std::str::FromStr` trait to parse the given version:
    * if no value is given, then behave exactly like the `cpp-linter version` subcommand (print version and exit)
    * if a path is given look for clang-tools in that path. This only ensures the given path exists, not if the clang- tool is present; that is done later if the tool is needed.
    * expand support for version specifiers using `semver::VersionReq`. This removes the need for `lenient_semver` dependency and allows the user to specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`, or simply `16` (would be treated as `=16`). See [semver::VersionReq docs][ver-req-docs] for more detail.
- adjust docs to better describe accepted/possible values.

Due to the changes in parsing the user-given version, there is a new enum, `ClangTool` that enforces type-safety about finding the clang tools (when they are needed).

* Instead of passing the tool name (as a str), the `ClangTool` enum is used to avoid typos and convey explicit support for only clang-tidy and clang-format.
* Getting the clang tool's path and version are now instance methods of the `ClangTool` enum.

[ver-req-docs]: https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
2bndy5 added a commit that referenced this pull request Nov 4, 2025
A follow-up to #204

- Allow boolean options to be treated as flags (no value passed) if
  their default value is `false` (`--file-changes-only`, `--step-summary`,
  `--*-review`, etc).
- Some other CLI options can now accept no value (like a flag) including
  `--verbosity`
- Use `std::str::FromStr` trait to parse the given `--version`:
   * if no value is given, then behave exactly like the `cpp-linter
     version` subcommand (print version and exit)
   * if a path is given look for clang-tools in that path. This only
     ensures the given path exists, not if the clang- tool is present; that
     is done later if the tool is needed.
   * expand support for version specifiers using `semver::VersionReq`. This
     removes the need for `lenient_semver` dependency and allows the user to
     specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`,
     or simply `16` (would be treated as `=16`).
     See [`semver::VersionReq` docs][ver-req-docs] for more detail.
- adjust docs to better describe accepted/possible values.

Due to the changes in parsing the user-given `--version`, there is a new
enum, `ClangTool` that enforces type-safety about finding the clang
tools (when they are needed).

* Instead of passing the tool name (as a str), the `ClangTool` enum is
  used to avoid typos and convey explicit support for only clang-tidy and
  clang-format.
* Getting the clang tool's path and version are now instance methods of
  the `ClangTool` enum.

[ver-req-docs]:
https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
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.

2 participants