From 2301f0bf334e12e811c654a2b1bbf3d5f572615e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20L=C3=B3pez=20Ma=C3=B1as?= Date: Wed, 16 Oct 2024 10:15:39 +0200 Subject: [PATCH] chore: added lint report (#636) * chore: added lint report * chore: get rid of deprecation * chore: change path * chore: merging lint reports * chore: upload merged file * chore: fixed warnings --- .github/workflows/lint-report.yml | 49 +++++++++++++++++++ app/build.gradle.kts | 4 ++ .../markerexamples/AdvancedMarkersActivity.kt | 2 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 4 +- .../mipmap-anydpi-v26/ic_launcher_round.xml | 10 ++-- gradle/libs.versions.toml | 2 +- gradle/wrapper/gradle-wrapper.properties | 3 +- maps-compose-utils/build.gradle.kts | 4 ++ maps-compose-widgets/build.gradle.kts | 4 ++ maps-compose/build.gradle.kts | 3 ++ 10 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/lint-report.yml diff --git a/.github/workflows/lint-report.yml b/.github/workflows/lint-report.yml new file mode 100644 index 000000000..c1a2124a7 --- /dev/null +++ b/.github/workflows/lint-report.yml @@ -0,0 +1,49 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Lint and Upload SARIF + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '17' + + - name: Run Android Lint + run: ./gradlew lint + + - name: Merge SARIF files + run: | + jq -s '{ "$schema": "https://json.schemastore.org/sarif-2.1.0", "version": "2.1.0", "runs": map(.runs) | add }' maps-compose/build/reports/lint-results.sarif maps-compose-utils/build/reports/lint-results.sarif maps-compose-widgets/build/reports/lint-results.sarif app/build/reports/lint-results.sarif > merged.sarif + + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: merged.sarif diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d85f5d18a..f588d862d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,6 +6,10 @@ plugins { } android { + lint { + sarifOutput = file("$buildDir/reports/lint-results.sarif") + } + buildTypes { getByName("debug") { enableUnitTestCoverage = true diff --git a/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt b/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt index a78ee674e..3683e7a99 100644 --- a/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt @@ -16,6 +16,7 @@ package com.google.maps.android.compose.markerexamples import android.R.drawable.ic_menu_myplaces +import android.annotation.SuppressLint import android.graphics.Color import android.os.Bundle import android.util.Log @@ -56,6 +57,7 @@ private val center = LatLng(-18.000, -58.000) private val defaultCameraPosition1 = CameraPosition.fromLatLngZoom(center, 2f) class AdvancedMarkersActivity : ComponentActivity(), OnMapsSdkInitializedCallback { + @SuppressLint("SetTextI18n") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) MapsInitializer.initialize(applicationContext, MapsInitializer.Renderer.LATEST, this) diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 7f17c2d54..127e1a1de 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -15,7 +15,9 @@ limitations under the License. --> - + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 7f17c2d54..8cf400e42 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -15,7 +15,11 @@ limitations under the License. --> - - - + + + \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1255e74d2..57130c28b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] activitycompose = "1.9.2" -agp = "8.4.2" +agp = "8.7.1" androidxtest = "1.6.1" compose-bom = "2024.09.02" dokka = "1.9.20" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22ce5..6b3b76b73 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Wed Oct 16 09:55:51 CEST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/maps-compose-utils/build.gradle.kts b/maps-compose-utils/build.gradle.kts index fbbc0b2bd..019112701 100644 --- a/maps-compose-utils/build.gradle.kts +++ b/maps-compose-utils/build.gradle.kts @@ -5,6 +5,10 @@ plugins { } android { + lint { + sarifOutput = file("$buildDir/reports/lint-results.sarif") + } + namespace = "com.google.maps.android.compose.utils" compileSdk = 34 diff --git a/maps-compose-widgets/build.gradle.kts b/maps-compose-widgets/build.gradle.kts index f39e40d0a..3884970f6 100644 --- a/maps-compose-widgets/build.gradle.kts +++ b/maps-compose-widgets/build.gradle.kts @@ -5,6 +5,10 @@ plugins { } android { + lint { + sarifOutput = file("$buildDir/reports/lint-results.sarif") + } + namespace = "com.google.maps.android.compose.widgets" compileSdk = 34 diff --git a/maps-compose/build.gradle.kts b/maps-compose/build.gradle.kts index b0f424199..0d4e9c070 100644 --- a/maps-compose/build.gradle.kts +++ b/maps-compose/build.gradle.kts @@ -5,6 +5,9 @@ plugins { } android { + lint { + sarifOutput = file("$buildDir/reports/lint-results.sarif") + } namespace = "com.google.maps.android.compose" compileSdk = 34