Skip to content

[Android][lint] Enable magic number check - #590

Open
kiftio wants to merge 2 commits into
08-05-set_max_line_length_in_detekt_to_140from
08-05-enable_magic_number_check
Open

[Android][lint] Enable magic number check#590
kiftio wants to merge 2 commits into
08-05-set_max_line_length_in_detekt_to_140from
08-05-enable_magic_number_check

Conversation

@kiftio

@kiftio kiftio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

Enables the Detekt MagicNumber rule for the Android demo sample app, with ignorePropertyDeclaration: true so that named constants satisfy the check while inline literals are still flagged.

To comply with the newly active rule, bare numeric literals throughout the sample have been replaced with named constants or suppressed with an explanatory comment where the values are inherently visual/design-driven

Case Treatment Why
A value has useful meaning beyond its literal Named property, no suppression ignorePropertyDeclaration: true accepts that the name documents the value
A composable intentionally contains inline visual tuning/layout values One function-level suppression Keeping 10.dp, .7f, or a colour matrix next to the layout is clearer than inventing one-off properties.
Ordinary non-UI inline value Let MagicNumber report it This is the class of issue the rule is meant to expose.

How to test

  1. Run ./gradlew detekt in platforms/android/samples/CheckoutKitAndroidDemo and confirm no MagicNumber violations are reported.
  2. Build and run the demo app and verify the UI renders correctly (cart item images, bottom navigation label offset, hero image, product collection, and product views all appear as before).
  3. Run the unit tests (./gradlew test) and confirm TokenAeadProviderTest and other affected tests pass.

Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Embedded Checkout Protocol version?
  • I have bumped embeddedCheckoutProtocolAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated protocol/languages/kotlin/embedded-checkout-protocol/api/embedded-checkout-protocol.api if the public API changed
Releasing a new Android version?
  • I have bumped checkoutKitAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

kiftio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kiftio kiftio changed the title enable magic number check [Android][lint] Enable magic number check Aug 6, 2026
@kiftio
kiftio force-pushed the 08-05-set_max_line_length_in_detekt_to_140 branch from 303d2b7 to 3f240f9 Compare August 6, 2026 15:35
@kiftio
kiftio force-pushed the 08-05-enable_magic_number_check branch 2 times, most recently from 7b0d44f to 998e058 Compare August 7, 2026 10:20
@kiftio
kiftio force-pushed the 08-05-set_max_line_length_in_detekt_to_140 branch from 3f240f9 to 46eb8c2 Compare August 7, 2026 10:20
@kiftio
kiftio force-pushed the 08-05-enable_magic_number_check branch from 998e058 to 94b44d2 Compare August 7, 2026 10:31
}
}

@Suppress("MagicNumber") // The layout proportions are visual design values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a little annoying you can't ignore Composable's for the rule

@kiftio
kiftio marked this pull request as ready for review August 7, 2026 10:46
@kiftio
kiftio requested a review from a team as a code owner August 7, 2026 10:46
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Android release AAR 273.6 KiB 273.6 KiB 0 B
Android file breakdown
File Base Head Delta
classes.jar 289.5 KiB 289.5 KiB 0 B
res/layout/checkout_view_content.xml 2.3 KiB 2.3 KiB 0 B
res/layout/checkout_sheet_content.xml 2.0 KiB 2.0 KiB 0 B
res/values/values.xml 1.2 KiB 1.2 KiB 0 B
R.txt 1.1 KiB 1.1 KiB 0 B
proguard.txt 798 B 798 B 0 B
AndroidManifest.xml 578 B 578 B 0 B
res/drawable/close.xml 431 B 431 B 0 B
res/menu/checkout_menu.xml 354 B 354 B 0 B
META-INF/com/android/build/gradle/aar-metadata.properties 157 B 157 B 0 B

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

@bitrise

bitrise Bot commented Aug 7, 2026

Copy link
Copy Markdown

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
Kotlin Install with Tophat

Checkout Kit E2E results

Status Suite Target Platform OS version tag Device
tests/shared/launch-smoke.yaml kotlin android latest Google Pixel 9
Android 17.0

Assisted-By: devx/e2f77bde-d08f-41c4-a14f-b50a215d784a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant