Repository navigation
ci(ruff): Enable rules for inline imports, prints, unused noqa and pytest.raises - #8280
Closed
sentry-junior[bot] wants to merge 1 commit into
Closed
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
…test.raises Turn on PLC0415, T20, RUF100, PT011 and PT012. Existing violations get a noqa comment so new code is checked without a big cleanup first. RUF100 removes the noqa comments for rules that ruff doesn't enable, most of them left over from the flake8 plugins. Co-Authored-By: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
This was referenced Nov 16, 2026
Contributor
Author
Contributor
Coverage Results 📊✅ 139266 passed | ⏭️ 7853 skipped | Total: 147119 | Pass Rate: 94.66% | Execution Time: 429m 39s 📊 Comparison with Base Branch
✨ Test counts unchanged from base. All tests are passing successfully. ✅ Patch coverage is 96.50% (138 of 143 changed executable lines covered; target 80%). Changed files with executable lines (48)Coverage diff@@ Coverage Diff @@
## master #8280 +/-##
==========================================
+ Coverage 90.22% 90.25% +0.03%
==========================================
Files 203 203 —
Tracked lines 27335 27335 —
Branches 10246 10246 —
==========================================
+ Hits 24661 24669 +8
+ Misses 2674 2666 -8
+ Partials 1558 1557 -1Generated by Coverage Action |
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
Turns on ruff rules for problems we currently catch by hand in review:
PLC0415: imports inside functions, whichAGENTS.mdasks us to avoid. Only applies tosentry_sdk.T20:print()calls. Only applies tosentry_sdk; tests and scripts are excluded.PT011:pytest.raises()with an exception type that's too broad and nomatch=.PT012: apytest.raises()block with more than one statement, which hides which line actually raised.RUF100:noqacomments that don't suppress anything.Existing violations get a
# noqa: <code>comment, so only new code has to follow the rules. That's 105 inline imports in the SDK and 63pytest.raisescases in tests. Many of the inline imports are intentional (optional deps, Django settings), so a new one now needs an explicitnoqathat a reviewer can see.RUF100also removes 189noqacomments for rules ruff doesn't enable, mostlyN8xx,E231andB0xxcodes left over from the flake8 plugins.All code changes are comments only; nothing in the code itself changes. Most of the 97 files are just added or removed
noqacomments.Open question: should the flake8-era
N8xx/B0xxcomments go away, as they do here? The alternative is keeping them as markers in case we enable those rule families later.via @sentrivana.
--
View Session [Sentry]