Skip to content

Refactor: Remove unnecessary lint suppressions#3348

Merged
vegaro merged 4 commits into
mainfrom
cursor/unnecessary-lint-suppressions-240f
Apr 17, 2026
Merged

Refactor: Remove unnecessary lint suppressions#3348
vegaro merged 4 commits into
mainfrom
cursor/unnecessary-lint-suppressions-240f

Conversation

@cursor

@cursor cursor Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-ios and hybrids

Motivation

Reduce unnecessary lint/detekt suppressions by refactoring code so rules are satisfied without opt-outs. This keeps static analysis meaningful and lowers maintenance risk.

Description

This PR removes 5 suppressions (capped for reviewability) by making small behavior-preserving refactors in :purchases:

  1. FileHelper.kt

    • Removed @Suppress("TooGenericExceptionCaught") from catch in removeFirstLinesFromFile.
    • Refactor: replaced broad catch with explicit IOException and SecurityException handling, preserving logging and rethrow behavior.
  2. billingClientParamBuilders.kt

    • Removed @Suppress("SwallowedException") on ExceptionInInitializerError catch.
    • Refactor: propagate full caught exception (e) as cause in QueryProductDetailsParamsBuilderException instead of only e.cause, improving diagnosability.
  3. BillingClientUseCase.kt

    • Removed @Suppress("ThrowingExceptionsWithoutMessageOrCause") from getStackTrace.
    • Refactor: instantiate RuntimeException with an explicit message before printing stack trace, keeping stack snapshot intent intact.

4-5. GalaxyBillingWrapperFactory.kt

  • Removed method-level @Suppress("ThrowsCount") from createGalaxyBillingWrapper.
  • Removed local @Suppress("UNCHECKED_CAST") on reflective instance cast.
  • Refactor: switched to runtime type-check using check(wrapperInstance is BillingAbstract) and extracted exception handlers into helper methods to keep throw count in the factory function compliant and maintain existing failure semantics.

Baseline review

  • Reviewed config/detekt/detekt-baseline.xml, purchases/detekt-baseline.xml, and examples/purchase-tester/detekt-baseline.xml.
  • No baseline updates were required for this scoped cleanup.

Validation

  • ./gradlew detektAll -x test
  • ⚠️ Lint task execution in this environment is blocked by missing Android SDK (sdk.dir / ANDROID_HOME), so full Android lint could not be run here.

Labels

  • Requested label: pr:other
Open in Web View Automation 

Note

Low Risk
Small refactors in billing-related helpers (reflection wrapper creation and stack-trace logging) with intended behavior preserved; risk is limited to altered exception types/messages in rare failure paths.

Overview
Cleans up billing-related code to satisfy static analysis without suppressions.

GalaxyBillingWrapperFactory.createGalaxyBillingWrapper now avoids an unchecked cast by instantiating via reflection, validating the result with a runtime check, and extracting the three failure cases into dedicated helper methods while preserving the same thrown error semantics.

BillingClientUseCase.getStackTrace now captures a stack trace using a RuntimeException with an explicit message (instead of a message-less Throwable) for clearer disconnect logs.

Reviewed by Cursor Bugbot for commit d63f693. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 2 commits April 16, 2026 07:18
Co-authored-by: Cesar de la Vega <vegaro@users.noreply.github.com>
Co-authored-by: Cesar de la Vega <vegaro@users.noreply.github.com>
@emerge-tools

emerge-tools Bot commented Apr 16, 2026

Copy link
Copy Markdown

📸 Snapshot Test

1 modified, 587 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 1 0 330 0 ⏳ Needs approval
TestPurchasesUIAndroidCompatibility Paparazzi
com.revenuecat.testpurchasesuiandroidcompatibility.paparazzi
0 0 0 0 257 0 N/A

🛸 Powered by Emerge Tools

Restore original Throwable catch in FileHelper.removeFirstLinesFromFile
and SwallowedException suppression + e.cause in billingClientParamBuilders,
as the automated narrowing changed error-handling behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@vegaro vegaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted two changes, the other ones are safe

@vegaro vegaro marked this pull request as ready for review April 16, 2026 10:15
@vegaro vegaro requested a review from a team as a code owner April 16, 2026 10:15
@vegaro vegaro enabled auto-merge April 16, 2026 10:15
@vegaro vegaro added this pull request to the merge queue Apr 17, 2026
@codecov

codecov Bot commented Apr 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.36%. Comparing base (11813f3) to head (d63f693).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...at/purchases/galaxy/GalaxyBillingWrapperFactory.kt 0.00% 14 Missing ⚠️
...t/purchases/google/usecase/BillingClientUseCase.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3348      +/-   ##
==========================================
- Coverage   79.39%   79.36%   -0.04%     
==========================================
  Files         354      354              
  Lines       14252    14259       +7     
  Branches     1950     1951       +1     
==========================================
  Hits        11316    11316              
- Misses       2133     2140       +7     
  Partials      803      803              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Merged via the queue into main with commit 6a06250 Apr 17, 2026
35 of 36 checks passed
@vegaro vegaro deleted the cursor/unnecessary-lint-suppressions-240f branch April 17, 2026 12:52
matteinn pushed a commit to matteinn/purchases-android that referenced this pull request Apr 28, 2026
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* fix: move Google BillingClient connection off the main thread (RevenueCat#3369)
via Toni Rico (@tonidero)
* [EXTERNAL] fix(google): guard showInAppMessages against BillingClient
runtime crashes (RevenueCat#3367) by @matteinn (RevenueCat#3368) via Monika Mateska
(@MonikaMateska)

## RevenueCatUI SDK
### Paywallv2
#### 🐞 Bugfixes
* Add Workflows network layer (RevenueCat#3300) via Cesar de la Vega (@vegaro)

### 🔄 Other Changes
* Fix `revenuecat.useWorkflowsEndpoint` compiler flag (RevenueCat#3374) via Cesar
de la Vega (@vegaro)
* Create paywall from workflow response. Add `USE_WORKFLOWS_ENDPOINT`
BuildConfig (RevenueCat#3350) via Cesar de la Vega (@vegaro)
* Refactor: Remove unnecessary lint suppressions (RevenueCat#3373) via cursor[bot]
(@cursor[bot])
* Bump fastlane-plugin-revenuecat_internal from `a1eed48` to `b822f01`
(RevenueCat#3371) via dependabot[bot] (@dependabot[bot])
* Bump fastlane from 2.232.2 to 2.233.0 (RevenueCat#3370) via dependabot[bot]
(@dependabot[bot])
* Attempt to fix `AssertionError` "ms is denormalized" in
`QueryPurchasesUseCaseTest` (RevenueCat#3361) via Cesar de la Vega (@vegaro)
* Update baseline profiles (RevenueCat#3296) via Jaewoong Eum (@skydoves)
* fix: reduce precision for flaky HeaderDirectHeroImage snapshot (RevenueCat#3362)
via Cesar de la Vega (@vegaro)
* Fix test failures reported twice (RevenueCat#3360) via Cesar de la Vega
(@vegaro)
* refactor: extract `updateStateFromOffering` in `PaywallViewModel`
(RevenueCat#3359) via Cesar de la Vega (@vegaro)
* [Fix] Include parent tabs component_name in tab-control switch
interaction events (RevenueCat#3358) via Monika Mateska (@MonikaMateska)
* Refactor: Remove unnecessary lint suppressions (RevenueCat#3348) via cursor[bot]
(@cursor[bot])
* fix: always upload CI test results even when tests fail (RevenueCat#3357) via
Cesar de la Vega (@vegaro)
* refactor: extract `RevenueCatDialogScaffold` (RevenueCat#3355) via Cesar de la
Vega (@vegaro)
* Fix Slack notifications for nightly integration tests (RevenueCat#3354) via Toni
Rico (@tonidero)
* UI events for paywall component interactions (RevenueCat#3287) via Monika
Mateska (@MonikaMateska)
* Bump fastlane-plugin-revenuecat_internal from `20911d1` to `a1eed48`
(RevenueCat#3351) via dependabot[bot] (@dependabot[bot])

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Primarily a version bump and release automation updates (docs
deploy/redirect and changelog); no functional library code changes
beyond updating embedded version constants.
> 
> **Overview**
> Cuts the `10.2.1` release by updating version references across the
repo (Gradle `VERSION_NAME`, internal `frameworkVersion`, sample/test
app dependency pins, and `.version`).
> 
> Updates the docs release pipeline and website redirect to publish and
point at `10.2.1`, and refreshes `CHANGELOG.md`/`CHANGELOG.latest.md`
with the 10.2.1 release notes.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a0a325b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants