Skip to content

Commit 41b0294

Browse files
ci(ruff): Enable T20 to flag print() in the SDK (#8283)
### Description Turns on ruff's `T20`, which flags `print()` and `pprint()` calls. The SDK runs inside users' apps, so a stray debug `print()` ends up in their output; we should log through the SDK logger instead. `sentry_sdk` has none today, so this is config only. Tests and scripts are excluded via `per-file-ignores` because they print on purpose. Each ruff-rule PR (#8282, #8283, #8285, #8286, #8287) targets `master` on its own. They all add a line to the same `select` list in `pyproject.toml`, so whichever merges first leaves the others with a small conflict there to resolve. <!-- junior-request-attribution:start --> via @sentrivana. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0CAA8NNBE3%3A1794392136.309249 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CAA8NNBE3%3A1794392136.309249) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CAA8NNBE3%3A1794392136.309249/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
1 parent ae73d8c commit 41b0294

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ select = [
301301
"I",
302302
# Note: B and N rules are NOT enabled by default in flake8
303303
# They were only active through the plugins, which may not have been fully enabled
304+
"T20", # print() and pprint() calls
304305
]
305306

306307
# Use ONLY the same ignores as the original flake8 config + compatibility for this codebase
@@ -317,6 +318,10 @@ ignore = [
317318
"E721", # Use isinstance instead of type() == - existing pattern in this codebase
318319
]
319320

321+
[tool.ruff.lint.per-file-ignores]
322+
"scripts/**" = ["T20"]
323+
"tests/**" = ["T20"]
324+
320325
[tool.ruff.format]
321326
# ruff format already excludes the same files as specified in extend-exclude
322327
# Ensure Python 3.7 compatibility - avoid using Python 3.9+ syntax features

0 commit comments

Comments
 (0)