ARK-Builders / ARK-Navigator

Android app for navigation through your data
MIT License
15 stars 15 forks source link

SonarCloud integration and warnings #402

Closed kirillt closed 6 months ago

kirillt commented 8 months ago

Let's have similar SonarCloud integration:

We also need to check current warnings and fix those which are quick to fix: Reference issue: https://github.com/ARK-Builders/ARK-Navigator/issues/405

> Task :app:compileDebugKotlin
.../data/preferences/PreferencesImpl.kt: (75, 23): Unchecked cast: Preferences.Key<out {Comparable<*> & java.io.Serializable}> to Preferences.Key<T>
.../data/stats/category/StatsCategoryStorage.kt: (23, 14): This declaration is in a preview state and can be changed in a backwards-incompatible manner with a best-effort migration. Its usage should be marked with '@kotlinx.coroutines.FlowPreview' or '@OptIn(kotlinx.coroutines.FlowPreview::class)' if you accept the drawback of relying on preview API
.../data/stats/category/TagLabeledNStorage.kt: (30, 29): This declaration needs opt-in. Its usage should be marked with '@kotlinx.serialization.ExperimentalSerializationApi' or '@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)'
.../data/stats/category/TagLabeledTSStorage.kt: (26, 29): This declaration needs opt-in. Its usage should be marked with '@kotlinx.serialization.ExperimentalSerializationApi' or '@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)'
.../data/stats/category/TagQueriedTSStorage.kt: (26, 25): This declaration needs opt-in. Its usage should be marked with '@kotlinx.serialization.ExperimentalSerializationApi' or '@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)'
.../presentation/dialog/InfoDialogFragment.kt: (31, 21): 'get(String!): Any?' is deprecated. Deprecated in Java
.../presentation/dialog/InfoDialogFragment.kt: (32, 27): 'get(String!): Any?' is deprecated. Deprecated in Java
.../presentation/dialog/edittags/EditTagsDialogFragment.kt: (44, 13): 'get(String!): Any?' is deprecated. Deprecated in Java
.../presentation/dialog/edittags/EditTagsDialogFragment.kt: (45, 32): 'getParcelableArray(String?): Array<(out) Parcelable!>?' is deprecated. Deprecated in Java
.../presentation/dialog/edittags/EditTagsDialogFragment.kt: (46, 17): Unchecked cast: List<Parcelable!> to List<ResourceId>
.../presentation/dialog/edittags/EditTagsDialogFragment.kt: (81, 50): Parameter 'event' is never used, could be renamed to _
.../presentation/dialog/edittags/EditTagsDialogPresenter.kt: (275, 11): Unchecked cast: Map<Tag /* = String */, {Comparable<*> & Number}> to Map<Tag /* = String */, Comparable<Any>>
.../presentation/dialog/tagssort/TagsSortViewModel.kt: (92, 64): Unchecked cast: TagsSortViewModel to T
.../presentation/navigation/AppNavigator.kt: (220, 9): Parameter 'command' is never used
.../presentation/navigation/AppNavigator.kt: (221, 9): Parameter 'currentFragment' is never used
.../presentation/navigation/AppNavigator.kt: (222, 9): Parameter 'nextFragment' is never used
.../presentation/navigation/AppNavigator.kt: (223, 9): Parameter 'fragmentTransaction' is never used
.../presentation/navigation/AppNavigator.kt: (235, 9): Parameter 'command' is never used
.../presentation/navigation/AppNavigator.kt: (236, 9): Parameter 'activityIntent' is never used
.../presentation/navigation/AppNavigator.kt: (261, 9): Parameter 'screen' is never used
.../presentation/navigation/AppNavigator.kt: (262, 9): Parameter 'activityIntent' is never used
.../presentation/navigation/AppNavigator.kt: (287, 36): Parameter 'screen' is never used
.../presentation/screen/folders/FoldersViewModel.kt: (290, 11): Unchecked cast: FoldersViewModel to T
.../presentation/screen/gallery/GalleryFragment.kt: (66, 13): 'get(String!): Any?' is deprecated. Deprecated in Java
.../presentation/screen/gallery/GalleryFragment.kt: (67, 32): 'getParcelableArray(String?): Array<(out) Parcelable!>?' is deprecated. Deprecated in Java
.../presentation/screen/gallery/GalleryFragment.kt: (68, 17): Unchecked cast: List<Parcelable!> to List<ResourceId>
.../presentation/screen/gallery/GalleryFragment.kt: (72, 36): 'getParcelableArray(String?): Array<(out) Parcelable!>?' is deprecated. Deprecated in Java
.../presentation/screen/gallery/GalleryFragment.kt: (73, 31): Unchecked cast: List<Parcelable!> to List<ResourceId>
.../presentation/screen/gallery/GalleryFragment.kt: (337, 13): 'get(String!): Any?' is deprecated. Deprecated in Java
.../presentation/screen/gallery/GalleryFragment.kt: (524, 13): Variable 'extension' is never used
.../presentation/screen/gallery/previewpager/PreviewImageViewHolder.kt: (37, 52): Parameter 'view' is never used, could be renamed to _
.../presentation/screen/gallery/previewpager/PreviewImageViewHolder.kt: (40, 45): Parameter 'view' is never used, could be renamed to _
.../presentation/screen/gallery/previewpager/PreviewImageViewHolder.kt: (87, 9): Parameter 'meta' is never used
.../presentation/screen/gallery/previewpager/PreviewPlainTextViewHolder.kt: (16, 48): Parameter 'view' is never used, could be renamed to _
.../presentation/screen/main/MainActivity.kt: (86, 25): The expression is unused
.../presentation/screen/resources/ResourcesFragment.kt: (70, 13): 'get(String!): Any?' is deprecated. Deprecated in Java
.../presentation/screen/resources/ResourcesFragment.kt: (434, 28): 'getParcelableArray(String?): Array<(out) Parcelable!>?' is deprecated. Deprecated in Java
.../presentation/screen/resources/ResourcesFragment.kt: (436, 34): Unchecked cast: List<Parcelable!> to List<ResourceId>
.../presentation/screen/resources/ResourcesPresenter.kt: (122, 19): Unchecked cast: Map<Tag /* = String */, {Comparable<*> & Number}> to Map<Tag /* = String */, Comparable<Any>>
.../presentation/screen/resources/ResourcesPresenter.kt: (375, 66): Parameter 'to' is never used
.../presentation/utils/FullscreenHelper.kt: (18, 28): 'getWindowInsetsController(View): WindowInsetsControllerCompat?' is deprecated. Deprecated in Java
.../presentation/utils/FullscreenHelper.kt: (22, 59): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
.../presentation/utils/FullscreenHelper.kt: (29, 61): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
.../presentation/view/StackedToasts.kt: (104, 13): Parameter 'value' is never used
kirillt commented 8 months ago

Repository secret SONAR_TOKEN is created.

That's what official docs say, but we did it a bit different way in arklib-android:

Update your build.gradle.kts file with the org.sonarqube plugin and its configuration:


plugins {
id("org.sonarqube") version "4.4.1.3373"
}

sonar { properties { property("sonar.projectKey", "ARK-Builders_ARK-Navigator") property("sonar.organization", "ark-builders") property("sonar.host.url", "https://sonarcloud.io") } }

> Create or update your `.github/workflows/build.yml`. Here is a base configuration to run a SonarCloud analysis on your master branch and Pull Requests. If you already have some GitHub Actions, you might want to just add some of these new steps to an existing one.

name: SonarCloud on: push: branches:

tuancoltech commented 8 months ago

First resolve warnings using local analysis tool: https://github.com/ARK-Builders/ARK-Navigator/issues/405

kirillt commented 8 months ago

Assigned this to Hieu since we've just done same job in arklib-android.