Skip to content

ci(mypy): Enable unused-awaitable error code - #8281

Merged
sentrivana merged 1 commit into
masterfrom
ci/mypy-unused-awaitable
Nov 16, 2026
Merged

sentrivana merged 1 commit into
masterfrom
ci/mypy-unused-awaitable

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

I don't think this will catch a lot of issues, but it doesn't hurt to have


Turns on mypy's unused-awaitable error code. It flags awaitables whose result is thrown away, for example a bare asyncio.ensure_future(...). The event loop only keeps a weak reference to that task, so it can be garbage-collected before it finishes. mypy already flags un-awaited coroutines by default; this covers other awaitables such as tasks and futures.

Nothing in sentry_sdk triggers it today, so this only affects new code.

Other optional mypy checks (possibly-undefined, deprecated, truthy-bool, redundant-expr, warn_unreachable) are left out because each one has existing errors that need fixing first.

via @sentrivana.

--

View Session [Sentry]

Flag discarded awaitables like a bare asyncio.ensure_future(...), whose
task can be garbage-collected before it finishes.

Co-Authored-By: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 139266 passed | ⏭️ 7853 skipped | Total: 147119 | Pass Rate: 94.66% | Execution Time: 456m 24s

📊 Comparison with Base Branch

Metric Change
Total Tests —
Passed Tests —
Failed Tests —
Skipped Tests —

✨ Test counts unchanged from base.

All tests are passing successfully.

✅ Patch coverage is 100.00% (no changed executable lines found; target 80%).
Project statement coverage is 90.22% (unchanged from base (ae73d8c) to head (b030af8)).

Coverage diff
@@            Coverage Diff             @@
##        master     #8281       +/-##
==========================================
  Coverage    90.22%    90.22%        —%
==========================================
  Files          203       203         —
  Tracked lines     27335     27335         —
  Branches     10246     10246         —
==========================================
+ Hits         24661     24662        +1
+ Misses        2674      2673        -1
+ Partials      1558      1557        -1

Generated by Coverage Action

@sentrivana
sentrivana marked this pull request as ready for review November 16, 2026 10:32
@sentrivana
sentrivana requested a review from a team as a code owner November 16, 2026 10:32
@sentry-junior
sentry-junior Bot requested a review from sentrivana November 16, 2026 10:32
@sentrivana
sentrivana merged commit 7a45522 into master Nov 16, 2026
174 checks passed
@sentrivana
sentrivana deleted the ci/mypy-unused-awaitable branch November 16, 2026 10:38
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