Skip to content

Commit

Permalink
refactor: minor rule changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloNetrebchuk committed Nov 14, 2024
1 parent 8938457 commit 876cda2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Detekt

on:
workflow_dispatch:
pull_request: { }

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
CI_GRADLE_ARG_PROPERTIES: --stacktrace

jobs:
linting:
name: Run Detekt
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'

- name: Run Detekt
run: ./gradlew detektAll

- name: Upload report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: build/reports/detekt/detekt.sarif
12 changes: 3 additions & 9 deletions config/detekt.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
maxIssues: 100
maxIssues: 0
weights:
complexity: 2
LongParameterList: 1
Expand Down Expand Up @@ -43,19 +43,13 @@ style:
active: true
ignoreAnnotated:
- 'Preview'
ForbiddenComment:
active: false
SerialVersionUIDInSerializableClass:
active: false

complexity:
active: true
LongMethod:
active: true
ignoreAnnotated: [ 'Composable' ]
ignoreFunction: [ 'onCreateView' ]
LargeClass:
active: false
LongParameterList:
active: true
functionThreshold: 15
Expand All @@ -64,8 +58,8 @@ complexity:
ignoreAnnotated: [ 'Composable' ]
TooManyFunctions:
active: true
thresholdInClasses: 30
thresholdInInterfaces: 30
thresholdInClasses: 21
thresholdInInterfaces: 20
ignoreAnnotatedFunctions: [ 'Composable' ]
ignoreOverridden: true
ignorePrivate: true
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/org/openedx/core/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.google.gson.JsonParser
import org.openedx.core.domain.model.AgreementUrls
import java.io.InputStreamReader

@Suppress("TooManyFunctions")
class Config(context: Context) {

private var configProperties: JsonObject = try {
Expand Down
10 changes: 7 additions & 3 deletions core/src/main/java/org/openedx/core/domain/model/AppConfig.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package org.openedx.core.domain.model

import java.io.Serializable
import com.google.gson.annotations.SerializedName

data class AppConfig(
val courseDatesCalendarSync: CourseDatesCalendarSync = CourseDatesCalendarSync(),
) : Serializable
)

data class CourseDatesCalendarSync(
@SerializedName("is_enabled")
val isEnabled: Boolean = false,
@SerializedName("is_self_paced_enabled")
val isSelfPacedEnabled: Boolean = false,
@SerializedName("is_instructor_paced_enabled")
val isInstructorPacedEnabled: Boolean = false,
@SerializedName("is_deep_link_enabled")
val isDeepLinkEnabled: Boolean = false,
) : Serializable
)
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import org.openedx.foundation.presentation.UIMessage
import org.openedx.foundation.system.ResourceManager
import java.net.UnknownHostException

@Suppress("LargeClass")
@OptIn(ExperimentalCoroutinesApi::class)
class DiscussionCommentsViewModelTest {

Expand Down

0 comments on commit 876cda2

Please sign in to comment.