build: fix linting (#728)

* Update android.yml

* Update android.yml

* Update AndroidManifest.xml

* Update android.yml

* Update AndroidManifest.xml

* Separate steps

* Avoid linting

* List packages

* Build debug

* Add stacktrace

* Upload artifacts

* Checkout

* Wait for build

* Fix ADB path

* Fix paths

* Update targets

* Test and check

* Fix path

* Improve pipeline

* Fix CI

* Fix action

* Upload on failure

* Removel inting

* Fix lint report path

* Fix path

* Print paths content

* Add params

* Fix path

* Remove lint

* Check

* Test only

* Format

* Re add linting

* Remove format

* Fix paths

* Uneeded

* Disable telemetry

* Fix library use

* Revert lib change

* Use Gradle to deploy

* Run instrumentation tests after install

* Save artifacts directories

* Run instrumented tests on main app only

* Manual SDK install

* connectedCheck

* Use runner action

* No manual install

* Temporary comment

* No artifact download

* Add Checkstyle

* Pin actions and remove comments

* Needs build

* Add Dependabot

* Harden runners

* Add checkstyle configuration

* Consistency

* actions-update: Bump actions/checkout in the actions-dependencies group

Bumps the actions-dependencies group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 2 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Hardening in block mode

* build(deps): Bump the gradle group across 1 directory with 3 updates

Bumps the gradle group with 3 updates in the / directory: commons-io:commons-io, [com.fasterxml.jackson.core:jackson-core](https://github.com/FasterXML/jackson-core) and [com.fasterxml.jackson.core:jackson-databind](https://github.com/FasterXML/jackson).


Updates `commons-io:commons-io` from 2.8.0 to 2.14.0

Updates `com.fasterxml.jackson.core:jackson-core` from 2.14.2 to 2.15.0
- [Changelog](https://github.com/FasterXML/jackson-core/blob/jackson-core-2.15.0/release.properties)
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.14.2...jackson-core-2.15.0)

Updates `com.fasterxml.jackson.core:jackson-databind` from 2.12.4 to 2.12.7.1
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: commons-io:commons-io
  dependency-version: 2.14.0
  dependency-type: direct:production
  dependency-group: gradle
- dependency-name: com.fasterxml.jackson.core:jackson-core
  dependency-version: 2.15.0
  dependency-type: direct:production
  dependency-group: gradle
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-version: 2.12.7.1
  dependency-type: direct:production
  dependency-group: gradle
...

Signed-off-by: dependabot[bot] <support@github.com>

* Gradle 8.14

* Fix egress

* Fix egress

* Audit

* Revert

* Run checkstyle

* Add task

* Remove checkstyle

* Remove checkstyle

* Fix name

* Add name

* Correct reports path

* Print paths

* Print

* Upload build logs

* Remove logs upload

* Misc

* Cache readonly (#4)

* Implement read only cache

* Build OsmDroid

* Parallelize jobs (#6)

* actions-update: Bump step-security/harden-runner (#5)

Bumps the actions-dependencies group with 1 update: [step-security/harden-runner](https://github.com/step-security/harden-runner).


Updates `step-security/harden-runner` from 2.12.2 to 2.13.0
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](6c439dc8bd...ec9f2d5744)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Upgrade to Gradle 8.13

* Upgrade Kotlin version

* Add buildConfig

* Optimize imports

* Dependabot: only upgrade at patch version level

* Revert Gradle update action

* Dependabot: add Gradle support for patch versions

* gradle-update: bump org.osmdroid:osmdroid-android (#7)

Bumps the actions-dependencies group with 1 update: [org.osmdroid:osmdroid-android](https://github.com/osmdroid/osmdroid).


Updates `org.osmdroid:osmdroid-android` from 6.1.11 to 6.1.20
- [Release notes](https://github.com/osmdroid/osmdroid/releases)
- [Changelog](https://github.com/osmdroid/osmdroid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/osmdroid/osmdroid/compare/osmdroid-parent-6.1.11...osmdroid-parent-6.1.20)

---
updated-dependencies:
- dependency-name: org.osmdroid:osmdroid-android
  dependency-version: 6.1.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* gradle-update: bump com.fasterxml.jackson.core:jackson-databind (#8)

Bumps [com.fasterxml.jackson.core:jackson-databind](https://github.com/FasterXML/jackson) from 2.12.4 to 2.19.2.
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix typo in Dependabot conf

* Bump SDK version

* Upgrade SDK version

* Revert targetSdk

* Bump SDK

* Fix type

* Fix build

* Security updates for Gradle

* Ignore major and minor updates

* Lint

* Lint: ignore string format

* Lint: ignore string format for library

* Lint: disable translation checks

* Migrate activity!!

* Migrate context!!

* Add SARIF report generation and upload

* Lint: do not check dependencies

* Fix path again

* Lint: re-enable for all tasks

* Add gitignore

* Bump targetSdk

* Remove Dependabot Gradle config

* Remove crashpad handler fix

* Bump SARIF action to latest version

* Revert SDK upgrade

* Revert SDK upgrade related fixes

* Revert non-lint fixes

* Revert sensor fix

* Restore gitignore

* Delete build/reports/problems/problems-report.html

* Fix pipeline run

* Add required fixes from linting pass

* Fix conflict

* Revert targetSdk upgrade and ignore ExpiredTargetSdkVersion for linting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Florian Stosse
2025-07-27 15:58:10 +02:00
committed by GitHub
parent 1eb6ed9477
commit 25902ed60f
6 changed files with 18 additions and 9 deletions

View File

@@ -36,7 +36,14 @@ jobs:
gradle-version: '8.13'
- name: Run checks
run: ./gradlew check -x lint
run: ./gradlew check
- name: Upload SARIF report
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
if: success() || failure()
with:
sarif_file: GPSTest/build/reports/lint-results-googleDebug.sarif
category: lint
build:
name: Build debug APK
@@ -68,7 +75,7 @@ jobs:
cache-read-only: true
- name: Build app
run: ./gradlew assembleDebug -x lint --stacktrace
run: ./gradlew assembleDebug --stacktrace
- name: Upload APKs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

View File

@@ -56,7 +56,8 @@ android {
}
lintOptions {
disable 'MissingTranslation', 'ExtraTranslation'
sarifReport true
disable 'MissingTranslation', 'ExtraTranslation', 'StringFormatInvalid'
}
if (project.hasProperty("secure.properties")

View File

@@ -40,9 +40,9 @@ class ShareDialogFragment : DialogFragment() {
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val view = activity!!.layoutInflater.inflate(R.layout.share, null)
val view = requireActivity().layoutInflater.inflate(R.layout.share, null)
setRetainInstance(true)
val builder = AlertDialog.Builder(activity!!)
val builder = AlertDialog.Builder(requireActivity())
.setTitle(R.string.share)
.setView(view)
.setNeutralButton(R.string.main_help_close) { dialog, _ -> }

View File

@@ -89,7 +89,7 @@ class ShareLogFragment : Fragment() {
val uri = IOUtils.getUriFromFile(activity, BuildConfig.APPLICATION_ID, files?.get(0))
val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.data = uri
activity!!.startActivityForResult(intent, LibUIUtils.PICKFILE_REQUEST_CODE)
requireActivity().startActivityForResult(intent, LibUIUtils.PICKFILE_REQUEST_CODE)
// Dismiss the dialog - it will be re-created in the callback to GpsTestActivity
listener.onFileBrowse()
}

View File

@@ -68,7 +68,7 @@ class UploadDeviceInfoFragment : Fragment() {
uploadNoLocationTextView.visibility = View.GONE
if (Geocoder.isPresent()) {
val geocoder = Geocoder(context!!)
val geocoder = Geocoder(requireContext())
var addresses: List<Address>? = emptyList()
try {
addresses = geocoder.getFromLocation(location.latitude, location.longitude, 1)

View File

@@ -22,8 +22,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
lint {
disable "JvmStaticProvidesInObjectDetector", "FieldSiteTargetOnQualifierAnnotation", "ModuleCompanionObjects", "ModuleCompanionObjectsNotInModuleParent"
lintOptions {
disable "JvmStaticProvidesInObjectDetector", "FieldSiteTargetOnQualifierAnnotation", "ModuleCompanionObjects", "ModuleCompanionObjectsNotInModuleParent", 'StringFormatInvalid', 'MissingTranslation', 'ExtraTranslation', 'ExpiredTargetSdkVersion'
}
buildFeatures {