Repository navigation
Conversation
…ngth is limited Nothing verified that a project keeps its functions short. The new `function-limits` check passes when CI or CMake runs lizard with an explicit length limit (-L, --length, -T length/nloc), or when .clang-tidy enables readability-function-size with a positive LineThreshold or StatementThreshold and clang-tidy is run; it warns if the limit is configured but clang-tidy never runs, and fails otherwise, explaining a disabled check or missing threshold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #45 +/- ##
==========================================
+ Coverage 97.07% 97.25% +0.18%
==========================================
Files 31 32 +1
Lines 1127 1202 +75
Branches 92 99 +7
==========================================
+ Hits 1094 1169 +75
Misses 28 28
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@leftibot resolve merge conflicts |
|
✅ leftibot finished addressing the review feedback. |
Requested by @lefticus in PR cpp-best-practices#45 review. Kept both sides of the conflicting tests. Since main now scopes checks to languages, function-limits (clang-tidy readability-function-size or lizard) is declared for C/C++ only, matching cxx-extensions; the CLI, structure and color-output tests are updated for the extra check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot fix merge conflicts and get the tests up to current standards |
|
✅ leftibot finished addressing the review feedback. |
Merges cpp-best-practices/project_validator main, which split check tests into one file per check (cpp-best-practices#49) and derives check lists from discover(). test_cli.py, test_plugins.py and test_structure.py take main's generic versions, so they no longer hard-code function-limits; the well_configured CI fixture keeps both the clang-tidy step and main's clang-format job. The FunctionLimitsTests removed along with tests/test_checks.py move to tests/checks/test_function_limits.py in the next commit. Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the tests into tests/checks/test_function_limits.py, as main now requires one test file per check. They run in every C/C++ project layout via run_in_every_layout, assert the check's declared languages, try lizard limits in every CI provider, and compare whole Results so messages and details are pinned. Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot function limits can apply to python as well. Look for applicable tools to check for an apply in this code base. Lizard? |
|
✅ leftibot finished looking into this — see reply below. |
|
Yes, lizard is the right tool to use for every language. It works on C/C++, Python and Rust (plus about 20 other languages), and the Tools worth detecting, by ecosystem
Ruff and pylint count statements, not lines. That's the same thing clang-tidy's Suggested shapeRestructure the check like
The lizard match should stay valid for every ecosystem. One small catch: if the command has Applying it to this repoHere's where the repo stands today, measured with lizard 1.25 and ruff on
My proposal is a CI job next to the copy-paste-detection one: function-limits:
name: function limits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Install lizard
run: python -m pip install "lizard>=1.17"
- name: Limit function length and complexity
run: lizard --languages python --length 25 --CCN 15 --arguments 5 --warnings_only project_validator testsThese thresholds mean refactoring Lizard was my choice over ruff Do you want me to do both in this PR (the ecosystem-aware check and the CI job, with the refactors)? Or should I keep this PR to the check and send the repo changes separately? |
|
@leftibot implement the function limit length with 30loc as the default setting, using lizard for this project and make sure that the validation test allows for lizard as a viable testing scenario |
|
✅ leftibot finished addressing the review feedback. |
function-limits now judges each ecosystem the project uses: a lizard length limit in CI counts for C/C++, Python and Rust, and clang-tidy's readability-function-size still counts for C/C++. Failures suggest lizard --length 30 as the default limit. The well-configured Python and Rust fixtures now run lizard so they keep passing every check. Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI gains a function-limits job running lizard --length 30 over project_validator and tests, so self-validation now judges (and passes) function-limits for this Python project. cli.main (32 lines) and expand_matrix (complexity 20, over lizard's default of 15) are split up so the job passes. This deliberately edits CI config: @lefticus asked for lizard to be used for this project. Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot fix issues discovered during code quality analysis |
|
✅ leftibot finished addressing the review feedback. |
Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ruff RUF012 failed the quality job because RUNS_CLANG_TIDY was a mutable dict class attribute; it is now a read-only Mapping like the constants in tests/support.py. Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot deal with the merge conflicts and the fact that we don't have pyc files committed now |
|
✅ leftibot finished addressing the review feedback. |
Merges cpp-best-practices/main (warnings-as-errors and vcs-ignore checks, plus the new .gitignore). The only conflicts were modify/delete conflicts on committed __pycache__/*.pyc files, which main no longer tracks; they are removed from this branch too, so no bytecode remains in the tree. Requested by @lefticus in PR cpp-best-practices#45 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
Automated fix by @leftibot.
What changed
Files
Closes #41
Triggered by @lefticus.