Skip to content

Instantly share code, notes, and snippets.

@helium-service
Created May 12, 2025 16:24
Show Gist options
  • Save helium-service/05082e1c5a325b6a14c8ea2ee19a5f14 to your computer and use it in GitHub Desktop.
Save helium-service/05082e1c5a325b6a14c8ea2ee19a5f14 to your computer and use it in GitHub Desktop.
Detekt Report for PR #2139 Timestamp 1747066986

detekt

Metrics

  • 96 number of properties

  • 72 number of functions

  • 14 number of classes

  • 1 number of packages

  • 7 number of kt files

Complexity Report

  • 1,836 lines of code (loc)

  • 1,283 source lines of code (sloc)

  • 995 logical lines of code (lloc)

  • 294 comment lines of code (cloc)

  • 148 cyclomatic complexity (mcc)

  • 59 cognitive complexity

  • 23 number of total code smells

  • 22% comment source ratio

  • 148 mcc per 1,000 lloc

  • 23 code smells per 1,000 lloc

Findings (23)

complexity, LongMethod (4)

One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:100:21
The function setupConstraints is too long (73). The maximum length is 60.
97          /**
98           * Sets up the constraints for all child views
99           */
100         private fun setupConstraints() {
!!!                     ^ error
101             // Set IDs for all views (required for ConstraintLayout)
102             infoIconView.id = View.generateViewId()
103             volumeIconView.id = View.generateViewId()
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:272:13
The function configureInfoButton is too long (82). The maximum length is 60.
269         /**
270          * Configures the info button with the provided properties
271          */
272         fun configureInfoButton(
!!!             ^ error
273             visible: Boolean,
274             position: Position,
275             margin: DoubleSize,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:385:13
The function configureActionButton is too long (90). The maximum length is 60.
382         /**
383          * Configures the action button (close/skip/timer) with the provided properties
384          */
385         fun configureActionButton(
!!!             ^ error
386             visible: Boolean,
387             position: Position,
388             margin: DoubleSize,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/NativePersistentCtaView.kt:142:21
The function adjustLayoutConstraints is too long (66). The maximum length is 60.
139          * Adjusts the layout constraints based on the visibility of the icon and title.
140          * If both are gone, the button will fill the width of the parent.
141          */
142         private fun adjustLayoutConstraints() {
!!!                     ^ error
143             val constraintSet = ConstraintSet()
144             constraintSet.clone(this@NativePersistentCtaView)
145 

complexity, LongParameterList (2)

The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:272:32
The function configureInfoButton(visible: Boolean, position: Position, margin: DoubleSize, padding: DoubleSize, size: DoubleSize, imageUrl: String, clickthroughUrl: String) has too many parameters. The current threshold is set to 6.
269         /**
270          * Configures the info button with the provided properties
271          */
272         fun configureInfoButton(
!!!                                ^ error
273             visible: Boolean,
274             position: Position,
275             margin: DoubleSize,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/NativePersistentCtaView.kt:33:16
The constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, persistentCtaContentDescription: String, openButtonContentDescription: String, dispatcher: CoroutineDispatcher, cbImageDownloader: CBImageDownloader, onCtaClicked: (() -> Unit)?) has too many parameters. The current threshold is set to 7.
30  */
31 class NativePersistentCtaView
32     @JvmOverloads
33     constructor(
!!                ^ error
34         context: Context,
35         attrs: AttributeSet? = null,
36         defStyleAttr: Int = 0,

complexity, TooManyFunctions (1)

Too many functions inside a/an file/class/object/interface always indicate a violation of the single responsibility principle. Maybe the file/class/object/interface wants to manage too many things at once. Extract functionality which clearly belongs together.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:15:7
Class 'AdViewOverlay' with '23' functions detected. Defined threshold inside classes is set to '11'
12 import com.chartboost.sdk.internal.viewability.ViewabilityObstruction
13 import com.chartboost.sdk.internal.viewability.ViewabilityTracker
14 
15 class AdViewOverlay
!!       ^ error
16     @JvmOverloads
17     constructor(
18         context: Context,

naming, PackageNaming (7)

Package names should match the naming convention set in the configuration.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import android.view.View
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/BasePersistentCtaView.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import android.util.AttributeSet
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/NativePersistentCtaView.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import android.graphics.Color
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/PersistentCtaFactory.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import com.chartboost.sdk.internal.renderables.CtaConfig
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/WebViewPersistentCtaView.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import android.util.AttributeSet
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/test/java/com/chartboost/sdk/internal/View/NativePersistentCtaViewTest.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import android.graphics.Color
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/test/java/com/chartboost/sdk/internal/View/WebViewPersistentCtaViewTest.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.View
! ^ error
2 
3 import android.content.Context
4 import android.os.Build

style, MagicNumber (2)

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:37:45
This expression contains a magic number. Consider defining it to a well named constant.
34         private var isRewardedMode: Boolean = false
35 
36         // Timer configuration
37         private var timerDurationMs: Long = 30_000 // Default to 30 seconds
!!                                             ^ error
38         private var currentTimerMode: TimerChipViewMode = TimerChipViewMode.ARC
39 
40         init {
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:135:18
This expression contains a magic number. Consider defining it to a well named constant.
132                 ConstraintSet.START,
133                 infoIconView.id,
134                 ConstraintSet.END,
135                 (8 * resources.displayMetrics.density).toInt(),
!!!                  ^ error
136             )
137             constraintSet.connect(
138                 volumeIconView.id,

style, MaxLineLength (3)

Line detected, which is longer than the defined maximum line length in the code style.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/NativePersistentCtaView.kt:175:1
Line detected, which is longer than the defined maximum line length in the code style.
172                 constraintSet.clear(titleText.id, ConstraintSet.END)
173 
174                 val startId = if (iconView.visibility == View.VISIBLE) iconView.id else ConstraintSet.PARENT_ID
175                 constraintSet.connect(titleText.id, ConstraintSet.START, startId, ConstraintSet.END, dpToPx(TITLE_MARGIN_DP))
!!! ^ error
176                 constraintSet.connect(titleText.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)
177                 constraintSet.connect(titleText.id, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM)
178             }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/NativePersistentCtaView.kt:183:1
Line detected, which is longer than the defined maximum line length in the code style.
180             // Button constraints based on visibility
181             when {
182                 iconView.visibility == View.VISIBLE && titleText.visibility == View.VISIBLE -> {
183                     constraintSet.connect(openButton.id, ConstraintSet.START, titleText.id, ConstraintSet.END, dpToPx(TITLE_MARGIN_DP))
!!! ^ error
184                     constraintSet.connect(openButton.id, ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END)
185                     // Ensure width is set through the constraint set
186                     constraintSet.constrainWidth(openButton.id, LayoutParams.WRAP_CONTENT)
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/NativePersistentCtaView.kt:197:1
Line detected, which is longer than the defined maximum line length in the code style.
194                         ConstraintSet.START,
195                         dpToPx(TITLE_MARGIN_DP),
196                     )
197                     constraintSet.connect(openButton.id, ConstraintSet.START, titleText.id, ConstraintSet.END, dpToPx(TITLE_MARGIN_DP))
!!! ^ error
198                     constraintSet.connect(openButton.id, ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END)
199                     // Ensure width is set through the constraint set
200                     constraintSet.constrainWidth(openButton.id, LayoutParams.WRAP_CONTENT)

style, UnusedParameter (4)

Function parameter is unused and should be removed.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:276:13
Function parameter `padding` is unused.
273             visible: Boolean,
274             position: Position,
275             margin: DoubleSize,
276             padding: DoubleSize,
!!!             ^ error
277             size: DoubleSize,
278             imageUrl: String,
279             clickthroughUrl: String,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:277:13
Function parameter `size` is unused.
274             position: Position,
275             margin: DoubleSize,
276             padding: DoubleSize,
277             size: DoubleSize,
!!!             ^ error
278             imageUrl: String,
279             clickthroughUrl: String,
280         ) {
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:389:13
Function parameter `padding` is unused.
386             visible: Boolean,
387             position: Position,
388             margin: DoubleSize,
389             padding: DoubleSize,
!!!             ^ error
390             size: DoubleSize,
391         ) {
392             // Update visibility based on current mode
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/AdViewOverlay.kt:390:13
Function parameter `size` is unused.
387             position: Position,
388             margin: DoubleSize,
389             padding: DoubleSize,
390             size: DoubleSize,
!!!             ^ error
391         ) {
392             // Update visibility based on current mode
393             if (visible) {

generated with detekt version 1.23.5 on 2025-05-12 16:24:18 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment