Skip to content

Commit 161a4fa

Browse files
refactor: minor rule changes
1 parent 8938457 commit 161a4fa

File tree

5 files changed

+48
-12
lines changed

5 files changed

+48
-12
lines changed

.github/workflows/detekt.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Detekt
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request: { }
6+
7+
env:
8+
GRADLE_OPTS: -Dorg.gradle.daemon=false
9+
CI_GRADLE_ARG_PROPERTIES: --stacktrace
10+
11+
jobs:
12+
linting:
13+
name: Run Detekt
14+
runs-on: ubuntu-latest
15+
permissions:
16+
security-events: write
17+
18+
steps:
19+
- name: Checkout Repo
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Java
23+
uses: actions/setup-java@v4
24+
with:
25+
distribution: 'temurin' # See 'Supported distributions' for available options
26+
java-version: '17'
27+
28+
- name: Run Detekt
29+
run: ./gradlew detektAll
30+
31+
- name: Upload report
32+
uses: github/codeql-action/upload-sarif@v3
33+
if: success() || failure()
34+
with:
35+
sarif_file: build/reports/detekt/detekt.sarif
36+
checkout_path: /home/runner/work/openedx-app-android/openedx-app-android

config/detekt.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build:
2-
maxIssues: 100
2+
maxIssues: 0
33
weights:
44
complexity: 2
55
LongParameterList: 1
@@ -43,19 +43,13 @@ style:
4343
active: true
4444
ignoreAnnotated:
4545
- 'Preview'
46-
ForbiddenComment:
47-
active: false
48-
SerialVersionUIDInSerializableClass:
49-
active: false
5046

5147
complexity:
5248
active: true
5349
LongMethod:
5450
active: true
5551
ignoreAnnotated: [ 'Composable' ]
5652
ignoreFunction: [ 'onCreateView' ]
57-
LargeClass:
58-
active: false
5953
LongParameterList:
6054
active: true
6155
functionThreshold: 15
@@ -64,8 +58,8 @@ complexity:
6458
ignoreAnnotated: [ 'Composable' ]
6559
TooManyFunctions:
6660
active: true
67-
thresholdInClasses: 30
68-
thresholdInInterfaces: 30
61+
thresholdInClasses: 21
62+
thresholdInInterfaces: 20
6963
ignoreAnnotatedFunctions: [ 'Composable' ]
7064
ignoreOverridden: true
7165
ignorePrivate: true

core/src/main/java/org/openedx/core/config/Config.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.google.gson.JsonParser
88
import org.openedx.core.domain.model.AgreementUrls
99
import java.io.InputStreamReader
1010

11+
@Suppress("TooManyFunctions")
1112
class Config(context: Context) {
1213

1314
private var configProperties: JsonObject = try {
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package org.openedx.core.domain.model
22

3-
import java.io.Serializable
3+
import com.google.gson.annotations.SerializedName
44

55
data class AppConfig(
66
val courseDatesCalendarSync: CourseDatesCalendarSync = CourseDatesCalendarSync(),
7-
) : Serializable
7+
)
88

99
data class CourseDatesCalendarSync(
10+
@SerializedName("is_enabled")
1011
val isEnabled: Boolean = false,
12+
@SerializedName("is_self_paced_enabled")
1113
val isSelfPacedEnabled: Boolean = false,
14+
@SerializedName("is_instructor_paced_enabled")
1215
val isInstructorPacedEnabled: Boolean = false,
16+
@SerializedName("is_deep_link_enabled")
1317
val isDeepLinkEnabled: Boolean = false,
14-
) : Serializable
18+
)

discussion/src/test/java/org/openedx/discussion/presentation/comments/DiscussionCommentsViewModelTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import org.openedx.foundation.presentation.UIMessage
4040
import org.openedx.foundation.system.ResourceManager
4141
import java.net.UnknownHostException
4242

43+
@Suppress("LargeClass")
4344
@OptIn(ExperimentalCoroutinesApi::class)
4445
class DiscussionCommentsViewModelTest {
4546

0 commit comments

Comments
 (0)