chore: ignore extra translations and update detekt rules

* chore: ignore extra translations in lint

Extra translations are removed automatically by Weblate

* chore: update detekt rules

More compose-friendly

* chore: update lint baselines
This commit is contained in:
Naveen Singh
2025-07-03 21:16:18 +05:30
committed by GitHub
parent 4d1f035614
commit cc2a5ec124
6 changed files with 86 additions and 25 deletions

View File

@@ -132,6 +132,9 @@ android {
detekt {
baseline = file("detekt-baseline.xml")
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
allRules = false
}
dependencies {
@@ -148,4 +151,5 @@ dependencies {
implementation(libs.bundles.room)
ksp(libs.androidx.room.compiler)
detektPlugins(libs.compose.detekt)
}

View File

@@ -18,18 +18,10 @@
<ID>ForbiddenComment:AlarmController.kt$AlarmController$// TODO: This is a bit of a hack. Skipped alarms should be tracked properly.</ID>
<ID>ForbiddenComment:AlarmController.kt$AlarmController$// TODO: This works but it is very rudimentary. Snoozed alarms are not being tracked.</ID>
<ID>ForbiddenComment:AlarmsAdapter.kt$AlarmsAdapter$// TODO: This does not respect config.firstDayOfWeek</ID>
<ID>LongMethod:AlarmActivity.kt$AlarmActivity$@SuppressLint("ClickableViewAccessibility") private fun setupAlarmButtons()</ID>
<ID>LongMethod:Constants.kt$@Suppress("MagicNumber") fun getAllTimeZones()</ID>
<ID>LongMethod:IntentHandlerActivity.kt$IntentHandlerActivity$private fun Intent.dismissAlarm()</ID>
<ID>LongMethod:IntentHandlerActivity.kt$IntentHandlerActivity$private fun Intent.setNewAlarm()</ID>
<ID>MagicNumber:App.kt$App$1000L</ID>
<ID>MagicNumber:App.kt$App.&lt;no name provided&gt;$1000</ID>
<ID>MagicNumber:ClockFragment.kt$ClockFragment$1000L</ID>
<ID>MagicNumber:ClockFragment.kt$ClockFragment$24</ID>
<ID>MagicNumber:ClockFragment.kt$ClockFragment$3600</ID>
<ID>MagicNumber:ClockFragment.kt$ClockFragment$60</ID>
<ID>MagicNumber:Config.kt$Config$300</ID>
<ID>MagicNumber:Constants.kt$1000</ID>
<ID>MagicNumber:Constants.kt$5</ID>
<ID>MagicNumber:Constants.kt$60</ID>
<ID>MagicNumber:Constants.kt$7</ID>
@@ -59,15 +51,11 @@
<ID>MagicNumber:IntentHandlerActivity.kt$IntentHandlerActivity$59</ID>
<ID>MagicNumber:IntentHandlerActivity.kt$IntentHandlerActivity$60</ID>
<ID>MagicNumber:Long.kt$100</ID>
<ID>MagicNumber:Long.kt$1000</ID>
<ID>MagicNumber:Long.kt$1000F</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$3</ID>
<ID>MagicNumber:MyTimePickerDialogDialog.kt$MyTimePickerDialogDialog$3600</ID>
<ID>MagicNumber:MyTimePickerDialogDialog.kt$MyTimePickerDialogDialog$60</ID>
<ID>MagicNumber:StopwatchService.kt$StopwatchService.&lt;no name provided&gt;$500L</ID>
<ID>MagicNumber:TimeZonesAdapter.kt$TimeZonesAdapter$1000</ID>
<ID>MagicNumber:TimerAdapter.kt$TimerAdapter$0.7f</ID>
<ID>MagicNumber:TimerFragment.kt$TimerFragment$1000</ID>
<ID>MagicNumber:WidgetAnalogueConfigureActivity.kt$WidgetAnalogueConfigureActivity$100</ID>
<ID>MagicNumber:WidgetDigitalConfigureActivity.kt$WidgetDigitalConfigureActivity$100</ID>
<ID>MaxLineLength:DBHelper.kt$DBHelper$"$COL_IS_ENABLED INTEGER, $COL_VIBRATE INTEGER, $COL_SOUND_TITLE TEXT, $COL_SOUND_URI TEXT, $COL_LABEL TEXT, $COL_ONE_SHOT INTEGER)"</ID>

View File

@@ -51,8 +51,8 @@
errorLine1="app-build-targetSDK = &quot;34&quot;"
errorLine2=" ~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/libs.versions.toml"
line="29"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/libs.versions.toml"
line="30"
column="23"/>
</issue>
@@ -128,7 +128,7 @@
errorLine1="distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/wrapper/gradle-wrapper.properties"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/wrapper/gradle-wrapper.properties"
line="3"
column="17"/>
</issue>
@@ -139,8 +139,8 @@
errorLine1="gradlePlugins-agp = &quot;8.10.1&quot;"
errorLine2=" ~~~~~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/libs.versions.toml"
line="26"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/libs.versions.toml"
line="27"
column="21"/>
</issue>
@@ -150,8 +150,8 @@
errorLine1="androidx-lifecycle = &quot;2.8.7&quot;"
errorLine2=" ~~~~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/libs.versions.toml"
line="11"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/libs.versions.toml"
line="12"
column="22"/>
</issue>
@@ -161,8 +161,8 @@
errorLine1="androidx-lifecycle = &quot;2.8.7&quot;"
errorLine2=" ~~~~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/libs.versions.toml"
line="11"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/libs.versions.toml"
line="12"
column="22"/>
</issue>
@@ -172,8 +172,8 @@
errorLine1="androidx-lifecycle = &quot;2.8.7&quot;"
errorLine2=" ~~~~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/libs.versions.toml"
line="11"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/libs.versions.toml"
line="12"
column="22"/>
</issue>
@@ -183,8 +183,8 @@
errorLine1="app-build-compileSDKVersion = &quot;34&quot;"
errorLine2=" ~~~~">
<location
file="$HOME/work/Clock/Clock/gradle/libs.versions.toml"
line="28"
file="$HOME/Projects/Fossify/FossifyOrg/Clock/gradle/libs.versions.toml"
line="29"
column="31"/>
</issue>
@@ -859,6 +859,13 @@
column="18"/>
</issue>
<issue
id="ObsoleteSdkInt"
message="This folder configuration (`v26`) is unnecessary; `minSdkVersion` is 26. Merge all the resources in this folder into `layout`.">
<location
file="src/main/res/layout-v26"/>
</issue>
<issue
id="ObsoleteSdkInt"
message="This folder configuration (`v26`) is unnecessary; `minSdkVersion` is 26. Merge all the resources in this folder into `mipmap-anydpi`.">

58
detekt.yml Normal file
View File

@@ -0,0 +1,58 @@
build:
maxIssues: 0
weights:
complexity: 2
LongParameterList: 2
style: 1
processors:
active: true
exclude:
- "FunctionCountProcessor"
- "PropertyCountProcessor"
config:
validation: true
complexity:
LongParameterList:
active: true
functionThreshold: 10
constructorThreshold: 8
ignoreDefaultParameters: true
ignoreAnnotated:
- "Composable"
LongMethod:
active: true
threshold: 120
ignoreAnnotated:
- "Composable"
- "Preview"
style:
MagicNumber:
active: true
ignoreAnnotated: ["Composable"]
ignoreEnums: true
ignoreNumbers: ["-1", "0", "1", "2", "42", "1000"]
MaxLineLength:
active: true
maxLineLength: 120
excludePackageStatements: true
excludeImportStatements: true
naming:
FunctionNaming:
active: true
ignoreAnnotated: ["Composable", "Preview"]
functionPattern: "[a-z][A-Za-z0-9]*"
Compose: # io.nlopez.compose.rules
ComposableParametersOrdering:
active: true
ModifierDefaultValue:
active: true
MissingModifierDefaultValue:
active: true
PublicComposablePreview:
active: true

View File

@@ -6,6 +6,7 @@ kotlinxSerializationJson = "1.8.1"
ksp = "2.1.21-2.0.2"
#Detekt
detekt = "1.23.8"
detektCompose = "0.4.22"
#AndroidX
androidx-constraintlayout = "2.2.1"
androidx-lifecycle = "2.8.7"
@@ -52,6 +53,8 @@ numberpicker = { module = "io.github.ShawnLin013:number-picker", version.ref = "
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
#Compose
compose-detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
#Fossify
fossify-commons = { module = "org.fossify:commons", version.ref = "commons" }
[bundles]

View File

@@ -31,4 +31,5 @@
<issue id="IconDensities" severity="warning" />
<issue id="GradleDependency" severity="warning" />
<issue id="Overdraw" severity="warning" />
<issue id="ExtraTranslation" severity="warning" />
</lint>