Skip to content

Commit c4f896b

Browse files
authored
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
1 parent a5a1c9c commit c4f896b

6 files changed

Lines changed: 101 additions & 55 deletions

File tree

app/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ android {
138138

139139
detekt {
140140
baseline = file("detekt-baseline.xml")
141+
config.setFrom("$rootDir/detekt.yml")
142+
buildUponDefaultConfig = true
143+
allRules = false
141144
}
142145

143146
dependencies {
@@ -146,4 +149,5 @@ dependencies {
146149
implementation(libs.bundles.lifecycle)
147150
implementation(libs.bundles.compose)
148151
debugImplementation(libs.bundles.compose.preview)
152+
detektPlugins(libs.compose.detekt)
149153
}

app/detekt-baseline.xml

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,21 @@
11
<?xml version="1.0" ?>
22
<SmellBaseline>
3-
<ManuallySuppressedIssues></ManuallySuppressedIssues>
3+
<ManuallySuppressedIssues/>
44
<CurrentIssues>
5-
<ID>FunctionNaming:Activity.kt$@Composable fun CheckFeatureLocked( skipCheck: Boolean )</ID>
6-
<ID>FunctionNaming:BrightDisplayActivity.kt$BrightDisplayActivity$@Composable private fun ScreenContent(onChangeColorButtonPress: () -&gt; Unit)</ID>
7-
<ID>FunctionNaming:BrightDisplayScreen.kt$@Composable @MyDevices private fun BrightDisplayScreenPreview()</ID>
8-
<ID>FunctionNaming:BrightDisplayScreen.kt$@Composable internal fun BrightDisplayScreen( backgroundColor: Int, contrastColor: Int, onChangeColorPress: () -&gt; Unit, sleepTimer: @Composable () -&gt; Unit )</ID>
9-
<ID>FunctionNaming:MainActivity.kt$MainActivity$@Composable private fun AppLaunched( donateAlertDialogState: AlertDialogState = getDonateAlertDialogState(), rateStarsAlertDialogState: AlertDialogState = getRateStarsAlertDialogState(), )</ID>
10-
<ID>FunctionNaming:MainActivity.kt$MainActivity$@Composable private fun SleepTimerRadioDialog( alertDialogState: AlertDialogState, onCustomValueSelected: () -&gt; Unit )</ID>
11-
<ID>FunctionNaming:MainScreen.kt$@Composable @MyDevices internal fun MainScreenPreview()</ID>
12-
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun BrightDisplayButton( onBrightDisplayPress: () -&gt; Unit, )</ID>
13-
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun FlashlightButton( flashlightActive: Boolean, onFlashlightPress: () -&gt; Unit, )</ID>
14-
<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>
15-
<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>
16-
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun SosButton( sosActive: Boolean, onSosButtonPress: () -&gt; Unit, )</ID>
17-
<ID>FunctionNaming:MainScreen.kt$@Composable internal fun StroboscopeButton( stroboscopeActive: Boolean, onStroboscopeButtonPress: () -&gt; Unit, )</ID>
18-
<ID>FunctionNaming:MainScreen.kt$@Composable private fun SmallButton( painter: Painter, contentDescription: String, isActive: Boolean, onPress: () -&gt; Unit )</ID>
19-
<ID>FunctionNaming:SettingsScreen.kt$@Composable @MyDevices private fun SettingsScreenPreview()</ID>
20-
<ID>FunctionNaming:SettingsScreen.kt$@Composable internal fun ColorCustomizationSettingsSection( customizeColors: () -&gt; Unit, customizeWidgetColors: () -&gt; Unit, )</ID>
21-
<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>
22-
<ID>FunctionNaming:SettingsScreen.kt$@Composable internal fun SettingsScreen( colorCustomizationSection: @Composable () -&gt; Unit, generalSection: @Composable () -&gt; Unit, goBack: () -&gt; Unit, )</ID>
23-
<ID>FunctionNaming:SleepTimer.kt$@Composable @MyDevices internal fun SleepTimerPreview()</ID>
24-
<ID>FunctionNaming:SleepTimer.kt$@Composable internal fun AnimatedSleepTimer( modifier: Modifier = Modifier, timerText: String, timerVisible: Boolean, onTimerClosePress: () -&gt; Unit )</ID>
25-
<ID>FunctionNaming:SleepTimer.kt$@Composable internal fun SleepTimer( modifier: Modifier = Modifier, timerText: String, onCloseClick: () -&gt; Unit )</ID>
26-
<ID>FunctionNaming:SleepTimerCustomAlertDialog.kt$@Composable @MyDevices private fun SleepTimerCustomAlertDialogPreview()</ID>
27-
<ID>FunctionNaming:SleepTimerCustomAlertDialog.kt$@Composable fun SleepTimerCustomAlertDialog( alertDialogState: AlertDialogState, modifier: Modifier = Modifier, onConfirmClick: (seconds: Int) -&gt; Unit, onCancelClick: (() -&gt; Unit)? = null )</ID>
28-
<ID>FunctionNaming:WidgetConfigureScreen.kt$@Composable @MyDevices private fun WidgetBrightDisplayConfigureScreenPreview()</ID>
29-
<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>
30-
<ID>LongMethod:MainActivity.kt$MainActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
31-
<ID>LongMethod:SettingsActivity.kt$SettingsActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
32-
<ID>LongMethod:SleepTimerCustomAlertDialog.kt$@Composable fun SleepTimerCustomAlertDialog( alertDialogState: AlertDialogState, modifier: Modifier = Modifier, onConfirmClick: (seconds: Int) -&gt; Unit, onCancelClick: (() -&gt; Unit)? = null )</ID>
33-
<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>
34-
<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>
35-
<ID>LongParameterList:MainScreen.kt$( showBrightnessBar: Boolean, brightnessBarValue: Float, onBrightnessBarValueChange: (Float) -&gt; Unit, showStroboscopeBar: Boolean, stroboscopeBarValue: Float, onStroboscopeBarValueChange: (Float) -&gt; Unit, )</ID>
36-
<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>
37-
<ID>LongParameterList:WidgetConfigureScreen.kt$( @DrawableRes widgetDrawable: Int, @ColorInt widgetColor: Int, widgetAlpha: Float, onSliderChanged: (Float) -&gt; Unit, onColorPressed: () -&gt; Unit, onSavePressed: () -&gt; Unit )</ID>
38-
<ID>MagicNumber:Config.kt$Config$1000</ID>
39-
<ID>MagicNumber:Config.kt$Config$1000L</ID>
5+
<ID>ComposableParamOrder:SleepTimer.kt$AnimatedSleepTimer</ID>
6+
<ID>ComposableParamOrder:SleepTimer.kt$SleepTimer</ID>
7+
<ID>ComposableParamOrder:SleepTimerCustomAlertDialog.kt$SleepTimerCustomAlertDialog</ID>
8+
<ID>LambdaParameterEventTrailing:SleepTimer.kt$onCloseClick</ID>
9+
<ID>LambdaParameterEventTrailing:SleepTimer.kt$onTimerClosePress</ID>
4010
<ID>MagicNumber:Config.kt$Config$30</ID>
4111
<ID>MagicNumber:Config.kt$Config$60</ID>
4212
<ID>MagicNumber:Context.kt$60</ID>
4313
<ID>MagicNumber:MainActivity.kt$MainActivity$10</ID>
44-
<ID>MagicNumber:MainActivity.kt$MainActivity$1000</ID>
4514
<ID>MagicNumber:MainActivity.kt$MainActivity$30</ID>
4615
<ID>MagicNumber:MainActivity.kt$MainActivity$3600</ID>
4716
<ID>MagicNumber:MainActivity.kt$MainActivity$5</ID>
4817
<ID>MagicNumber:MainActivity.kt$MainActivity$60</ID>
4918
<ID>MagicNumber:MainActivity.kt$MainActivity.MainViewModel$0.5f</ID>
50-
<ID>MagicNumber:MyCameraImpl.kt$MyCameraImpl$1000L</ID>
51-
<ID>MagicNumber:SleepTimer.kt$SleepTimer$1000L</ID>
52-
<ID>MagicNumber:SleepTimer.kt$SleepTimer.&lt;no name provided&gt;$1000</ID>
53-
<ID>MagicNumber:SleepTimerCustomAlertDialog.kt$60</ID>
5419
<ID>MagicNumber:WidgetConfigureViewModel.kt$WidgetConfigureViewModel$255f</ID>
5520
<ID>MaxLineLength:BrightDisplayActivity.kt$BrightDisplayActivity$AnimatedSleepTimer(timerText = timerText, timerVisible = timerVisible, onTimerClosePress = ::stopSleepTimer)</ID>
5621
<ID>MaxLineLength:BrightDisplayActivity.kt$BrightDisplayActivity$requestedOrientation = if (config.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_SENSOR</ID>
@@ -96,6 +61,11 @@
9661
<ID>MaxLineLength:WidgetConfigureViewModel.kt$WidgetConfigureViewModel$if</ID>
9762
<ID>MaxLineLength:WidgetTorchConfigureActivity.kt$WidgetTorchConfigureActivity$viewModel.setWidgetId(intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID)</ID>
9863
<ID>MemberNameEqualsClassName:SleepTimer.kt$SleepTimer$private var sleepTimer: CountDownTimer? = null</ID>
64+
<ID>MultipleEmitters:MainScreen.kt$MainScreenSlidersSection</ID>
65+
<ID>ParameterNaming:MainActivity.kt$MainActivity$onCustomValueSelected</ID>
66+
<ID>ParameterNaming:WidgetConfigureScreen.kt$onColorPressed</ID>
67+
<ID>ParameterNaming:WidgetConfigureScreen.kt$onSavePressed</ID>
68+
<ID>ParameterNaming:WidgetConfigureScreen.kt$onSliderChanged</ID>
9969
<ID>ReturnCount:MyCameraImpl.kt$MyCameraImpl$fun toggleSOS(): Boolean</ID>
10070
<ID>ReturnCount:MyCameraImpl.kt$MyCameraImpl$fun toggleStroboscope(): Boolean</ID>
10171
<ID>SwallowedException:Activity.kt$e: Exception</ID>

app/lint-baseline.xml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
errorLine2=" ~~~~">
3838
<location
3939
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
40-
line="20"
40+
line="21"
4141
column="23"/>
4242
</issue>
4343

@@ -85,14 +85,25 @@
8585
column="17"/>
8686
</issue>
8787

88+
<issue
89+
id="AndroidGradlePluginVersion"
90+
message="A newer version of com.android.application than 8.10.1 is available: 8.11.0"
91+
errorLine1="gradlePlugins-agp = &quot;8.10.1&quot;"
92+
errorLine2=" ~~~~~~~~">
93+
<location
94+
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
95+
line="18"
96+
column="21"/>
97+
</issue>
98+
8899
<issue
89100
id="GradleDependency"
90101
message="A newer version of androidx.lifecycle:lifecycle-runtime-compose than 2.9.0 is available: 2.9.1"
91102
errorLine1="androidx-lifecycle = &quot;2.9.0&quot;"
92103
errorLine2=" ~~~~~~~">
93104
<location
94105
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
95-
line="9"
106+
line="10"
96107
column="22"/>
97108
</issue>
98109

@@ -103,7 +114,7 @@
103114
errorLine2=" ~~~~~~~">
104115
<location
105116
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
106-
line="9"
117+
line="10"
107118
column="22"/>
108119
</issue>
109120

@@ -114,7 +125,7 @@
114125
errorLine2=" ~~~~~~~">
115126
<location
116127
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
117-
line="9"
128+
line="10"
118129
column="22"/>
119130
</issue>
120131

@@ -125,7 +136,7 @@
125136
errorLine2=" ~~~~~~~">
126137
<location
127138
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
128-
line="9"
139+
line="10"
129140
column="22"/>
130141
</issue>
131142

@@ -136,7 +147,7 @@
136147
errorLine2=" ~~~~~~~">
137148
<location
138149
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
139-
line="14"
150+
line="15"
140151
column="11"/>
141152
</issue>
142153

@@ -147,7 +158,7 @@
147158
errorLine2=" ~~~~~~~">
148159
<location
149160
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
150-
line="14"
161+
line="15"
151162
column="11"/>
152163
</issue>
153164

@@ -158,7 +169,7 @@
158169
errorLine2=" ~~~~~~~">
159170
<location
160171
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
161-
line="14"
172+
line="15"
162173
column="11"/>
163174
</issue>
164175

@@ -169,7 +180,7 @@
169180
errorLine2=" ~~~~~~~">
170181
<location
171182
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
172-
line="14"
183+
line="15"
173184
column="11"/>
174185
</issue>
175186

@@ -180,7 +191,7 @@
180191
errorLine2=" ~~~~~~~">
181192
<location
182193
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
183-
line="14"
194+
line="15"
184195
column="11"/>
185196
</issue>
186197

@@ -191,7 +202,7 @@
191202
errorLine2=" ~~~~~~~">
192203
<location
193204
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
194-
line="14"
205+
line="15"
195206
column="11"/>
196207
</issue>
197208

@@ -202,18 +213,18 @@
202213
errorLine2=" ~~~~~~~">
203214
<location
204215
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
205-
line="14"
216+
line="15"
206217
column="11"/>
207218
</issue>
208219

209220
<issue
210221
id="GradleDependency"
211-
message="A newer version of androidx.compose.material3:material3 than 1.4.0-alpha15 is available: 1.4.0-alpha16"
222+
message="A newer version of androidx.compose.material3:material3 than 1.4.0-alpha15 is available: 1.4.0-alpha17"
212223
errorLine1="composeMaterial3 = &quot;1.4.0-alpha15&quot;"
213224
errorLine2=" ~~~~~~~~~~~~~~~">
214225
<location
215226
file="$HOME/Projects/Fossify/FossifyOrg/Flashlight/gradle/libs.versions.toml"
216-
line="15"
227+
line="16"
217228
column="20"/>
218229
</issue>
219230

detekt.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
build:
2+
maxIssues: 0
3+
weights:
4+
complexity: 2
5+
LongParameterList: 2
6+
style: 1
7+
8+
processors:
9+
active: true
10+
exclude:
11+
- "FunctionCountProcessor"
12+
- "PropertyCountProcessor"
13+
14+
config:
15+
validation: true
16+
17+
complexity:
18+
LongParameterList:
19+
active: true
20+
functionThreshold: 10
21+
constructorThreshold: 8
22+
ignoreDefaultParameters: true
23+
ignoreAnnotated:
24+
- "Composable"
25+
LongMethod:
26+
active: true
27+
threshold: 120
28+
ignoreAnnotated:
29+
- "Composable"
30+
- "Preview"
31+
32+
style:
33+
MagicNumber:
34+
active: true
35+
ignoreAnnotated: ["Composable"]
36+
ignoreEnums: true
37+
ignoreNumbers: ["-1", "0", "1", "2", "42", "1000"]
38+
MaxLineLength:
39+
active: true
40+
maxLineLength: 120
41+
excludePackageStatements: true
42+
excludeImportStatements: true
43+
44+
naming:
45+
FunctionNaming:
46+
active: true
47+
ignoreAnnotated: ["Composable", "Preview"]
48+
functionPattern: "[a-z][A-Za-z0-9]*"
49+
50+
Compose: # io.nlopez.compose.rules
51+
ComposableParametersOrdering:
52+
active: true
53+
ModifierDefaultValue:
54+
active: true
55+
MissingModifierDefaultValue:
56+
active: true
57+
PublicComposablePreview:
58+
active: true

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
kotlin = "2.2.0"
44
#Detekt
55
detekt = "1.23.8"
6+
detektCompose = "0.4.22"
67
#AndroidX
78
androidx-customView = "1.2.0"
89
androidx-customViewPooling = "1.1.0"
@@ -43,6 +44,7 @@ compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
4344
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
4445
compose-uiTooling-debug = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
4546
compose-uiTooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
47+
compose-detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
4648
[bundles]
4749
compose = [
4850
"compose-activity",

lint.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@
3131
<issue id="IconDensities" severity="warning" />
3232
<issue id="GradleDependency" severity="warning" />
3333
<issue id="Overdraw" severity="warning" />
34+
<issue id="ExtraTranslation" severity="warning" />
3435
</lint>

0 commit comments

Comments
 (0)