home-assistant / home-assistant/android

Enable Detekt SuspendFunSwallowedCancellation rule

Open
#7,415 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
3.9k
Forks
1.1k
Avg merge
1d 12h
Merged PRs (30d)
81

Description

### Description

Enable Detekt’s `SuspendFunSwallowedCancellation` rule after resolving the existing violations.

A trial type-resolved run on current main found 85 unique source locations across 52 files (129 flavor-expanded findings). These should be audited and fixed in manageable PRs so coroutine cancellation is always propagated correctly.

Expected outcome:
- Fix all valid findings.
- Enable `coroutines.SuspendFunSwallowedCancellation` in `.detekt/detekt.yml`.
- Do not add new baseline entries for the rule.
- Verify app, common, and Wear type-resolved Detekt tasks pass.

### Additional context

- Follow-up to #7414, where review found two cancellation-swallowing catches.
- The project uses Detekt 2.0.0-alpha.6; account for known alpha rule behavior while auditing findings.
- Rule documentation: https://detekt.dev/docs/rules/coroutines/#suspendfunswallowedcancellation

Contributor guide

Open the contributing guide

Research direction

Start by reading the SuspendFunSwallowedCancellation rule documentation and running the app, common, and Wear type-resolved Detekt tasks to reproduce the reported findings. Audit the 85 source locations across 52 files, fixing valid findings in manageable groups. Done means valid findings are resolved, the rule is enabled in .detekt/detekt.yml without new baseline entries, and all three tasks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.