Skip to content

build: add Spotless with ktlint formatting checks - #1040

Merged
dkhawk merged 2 commits into
mainfrom
build/add-spotless
Oct 14, 2026
Merged

dkhawk merged 2 commits into
mainfrom
build/add-spotless

Conversation

@kikoso

@kikoso kikoso commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Adds Spotless with ktlint so formatting is checked automatically on pull requests, instead of in review comments.

The configuration matches the one already used in android-maps3d-samples, so all the Maps Android repos format Kotlin the same way.

Changes

  • build: add Spotless with ktlint...: Spotless 8.9.0 in the version catalog, one root spotless {} block covering every .kt file, max_line_length = 120 in .editorconfig, a ./gradlew spotlessCheck step in the lint job of lint-report.yml, and a note in CONTRIBUTING.md to run ./gradlew spotlessApply before opening a PR.
  • style: apply Spotless formatting: the output of ./gradlew spotlessApply, plus a few manual, behaviour-neutral fixes (wildcard imports replaced, a few long @Deprecated messages split with +).

Disabled ktlint rules, so this stays formatting-only: property-naming and filename (fixing them would mean renames). No public API is renamed in maps-compose, maps-compose-utils or maps-compose-widgets.

Merging

Please use rebase and merge so the reformat stays a separate commit. After merging, I will add its SHA to .git-blame-ignore-revs in a small follow-up, so git blame skips it.

Open PRs will likely need a rebase and a ./gradlew spotlessApply after this lands.

Verification

./gradlew spotlessCheck assembleDebug testDebugUnitTest assembleDebugAndroidTest pass locally.

Adds the Spotless Gradle plugin (8.9.0) with ktlint for Kotlin, using the same configuration as android-maps3d-samples, runs ./gradlew spotlessCheck in the lint workflow, and documents ./gradlew spotlessApply in CONTRIBUTING.md.
Output of ./gradlew spotlessApply, plus a few manual, behaviour-neutral fixes for violations ktlint cannot fix on its own (wildcard imports, long lines). No identifiers or public API were renamed.
@kikoso
kikoso requested a review from a team as a code owner October 14, 2026 07:54
Comment thread gradle/libs.versions.toml
gradleMavenPublishPlugin = "0.37.0"
kotlin = "2.4.20"
kotlinxCoroutines = "1.11.0"
spotless = "8.9.0"
@github-actions

Copy link
Copy Markdown

Coverage (unit tests)

Compared against 85a56aa on main (#1034).

Module Line % Change Branch % Change
maps-compose 0.00% no change 0.00% no change
maps-compose-utils 2.06% 🔺 +0.02 0.49% no change
maps-compose-widgets 0.00% no change 0.00% no change
TOTAL 0.42% 🔺 +0.01 0.09% no change

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Coverage (instrumentation tests)

Overall Project 44.43% -7.68% 🍏
Files changed 35.85% ❌

Module Coverage
maps-app 73.12% -1.35% 🍏
maps-app 63.22% -4.65% 🍏
maps-app 55.95% -3.4% ❌
debug 24.69% -11.53% ❌
Files
Module File Coverage
maps-app ScaleBar.kt 73.12% -1.35% 🍏
maps-app MapType.kt 100% 🍏
AttributionIdInitializer.kt 100% 🍏
RememberComposeBitmapDescriptor.kt 96.08% 🍏
CameraMoveStartedReason.kt 96% 🍏
ComposeInfoWindowAdapter.kt 90.84% 🍏
MapClickListeners.kt 89.76% -6.79% 🍏
StreetView.kt 88.76% -1.83% 🍏
StreetViewPanoramaApplier.kt 88.24% 🍏
MapUpdater.kt 80.28% -2.29% 🍏
GoogleMap.kt 79.52% -12.18% 🍏
Polyline.kt 74.44% -1.12% 🍏
Circle.kt 73.66% -2.23% ❌
StreetViewPanoramaUpdater.kt 72.55% 🍏
Polygon.kt 70.87% -2.23% 🍏
MapComposeViewRender.kt 67.64% 🍏
CameraPositionState.kt 66.84% -5.97% ❌
Marker.kt 64.38% -4.7% ❌
StreetViewPanoramaEventListeners.kt 61.19% 🍏
MapProperties.kt 55.96% -1.11% ❌
MapUiSettings.kt 54.52% -2.07% ❌
InputHandler.kt 43.98% 🍏
StreetViewCameraPositionState.kt 39.58% -13.02% 🍏
MapApplier.kt 31.13% -4.69% ❌
MapEffect.kt 20.82% -1.17% ❌
TileOverlay.kt 0% -6.17% ❌
GroundOverlay.kt 0% -8.29% ❌
maps-app ClusterRenderer.kt 71.64% -1.71% 🍏
Clustering.kt 53.46% -3.46% ❌
WmsUrlTileProvider.kt 0% 🍏
WmsTileOverlay.kt 0% -18.95% ❌
debug BasicMapActivity.kt 79.71% -2.12% 🍏
RecompositionActivity.kt 75.58% -1.32% 🍏
MapInColumnActivity.kt 69.68% -3.32% 🍏
MapsInLazyColumnActivity.kt 64.83% -0.41% 🍏
MarkerClusteringActivity.kt 1.8% -8.86% ❌
UpdatingNoDragMarkerWithDataModelActivity.kt 0% -23.96% ❌
MapFragmentPagerAdapter.kt 0% -19.64% ❌
GroundOverlayActivity.kt 0% -14.21% ❌
WmsTileOverlayActivity.kt 0% -60.37% ❌
AccessibilityActivity.kt 0% -3.7% ❌
LocationTrackingActivity.kt 0% -16.69% ❌
ScaleBarActivity.kt 0% -15.88% ❌
CustomControlsActivity.kt 0% -9% ❌
LiteModeActivity.kt 0% -21.98% ❌
TileOverlayActivity.kt 0% 🍏
StreetViewActivity.kt 0% -1.68% ❌
FragmentDemoActivity.kt 0% 🍏
MainActivity.kt 0% -27.7% ❌
GoogleMapComposeFragment.kt 0% -40.23% ❌
Demo.kt 0% -18.63% ❌
SyncingDraggableMarkerWithDataModelActivity.kt 0% -10.14% ❌
MarkerDragEventsActivity.kt 0% -25.26% ❌
Theme.kt 0% -28.57% ❌
MarkerClusteringRotationActivity.kt 0% -10.41% ❌
AdvancedMarkersActivity.kt 0% -4.39% ❌
DraggableMarkersCollectionWithPolygonActivity.kt 0% -15.4% ❌
MarkersCollectionActivity.kt 0% -32.18% ❌

@dkhawk
dkhawk merged commit 0bc6ecd into main Oct 14, 2026
13 checks passed
@dkhawk
dkhawk deleted the build/add-spotless branch October 14, 2026 15:24
dkhawk added a commit that referenced this pull request Oct 14, 2026
- Apply Spotless ktlint 8.9.0 formatting across snippets module following rebase on #1040
- Align docs/CATALOG.md line ranges with spotless-formatted sources
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.

4 participants