-
22 number of properties
-
11 number of functions
-
1 number of classes
-
1 number of packages
-
1 number of kt files
-
489 lines of code (loc)
-
265 source lines of code (sloc)
-
201 logical lines of code (lloc)
-
169 comment lines of code (cloc)
-
35 cyclomatic complexity (mcc)
-
24 cognitive complexity
-
10 number of total code smells
-
63% comment source ratio
-
174 mcc per 1,000 lloc
-
49 code smells per 1,000 lloc
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.
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:145:76
This expression contains a magic number. Consider defining it to a well named constant.
142 * The time to live (TTL) value of a queued ad in milliseconds.
143 * This value is configurable via the [AppConfigStorage].
144 */
145 private var queuedAdTtlMs: Long = AppConfigStorage.queueAdTtlSeconds * 1000L
!!! ^ error
146
147 /**
148 * The maximum queue size.
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:170:13
This expression contains a magic number. Consider defining it to a well named constant.
167 */
168 private val delayFetchRateMs: Long
169 get() =
170 1000L *
!!! ^ error
171 max(
172 AppConfigStorage.fullscreenLoadTimeoutSeconds,
173 LoadRateLimiter().getLoadRateLimitSeconds(placement),
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:443:83
This expression contains a magic number. Consider defining it to a well named constant.
440 private fun handleAdFetchLoadResultNoAd(loadResult: ChartboostMediationFullscreenAdLoadResult) {
441 LogController.w(
442 "$LOG_PREFIX $placement failed to load ad. " +
443 "The next fetch request has been delayed for ${delayFetchRateMs / 1000} " +
!!! ^ error
444 "seconds to prevent unnecessary requests from being made.",
445 )
446 LogController.i(
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:468:83
This expression contains a magic number. Consider defining it to a well named constant.
465 fetchAdJob = null
466 LogController.w(
467 "$LOG_PREFIX $placement encountered an error during ad fetch. " +
468 "The next fetch request has been delayed for ${delayFetchRateMs / 1000} " +
!!! ^ error
469 "seconds to prevent unnecessary requests from being made.",
470 )
471 // Start another ad fetch job.
Line detected, which is longer than the defined maximum line length in the code style.
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:266:1
Line detected, which is longer than the defined maximum line length in the code style.
263 * Starts loading ads and append them to the queue automatically until capacity has been reached.
264 */
265 fun start() {
266 if (ChartboostMediationSdk.chartboostMediationInternal.initializationStatus != ChartboostMediationSdk.ChartboostMediationInitializationStatus.INITIALIZED) {
!!! ^ error
267 LogController.d(
268 "$LOG_PREFIX $placement the Chartboost Mediation SDK has not initialized." +
269 " Cannot start the queue. Waiting until the Chartboost Mediation SDK has started before queuing.",
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:369:1
Line detected, which is longer than the defined maximum line length in the code style.
366 if (isDelayed) delay(delayFetchRateMs)
367
368 if (fullscreenAdsQueued.size >= queueCapacity) {
369 LogController.d("$LOG_PREFIX $placement already reached capacity. Waiting until the next queue job.")
!!! ^ error
370 fetchAdJob = null
371 return@launch
372 }
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:381:1
Line detected, which is longer than the defined maximum line length in the code style.
378 // Invalidate the ad
379 loadResult.ad?.invalidate()
380 LogController.w(
381 "$LOG_PREFIX $placement already has an active queue fetch job. Discarding previously loaded ad.",
!!! ^ error
382 )
383 return@launch
384 }
Restrict the number of return statements in methods.
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:343:17
Function startAdFetchJob has 3 return statements which exceeds the limit of 2.
340 *
341 * @param isDelayed [Boolean] Whether or not the next fetch job is delayed (optional & false as default).
342 */
343 private fun startAdFetchJob(isDelayed: Boolean = false) {
!!! ^ error
344 if (!isRunning) {
345 LogController.d("$LOG_PREFIX $placement is no longer running. Waiting for the queue to start running.")
346 return
Wildcard imports should be replaced with imports using fully qualified class names. Wildcard imports can lead to naming conflicts. A library update can introduce naming clashes with your classes which results in compilation errors.
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:12:1
com.chartboost.chartboostmediationsdk.domain.* is a wildcard import. Replace it with fully qualified imports.
9
10 import android.content.Context
11 import com.chartboost.chartboostmediationsdk.ChartboostMediationSdk
12 import com.chartboost.chartboostmediationsdk.domain.*
!! ^ error
13 import com.chartboost.chartboostmediationsdk.network.ChartboostMediationNetworking
14 import com.chartboost.chartboostmediationsdk.network.Endpoints
15 import com.chartboost.chartboostmediationsdk.utils.LogController
- /Users/cbx/actions-runner/_work/helium-android/helium-android/ChartboostMediation/src/main/java/com/chartboost/chartboostmediationsdk/ad/ChartboostMediationFullscreenAdQueue.kt:17:1
kotlinx.coroutines.* is a wildcard import. Replace it with fully qualified imports.
14 import com.chartboost.chartboostmediationsdk.network.Endpoints
15 import com.chartboost.chartboostmediationsdk.utils.LogController
16 import com.chartboost.core.ChartboostCore
17 import kotlinx.coroutines.*
!! ^ error
18 import kotlinx.coroutines.Dispatchers.IO
19 import kotlinx.coroutines.Dispatchers.Main
20 import kotlin.math.max
generated with detekt version 1.23.5 on 2024-05-08 22:03:54 UTC