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:30 +05:30
committed by GitHub
parent a5a1c9c602
commit c4f896bc70
6 changed files with 101 additions and 55 deletions

View File

@@ -138,6 +138,9 @@ android {
detekt {
baseline = file("detekt-baseline.xml")
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
allRules = false
}
dependencies {
@@ -146,4 +149,5 @@ dependencies {
implementation(libs.bundles.lifecycle)
implementation(libs.bundles.compose)
debugImplementation(libs.bundles.compose.preview)
detektPlugins(libs.compose.detekt)
}

View File

@@ -1,56 +1,21 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>FunctionNaming:Activity.kt$@Composable fun CheckFeatureLocked( skipCheck: Boolean )</ID>
<ID>FunctionNaming:BrightDisplayActivity.kt$BrightDisplayActivity$@Composable private fun ScreenContent(onChangeColorButtonPress: () -&gt; Unit)</ID>
<ID>FunctionNaming:BrightDisplayScreen.kt$@Composable @MyDevices private fun BrightDisplayScreenPreview()</ID>
<ID>FunctionNaming:BrightDisplayScreen.kt$@Composable internal fun BrightDisplayScreen( backgroundColor: Int, contrastColor: Int, onChangeColorPress: () -&gt; Unit, sleepTimer: @Composable () -&gt; Unit )</ID>
<ID>FunctionNaming:MainActivity.kt$MainActivity$@Composable private fun AppLaunched( donateAlertDialogState: AlertDialogState = getDonateAlertDialogState(), rateStarsAlertDialogState: AlertDialogState = getRateStarsAlertDialogState(), )</ID>
<ID>FunctionNaming:MainActivity.kt$MainActivity$@Composable private fun SleepTimerRadioDialog( alertDialogState: AlertDialogState, onCustomValueSelected: () -&gt; Unit )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable @MyDevices internal fun MainScreenPreview()</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun BrightDisplayButton( onBrightDisplayPress: () -&gt; Unit, )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun FlashlightButton( flashlightActive: Boolean, onFlashlightPress: () -&gt; Unit, )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun MainScreen( flashlightButton: @Composable () -&gt; Unit, brightDisplayButton: @Composable () -&gt; Unit, sosButton: @Composable () -&gt; Unit, stroboscopeButton: @Composable () -&gt; Unit, slidersSection: @Composable () -&gt; Unit, sleepTimer: @Composable () -&gt; Unit, showMoreApps: Boolean, openSettings: () -&gt; Unit, openAbout: () -&gt; Unit, openSleepTimer: () -&gt; Unit, moreAppsFromUs: () -&gt; Unit, )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun MainScreenSlidersSection( showBrightnessBar: Boolean, brightnessBarValue: Float, onBrightnessBarValueChange: (Float) -&gt; Unit, showStroboscopeBar: Boolean, stroboscopeBarValue: Float, onStroboscopeBarValueChange: (Float) -&gt; Unit, )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun SosButton( sosActive: Boolean, onSosButtonPress: () -&gt; Unit, )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun StroboscopeButton( stroboscopeActive: Boolean, onStroboscopeButtonPress: () -&gt; Unit, )</ID>
<ID>FunctionNaming:MainScreen.kt$@Composable private fun SmallButton( painter: Painter, contentDescription: String, isActive: Boolean, onPress: () -&gt; Unit )</ID>
<ID>FunctionNaming:SettingsScreen.kt$@Composable @MyDevices private fun SettingsScreenPreview()</ID>
<ID>FunctionNaming:SettingsScreen.kt$@Composable internal fun ColorCustomizationSettingsSection( customizeColors: () -&gt; Unit, customizeWidgetColors: () -&gt; Unit, )</ID>
<ID>FunctionNaming:SettingsScreen.kt$@Composable internal fun GeneralSettingsSection( showUseEnglish: Boolean, useEnglishChecked: Boolean, showDisplayLanguage: Boolean, displayLanguage: String, turnFlashlightOnStartupChecked: Boolean, forcePortraitModeChecked: Boolean, showBrightDisplayButtonChecked: Boolean, showSosButtonChecked: Boolean, showStroboscopeButtonChecked: Boolean, onUseEnglishPress: (Boolean) -&gt; Unit, onSetupLanguagePress: () -&gt; Unit, onTurnFlashlightOnStartupPress: (Boolean) -&gt; Unit, onForcePortraitModePress: (Boolean) -&gt; Unit, onShowBrightDisplayButtonPress: (Boolean) -&gt; Unit, onShowSosButtonPress: (Boolean) -&gt; Unit, onShowStroboscopeButtonPress: (Boolean) -&gt; Unit, )</ID>
<ID>FunctionNaming:SettingsScreen.kt$@Composable internal fun SettingsScreen( colorCustomizationSection: @Composable () -&gt; Unit, generalSection: @Composable () -&gt; Unit, goBack: () -&gt; Unit, )</ID>
<ID>FunctionNaming:SleepTimer.kt$@Composable @MyDevices internal fun SleepTimerPreview()</ID>
<ID>FunctionNaming:SleepTimer.kt$@Composable internal fun AnimatedSleepTimer( modifier: Modifier = Modifier, timerText: String, timerVisible: Boolean, onTimerClosePress: () -&gt; Unit )</ID>
<ID>FunctionNaming:SleepTimer.kt$@Composable internal fun SleepTimer( modifier: Modifier = Modifier, timerText: String, onCloseClick: () -&gt; Unit )</ID>
<ID>FunctionNaming:SleepTimerCustomAlertDialog.kt$@Composable @MyDevices private fun SleepTimerCustomAlertDialogPreview()</ID>
<ID>FunctionNaming:SleepTimerCustomAlertDialog.kt$@Composable fun SleepTimerCustomAlertDialog( alertDialogState: AlertDialogState, modifier: Modifier = Modifier, onConfirmClick: (seconds: Int) -&gt; Unit, onCancelClick: (() -&gt; Unit)? = null )</ID>
<ID>FunctionNaming:WidgetConfigureScreen.kt$@Composable @MyDevices private fun WidgetBrightDisplayConfigureScreenPreview()</ID>
<ID>FunctionNaming:WidgetConfigureScreen.kt$@Composable internal fun WidgetConfigureScreen( @DrawableRes widgetDrawable: Int, @ColorInt widgetColor: Int, widgetAlpha: Float, onSliderChanged: (Float) -&gt; Unit, onColorPressed: () -&gt; Unit, onSavePressed: () -&gt; Unit )</ID>
<ID>LongMethod:MainActivity.kt$MainActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
<ID>LongMethod:SettingsActivity.kt$SettingsActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
<ID>LongMethod:SleepTimerCustomAlertDialog.kt$@Composable fun SleepTimerCustomAlertDialog( alertDialogState: AlertDialogState, modifier: Modifier = Modifier, onConfirmClick: (seconds: Int) -&gt; Unit, onCancelClick: (() -&gt; Unit)? = null )</ID>
<ID>LongParameterList:Activity.kt$( appNameId: Int, licenseMask: Long, versionName: String, faqItems: ArrayList&lt;FAQItem&gt;, showFAQBeforeMail: Boolean, getAppIconIDs: ArrayList&lt;Int&gt; = getAppIconIDs(), getAppLauncherName: String = launcherName() )</ID>
<ID>LongParameterList:MainScreen.kt$( flashlightButton: @Composable () -&gt; Unit, brightDisplayButton: @Composable () -&gt; Unit, sosButton: @Composable () -&gt; Unit, stroboscopeButton: @Composable () -&gt; Unit, slidersSection: @Composable () -&gt; Unit, sleepTimer: @Composable () -&gt; Unit, showMoreApps: Boolean, openSettings: () -&gt; Unit, openAbout: () -&gt; Unit, openSleepTimer: () -&gt; Unit, moreAppsFromUs: () -&gt; Unit, )</ID>
<ID>LongParameterList:MainScreen.kt$( showBrightnessBar: Boolean, brightnessBarValue: Float, onBrightnessBarValueChange: (Float) -&gt; Unit, showStroboscopeBar: Boolean, stroboscopeBarValue: Float, onStroboscopeBarValueChange: (Float) -&gt; Unit, )</ID>
<ID>LongParameterList:SettingsScreen.kt$( showUseEnglish: Boolean, useEnglishChecked: Boolean, showDisplayLanguage: Boolean, displayLanguage: String, turnFlashlightOnStartupChecked: Boolean, forcePortraitModeChecked: Boolean, showBrightDisplayButtonChecked: Boolean, showSosButtonChecked: Boolean, showStroboscopeButtonChecked: Boolean, onUseEnglishPress: (Boolean) -&gt; Unit, onSetupLanguagePress: () -&gt; Unit, onTurnFlashlightOnStartupPress: (Boolean) -&gt; Unit, onForcePortraitModePress: (Boolean) -&gt; Unit, onShowBrightDisplayButtonPress: (Boolean) -&gt; Unit, onShowSosButtonPress: (Boolean) -&gt; Unit, onShowStroboscopeButtonPress: (Boolean) -&gt; Unit, )</ID>
<ID>LongParameterList:WidgetConfigureScreen.kt$( @DrawableRes widgetDrawable: Int, @ColorInt widgetColor: Int, widgetAlpha: Float, onSliderChanged: (Float) -&gt; Unit, onColorPressed: () -&gt; Unit, onSavePressed: () -&gt; Unit )</ID>
<ID>MagicNumber:Config.kt$Config$1000</ID>
<ID>MagicNumber:Config.kt$Config$1000L</ID>
<ID>ComposableParamOrder:SleepTimer.kt$AnimatedSleepTimer</ID>
<ID>ComposableParamOrder:SleepTimer.kt$SleepTimer</ID>
<ID>ComposableParamOrder:SleepTimerCustomAlertDialog.kt$SleepTimerCustomAlertDialog</ID>
<ID>LambdaParameterEventTrailing:SleepTimer.kt$onCloseClick</ID>
<ID>LambdaParameterEventTrailing:SleepTimer.kt$onTimerClosePress</ID>
<ID>MagicNumber:Config.kt$Config$30</ID>
<ID>MagicNumber:Config.kt$Config$60</ID>
<ID>MagicNumber:Context.kt$60</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$10</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$1000</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$30</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$3600</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$5</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$60</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity.MainViewModel$0.5f</ID>
<ID>MagicNumber:MyCameraImpl.kt$MyCameraImpl$1000L</ID>
<ID>MagicNumber:SleepTimer.kt$SleepTimer$1000L</ID>
<ID>MagicNumber:SleepTimer.kt$SleepTimer.&lt;no name provided&gt;$1000</ID>
<ID>MagicNumber:SleepTimerCustomAlertDialog.kt$60</ID>
<ID>MagicNumber:WidgetConfigureViewModel.kt$WidgetConfigureViewModel$255f</ID>
<ID>MaxLineLength:BrightDisplayActivity.kt$BrightDisplayActivity$AnimatedSleepTimer(timerText = timerText, timerVisible = timerVisible, onTimerClosePress = ::stopSleepTimer)</ID>
<ID>MaxLineLength:BrightDisplayActivity.kt$BrightDisplayActivity$requestedOrientation = if (config.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_SENSOR</ID>
@@ -96,6 +61,11 @@
<ID>MaxLineLength:WidgetConfigureViewModel.kt$WidgetConfigureViewModel$if</ID>
<ID>MaxLineLength:WidgetTorchConfigureActivity.kt$WidgetTorchConfigureActivity$viewModel.setWidgetId(intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID)</ID>
<ID>MemberNameEqualsClassName:SleepTimer.kt$SleepTimer$private var sleepTimer: CountDownTimer? = null</ID>
<ID>MultipleEmitters:MainScreen.kt$MainScreenSlidersSection</ID>
<ID>ParameterNaming:MainActivity.kt$MainActivity$onCustomValueSelected</ID>
<ID>ParameterNaming:WidgetConfigureScreen.kt$onColorPressed</ID>
<ID>ParameterNaming:WidgetConfigureScreen.kt$onSavePressed</ID>
<ID>ParameterNaming:WidgetConfigureScreen.kt$onSliderChanged</ID>
<ID>ReturnCount:MyCameraImpl.kt$MyCameraImpl$fun toggleSOS(): Boolean</ID>
<ID>ReturnCount:MyCameraImpl.kt$MyCameraImpl$fun toggleStroboscope(): Boolean</ID>
<ID>SwallowedException:Activity.kt$e: Exception</ID>

View File

@@ -37,7 +37,7 @@
errorLine2=" ~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="20"
line="21"
column="23"/>
</issue>
@@ -85,6 +85,17 @@
column="17"/>
</issue>
<issue
id="AndroidGradlePluginVersion"
message="A newer version of com.android.application than 8.10.1 is available: 8.11.0"
errorLine1="gradlePlugins-agp = &quot;8.10.1&quot;"
errorLine2=" ~~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="18"
column="21"/>
</issue>
<issue
id="GradleDependency"
message="A newer version of androidx.lifecycle:lifecycle-runtime-compose than 2.9.0 is available: 2.9.1"
@@ -92,7 +103,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="9"
line="10"
column="22"/>
</issue>
@@ -103,7 +114,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="9"
line="10"
column="22"/>
</issue>
@@ -114,7 +125,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="9"
line="10"
column="22"/>
</issue>
@@ -125,7 +136,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="9"
line="10"
column="22"/>
</issue>
@@ -136,7 +147,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
@@ -147,7 +158,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
@@ -158,7 +169,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
@@ -169,7 +180,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
@@ -180,7 +191,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
@@ -191,7 +202,7 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
@@ -202,18 +213,18 @@
errorLine2=" ~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="14"
line="15"
column="11"/>
</issue>
<issue
id="GradleDependency"
message="A newer version of androidx.compose.material3:material3 than 1.4.0-alpha15 is available: 1.4.0-alpha16"
message="A newer version of androidx.compose.material3:material3 than 1.4.0-alpha15 is available: 1.4.0-alpha17"
errorLine1="composeMaterial3 = &quot;1.4.0-alpha15&quot;"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
line="15"
line="16"
column="20"/>
</issue>

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

@@ -3,6 +3,7 @@
kotlin = "2.2.0"
#Detekt
detekt = "1.23.8"
detektCompose = "0.4.22"
#AndroidX
androidx-customView = "1.2.0"
androidx-customViewPooling = "1.1.0"
@@ -43,6 +44,7 @@ compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
compose-uiTooling-debug = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-uiTooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
[bundles]
compose = [
"compose-activity",

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>