Skip to content

Instantly share code, notes, and snippets.

@helium-service
Created February 7, 2025 00:01
Show Gist options
  • Save helium-service/54420f958f4f55c7f8b33345f5eeb99b to your computer and use it in GitHub Desktop.
Save helium-service/54420f958f4f55c7f8b33345f5eeb99b to your computer and use it in GitHub Desktop.
Detekt Report for PR #2028 Timestamp 1738886415

detekt

Metrics

  • 140 number of properties

  • 190 number of functions

  • 14 number of classes

  • 6 number of packages

  • 14 number of kt files

Complexity Report

  • 3,245 lines of code (loc)

  • 2,772 source lines of code (sloc)

  • 1,990 logical lines of code (lloc)

  • 114 comment lines of code (cloc)

  • 312 cyclomatic complexity (mcc)

  • 74 cognitive complexity

  • 44 number of total code smells

  • 4% comment source ratio

  • 156 mcc per 1,000 lloc

  • 22 code smells per 1,000 lloc

Findings (44)

complexity, LargeClass (1)

One class should have one responsibility. Large classes tend to handle many things at once. Split up large classes into smaller classes that are easier to understand.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/test/java/com/chartboost/sdk/internal/impression/CBImpressionTest.kt:55:7
Class CBImpressionTest is too large. Consider splitting it into smaller pieces.
52 import java.net.URL
53 
54 @ExperimentalCoroutinesApi
55 class CBImpressionTest : BehaviorSpec({
!!       ^ error
56 
57     isolationMode = IsolationMode.InstancePerTest
58 

complexity, LongParameterList (10)

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/AdUnitManager/render/AdUnitRenderer.kt:46:30
The constructor(adType: AdType, reachability: CBReachability, fileCache: FileCache, videoRepository: VideoRepository, impressionBuilder: ImpressionBuilder, adUnitRendererShowRequest: AdUnitRendererShowRequest, openMeasurementController: OpenMeasurementController, viewProtocolBuilder: ImpressionViewProtocolBuilder, rendererActivityBridge: RendererActivityBridge, nativeBridgeCommand: NativeBridgeCommand, templateLoader: TemplateLoader, mediation: Mediation?, uiScope: CoroutineScope, eventTracker: EventTrackerExtensions, endpointRepository: EndpointRepository) has too many parameters. The current threshold is set to 7.
43 const val IMPRESSION_WITHOUT_VIDEO_STATE = -1
44 
45 // TODO Refactor this class
46 internal class AdUnitRenderer(
!!                              ^ error
47     private val adType: AdType,
48     private val reachability: CBReachability,
49     private val fileCache: FileCache,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/CommonWebViewBase.kt:20:38
The constructor(context: Context, html: String, callback: CustomWebViewInterface, impressionInterface: ImpressionInterface, baseExternalPathURL: String?, eventTracker: EventTracker, cbWebViewFactory: (Context) -> CBWebView, cbWebChromeClientFactory: (View) -> WebChromeClient, cbWebViewClientFactory: (CustomWebViewInterface, EventTracker) -> CustomWebViewClient) has too many parameters. The current threshold is set to 7.
17 import com.chartboost.sdk.tracking.EventTracker
18 
19 @SuppressLint("ViewConstructor")
20 internal open class CommonWebViewBase(
!!                                      ^ error
21     context: Context,
22     html: String,
23     callback: CustomWebViewInterface,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/HtmlWebViewBase.kt:26:31
The constructor(context: Context, baseUrl: String, html: String, infoIcon: InfoIcon, eventTracker: EventTracker, callback: CustomWebViewInterface, impressionInterface: ImpressionInterface, dispatcher: CoroutineDispatcher, cbWebViewFactory: (Context) -> CBWebView, cbImageDownloader: CBImageDownloader) has too many parameters. The current threshold is set to 7.
23 import kotlin.math.roundToInt
24 
25 @SuppressLint("ViewConstructor")
26 internal class HtmlWebViewBase(
!!                               ^ error
27     context: Context,
28     baseUrl: String,
29     html: String,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/CBMraidWebViewProtocol.kt:19:38
The constructor(context: Context, location: String, mtype: MediaTypeOM, adUnitParameters: String, fileCache: FileCache, networkRequestService: CBNetworkService?, uiPoster: UiPoster, templateProxy: CBTemplateProxy?, mediation: Mediation?, templateHtml: String?, openMeasurementImpressionCallback: OpenMeasurementImpressionCallback, adUnitRendererCallback: AdUnitRendererImpressionCallback, impressionInterface: ImpressionInterface, webViewTimeoutInterface: WebViewTimeoutInterface, nativeBridgeCommand: NativeBridgeCommand, eventTracker: EventTrackerExtensions) has too many parameters. The current threshold is set to 7.
16 import com.chartboost.sdk.tracking.EventTrackerExtensions
17 import com.chartboost.sdk.tracking.TrackingEvent
18 
19 internal class CBMraidWebViewProtocol(
!!                                      ^ error
20     context: Context,
21     location: String,
22     mtype: MediaTypeOM,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/MraidWebViewBase.kt:9:32
The constructor(context: Context, html: String, callback: CustomWebViewInterface, impressionInterface: ImpressionInterface, baseExternalPathURL: String?, nativeBridgeCommand: NativeBridgeCommand, eventTracker: EventTracker, cbWebViewFactory: (Context) -> CBWebView) has too many parameters. The current threshold is set to 7.
6  import com.chartboost.sdk.tracking.EventTracker
7  
8  @SuppressLint("ViewConstructor")
9  internal class MraidWebViewBase(
!                                 ^ error
10     context: Context,
11     html: String,
12     callback: CustomWebViewInterface,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/RichWebViewBase.kt:16:36
The constructor(context: Context, html: String, callback: CustomWebViewInterface, impressionInterface: ImpressionInterface, baseExternalPathURL: String?, nativeBridgeCommand: NativeBridgeCommand, webViewCorsErrorHandler: WebViewCorsErrorHandler, eventTracker: EventTracker, cbWebViewFactory: (Context) -> CBWebView) has too many parameters. The current threshold is set to 7.
13  */
14 
15 @SuppressLint("ViewConstructor")
16 internal open class RichWebViewBase(
!!                                    ^ error
17     context: Context,
18     html: String,
19     callback: CustomWebViewInterface,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/clickthrough/ImpressionClick.kt:15:31
The constructor(adUnit: AdUnit, urlResolver: UrlResolver, intentResolver: IntentResolver, clickRequest: ClickRequest, clickTracking: ClickTracking, mediaType: ImpressionMediaType, impressionCallback: ImpressionClickCallback, openMeasurementImpressionCallback: OpenMeasurementImpressionCallback, adUnitRendererImpressionCallback: AdUnitRendererImpressionCallback) has too many parameters. The current threshold is set to 7.
12 import com.chartboost.sdk.internal.measurement.OpenMeasurementImpressionCallback
13 import org.json.JSONObject
14 
15 internal class ImpressionClick(
!!                               ^ error
16     private val adUnit: AdUnit,
17     private val urlResolver: UrlResolver,
18     private val intentResolver: IntentResolver,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoBase.kt:16:25
The constructor(context: Context, html: String, callback: CustomWebViewInterface, impressionInterface: ImpressionInterface, nativeBridgeCommand: NativeBridgeCommand, baseExternalPathURL: String?, surface: SurfaceView?, videoBackground: FrameLayout, eventTracker: EventTracker, cbWebViewFactory: (Context) -> CBWebView) has too many parameters. The current threshold is set to 7.
13 import com.chartboost.sdk.tracking.EventTracker
14 
15 @SuppressLint("ViewConstructor")
16 internal class VideoBase(
!!                         ^ error
17     context: Context,
18     html: String,
19     callback: CustomWebViewInterface,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:43:29
The constructor(context: Context, location: String, mtype: MediaTypeOM, adUnitParameters: String, uiPoster: UiPoster, fileCache: FileCache, templateProxy: CBTemplateProxy, videoRepository: VideoRepository, videoFilename: String, mediation: Mediation?, adsVideoPlayerFactory: AdsVideoPlayerFactory, networkService: CBNetworkService, templateHtml: String, openMeasurementImpressionCallback: OpenMeasurementImpressionCallback, adUnitRendererImpressionCallback: AdUnitRendererImpressionCallback, impressionInterface: ImpressionInterface, webViewTimeoutInterface: WebViewTimeoutInterface, nativeBridgeCommand: NativeBridgeCommand, eventTracker: EventTrackerExtensions, cbWebViewFactory: (Context) -> CBWebView) has too many parameters. The current threshold is set to 7.
40 /**
41  * VideoProtocol handles media player and local server operation
42  */
43 internal class VideoProtocol(
!!                             ^ error
44     context: Context,
45     location: String,
46     mtype: MediaTypeOM,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:359:21
The function instance(context: Context, location: String, mtype: MediaTypeOM, adUnitParameters: String, uiPoster: UiPoster, fileCache: FileCache, templateProxy: CBTemplateProxy, videoRepository: VideoRepository, videoFilename: String, mediation: Mediation?, adsVideoPlayerFactory: AdsVideoPlayerFactory, networkService: CBNetworkService, templateHtml: String, openMeasurementImpressionCallback: OpenMeasurementImpressionCallback, adUnitRendererImpressionCallback: AdUnitRendererImpressionCallback, impressionInterface: ImpressionInterface, webViewTimeoutInterface: WebViewTimeoutInterface, nativeBridgeCommand: NativeBridgeCommand, eventTracker: EventTrackerExtensions) has too many parameters. The current threshold is set to 6.
356 
357     companion object {
358         @JvmStatic
359         fun instance(
!!!                     ^ error
360             context: Context,
361             location: String,
362             mtype: MediaTypeOM,

complexity, TooManyFunctions (4)

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/AdUnitManager/render/AdUnitRenderer.kt:46:16
Class 'AdUnitRenderer' with '78' functions detected. Defined threshold inside classes is set to '11'
43 const val IMPRESSION_WITHOUT_VIDEO_STATE = -1
44 
45 // TODO Refactor this class
46 internal class AdUnitRenderer(
!!                ^ error
47     private val adType: AdType,
48     private val reachability: CBReachability,
49     private val fileCache: FileCache,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/clickthrough/ImpressionClick.kt:15:16
Class 'ImpressionClick' with '13' functions detected. Defined threshold inside classes is set to '11'
12 import com.chartboost.sdk.internal.measurement.OpenMeasurementImpressionCallback
13 import org.json.JSONObject
14 
15 internal class ImpressionClick(
!!                ^ error
16     private val adUnit: AdUnit,
17     private val urlResolver: UrlResolver,
18     private val intentResolver: IntentResolver,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/impression/CBImpression.kt:16:16
Class 'CBImpression' with '46' functions detected. Defined threshold inside classes is set to '11'
13 import com.chartboost.sdk.legacy.VastVideoEvent
14 import com.iab.omid.library.chartboost.adsession.VerificationScriptResource
15 
16 internal class CBImpression(
!!                ^ error
17     private val impressionDependency: ImpressionDependency,
18     impressionClick: ImpressionClickable,
19     impressionDismiss: ImpressionDismissable,
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:43:16
Class 'VideoProtocol' with '27' functions detected. Defined threshold inside classes is set to '11'
40 /**
41  * VideoProtocol handles media player and local server operation
42  */
43 internal class VideoProtocol(
!!                ^ error
44     context: Context,
45     location: String,
46     mtype: MediaTypeOM,

empty-blocks, EmptyFunctionBlock (1)

Empty block of code detected. As they serve no purpose they should be removed.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/CBMraidWebViewProtocol.kt:75:42
This empty block of code can be removed.
72         }
73     }
74 
75     override fun onConfigurationChange() {}
!!                                          ^ error
76 
77     // This shouldn't be necessary, but defaultOrientationProperties_Check fails to pass without it.
78     // The failure indicates that track() has not been implemented.

exceptions, TooGenericExceptionCaught (10)

The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/AdUnitManager/render/AdUnitRenderer.kt:94:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
91                 impression = null
92                 callback = null
93             }
94         } catch (e: Exception) {
!!                  ^ error
95             e("detachBannerImpression error", e)
96         }
97     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/CommonWebViewBase.kt:43:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
40 
41         try {
42             WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG_WEBVIEW)
43         } catch (e: RuntimeException) {
!!                  ^ error
44             Logger.w("Exception while enabling webview debugging", e)
45         }
46 
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/CBMraidWebViewProtocol.kt:69:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
66                 nativeBridgeCommand,
67                 eventTracker = eventTracker,
68             )
69         } catch (e: Exception) {
!!                  ^ error
70             onWebViewError("Can't instantiate MraidWebViewBase: $e")
71             null
72         }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/impression/CBImpression.kt:168:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
165     fun playVideo() {
166         try {
167             (impressionDependency.viewProtocol as VideoProtocol).playVideo()
168         } catch (e: Exception) {
!!!                  ^ error
169             Logger.e("Invalid play video command", e)
170         }
171     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/impression/CBImpression.kt:176:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
173     fun pauseVideo() {
174         try {
175             (impressionDependency.viewProtocol as VideoProtocol).pauseVideo()
176         } catch (e: Exception) {
!!!                  ^ error
177             Logger.e("Invalid pause video command", e)
178         }
179     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/impression/CBImpression.kt:184:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
181     fun closeVideo() {
182         try {
183             (impressionDependency.viewProtocol as VideoProtocol).closeVideo()
184         } catch (e: Exception) {
!!!                  ^ error
185             Logger.e("Invalid close video command", e)
186         }
187     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/impression/CBImpression.kt:197:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
194                 impressionDependency.viewProtocol.mute()
195                 impressionDependency.viewProtocol.sendWebViewVastOmEvent(VastVideoEvent.VOLUME_CHANGE)
196             }
197         } catch (e: Exception) {
!!!                  ^ error
198             Logger.e("Invalid mute video command", e)
199         }
200     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/impression/CBImpression.kt:210:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
207                 impressionDependency.viewProtocol.unmute()
208                 impressionDependency.viewProtocol.sendWebViewVastOmEvent(VastVideoEvent.VOLUME_CHANGE)
209             }
210         } catch (e: Exception) {
!!!                  ^ error
211             Logger.e("Invalid unmute video command", e)
212         }
213     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:97:18
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
94          val surface: SurfaceView
95          try {
96              surface = SurfaceView(context)
97          } catch (e: Exception) {
!!                   ^ error
98              onWebViewError("Can't instantiate SurfaceView: $e")
99              return null
100         }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:115:22
The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.
112                     eventTracker = eventTracker,
113                     cbWebViewFactory = cbWebViewFactory,
114                 )
115             } catch (e: Exception) {
!!!                      ^ error
116                 onWebViewError("Can't instantiate VideoBase: $e")
117                 null
118             }

naming, MatchingDeclarationName (1)

If a source file contains only a single non-private top-level class or object, the file name should reflect the case-sensitive name plus the .kt extension.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/clickthrough/ImpressionClicakble.kt:6:11
The file name 'ImpressionClicakble' does not match the name of the single top-level declaration 'ImpressionClickable'.
3  import com.chartboost.sdk.internal.Model.CBError
4  import com.chartboost.sdk.internal.Model.ImpressionState
5  
6  interface ImpressionClickable {
!            ^ error
7      var click: Boolean
8  
9      fun submitClickRequest(

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/AdUnitManager/render/AdUnitRenderer.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.AdUnitManager.render
! ^ error
2 
3 import android.content.Context
4 import com.chartboost.sdk.Mediation
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/CommonWebViewBase.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.annotation.SuppressLint
4 import android.content.Context
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/View/HtmlWebViewBase.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.annotation.SuppressLint
4 import android.content.Context
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/CBHtmlWebViewClient.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.WebView
! ^ error
2 
3 import android.os.Build
4 import android.webkit.WebResourceRequest
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/CBMraidWebViewProtocol.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.WebView
! ^ error
2 
3 import android.content.Context
4 import com.chartboost.sdk.Mediation
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/MraidWebViewBase.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.WebView
! ^ error
2 
3 import android.annotation.SuppressLint
4 import android.content.Context
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/RichWebViewBase.kt:1:1
Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)*
1 package com.chartboost.sdk.internal.WebView
! ^ error
2 
3 import android.annotation.SuppressLint
4 import android.content.Context

style, MagicNumber (5)

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/AdUnitManager/render/AdUnitRenderer.kt:85:31
This expression contains a magic number. Consider defining it to a well named constant.
82                 openMeasurementController.onImpressionDestroyWebview()
83                 it.getHostView()?.run {
84                     uiScope.launch {
85                         delay(1000)
!!                               ^ error
86                         removeAllViews()
87                         invalidate()
88                     }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:180:41
This expression contains a magic number. Consider defining it to a well named constant.
177         openMeasurementImpressionCallback.onImpressionNotifyStateChanged(PlayerState.FULLSCREEN)
178         if (videoPlayer?.wasMediaStartedForTheFirstTime() == false) {
179             openMeasurementImpressionCallback.onImpressionNotifyVideoStarted(
180                 protocolVideoDuration / 1000f,
!!!                                         ^ error
181                 videoPlayer?.volume() ?: 1f,
182             )
183         } else {
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:234:39
This expression contains a magic number. Consider defining it to a well named constant.
231     }
232 
233     override fun onVideoDisplayProgress(position: Long) {
234         val posInSeconds = position / 1000f
!!!                                       ^ error
235         val durationInSeconds = protocolVideoDuration / 1000f
236         if (SandboxBridgeSettings.isSandboxMode) {
237             i("onVideoDisplayProgress: $posInSeconds/$durationInSeconds")
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:235:57
This expression contains a magic number. Consider defining it to a well named constant.
232 
233     override fun onVideoDisplayProgress(position: Long) {
234         val posInSeconds = position / 1000f
235         val durationInSeconds = protocolVideoDuration / 1000f
!!!                                                         ^ error
236         if (SandboxBridgeSettings.isSandboxMode) {
237             i("onVideoDisplayProgress: $posInSeconds/$durationInSeconds")
238         }
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/video/VideoProtocol.kt:296:37
This expression contains a magic number. Consider defining it to a well named constant.
293         d("notifyTemplateVideoStarted() duration: $protocolVideoDuration")
294         templateProxy?.callOnVideoStartedJSFunction(
295             getWebView(),
296             protocolVideoDuration / 1000f,
!!!                                     ^ error
297             location,
298             adTypeTraitsName,
299         )

style, MaxLineLength (2)

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/test/java/com/chartboost/sdk/internal/video/VideoBaseTest.kt:47:1
Line detected, which is longer than the defined maximum line length in the code style.
44         every {
45             constructedWith<FrameLayout>(
46                 any(),
47             ) // Failed matching mocking signature for  left matchers: [any()] io.mockk.MockKException: Failed matching mocking signature for
!! ^ error
48             // anyConstructed<FrameLayout>() // Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock
49         } answers {
50             mockk<FrameLayout>(relaxed = true)
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/test/java/com/chartboost/sdk/internal/video/VideoBaseTest.kt:48:1
Line detected, which is longer than the defined maximum line length in the code style.
45             constructedWith<FrameLayout>(
46                 any(),
47             ) // Failed matching mocking signature for  left matchers: [any()] io.mockk.MockKException: Failed matching mocking signature for
48             // anyConstructed<FrameLayout>() // Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock
!! ^ error
49         } answers {
50             mockk<FrameLayout>(relaxed = true)
51         }

style, ReturnCount (3)

Restrict the number of return statements in methods.

Documentation

  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/AdUnitManager/render/AdUnitRenderer.kt:105:9
Function render has 3 return statements which exceeds the limit of 2.
102      * and impression itself which communicates with via callback.
103      * There is only one renderer per ad hence no need to worry about the callback
104      */
105     fun render(
!!!         ^ error
106         appRequest: AppRequest,
107         callback: AdUnitRendererAdCallback,
108     ) {
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/WebView/CBHtmlWebViewClient.kt:47:17
Function attemptToOpenUrl has 3 return statements which exceeds the limit of 2.
44         hasLoadFinished = true
45     }
46 
47     private fun attemptToOpenUrl(url: String): Boolean {
!!                 ^ error
48         if (!hasLoadFinished) {
49             Logger.e("Attempt to open $url detected before WebView loading finished.")
50             impressionInterface.onClickBeforeLoadFinished(CBUrl(url, false))
  • /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMonetization/src/main/java/com/chartboost/sdk/internal/clickthrough/ImpressionClick.kt:101:18
Function onClick has 3 return statements which exceeds the limit of 2.
98      /**
99       * This logic comes only from CLICK template event and combines the url from the AdGet
100      */
101     override fun onClick(
!!!                  ^ error
102         urlFromCreative: String,
103         shouldDismiss: Boolean?,
104         impressionState: ImpressionState,

generated with detekt version 1.23.5 on 2025-02-07 00:01:31 UTC

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