feat(debug-statements): implement builtin hook#886
Closed
lmmx wants to merge 1 commit intoj178:masterfrom
Closed
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #886 +/- ##
==========================================
+ Coverage 90.02% 90.20% +0.18%
==========================================
Files 64 65 +1
Lines 11999 12305 +306
==========================================
+ Hits 10802 11100 +298
- Misses 1197 1205 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced Oct 14, 2025
994c8c0 to
601cc2a
Compare
2 tasks
9772848 to
f4dc87b
Compare
f4dc87b to
c94b21f
Compare
Owner
|
Similar to #884 (comment), I’m gonna close this one too. Thanks for your effort though! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Following discussion in #880 and initial bug report in #872 (where found prek slower than pre-commit for the
debug-statementshook in particular, which can be fixed by giving it a Rust port), this PR contributes such a "fast path" hook.This is a popular hook with 5,000+ repos using it on grep.app
Like #884 this one uses the
ruff_python_parsercrate from ruff to parse the AST and then its closely related crateruff_python_astto access nodes.ruff_python_parseralone in thecheck-asthook PR in feat(check-ast): implement builtin hook #884)Binary Size Change
+8.75% (.text: 16.0 MiB → 17.4 MiB)
Demo
Taking the top hit on grep.app, wandb/wandb
and running the latest release of prek and pre-commit, the
debug-statementshook runs 26% slower than pre-commit's:After installing this local feature branch, it runs 2x as fast 🎉
louis 🌟 ~/tmp/wandb $ prek run -a --verbose check-toml...............................................................Passed - hook id: check-toml - duration: 0.00s debug-statements.........................................................Passed - hook id: debug-statements - duration: 0.10s