зеркало из https://github.com/mozilla/glean.git
Fix detekt lints
This commit is contained in:
Родитель
1132938825
Коммит
aa2d2dea10
.detekt.ymlbuild.gradle
glean-core/android/src
main/java/mozilla/telemetry/glean
Glean.kt
private
CustomDistributionMetricType.ktEventMetricType.ktMemoryDistributionMetricType.ktTimingDistributionMetricType.kt
testing
test/java/mozilla/telemetry/glean/private
|
@ -2,6 +2,13 @@ style:
|
|||
# We want to allow "TODO" in comments
|
||||
ForbiddenComment:
|
||||
active: false
|
||||
# Allow for generated code
|
||||
WildcardImport:
|
||||
excludeImports:
|
||||
- mozilla.telemetry.glean.internal.*
|
||||
# Multiple returns are ok
|
||||
ReturnCount:
|
||||
active: false
|
||||
build:
|
||||
maxIssues: 0
|
||||
|
||||
|
|
|
@ -182,8 +182,11 @@ detekt {
|
|||
}
|
||||
}
|
||||
|
||||
tasks.withType(io.gitlab.arturbosch.detekt.Detekt) {
|
||||
exclude(".*test.*,.*/resources/.*,.*/tmp/.*,.*/build/.*")
|
||||
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach {
|
||||
exclude("**/test/**")
|
||||
exclude("**/resources/**")
|
||||
exclude("**/tmp/**")
|
||||
exclude("**/build/**")
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
|
|
@ -92,15 +92,6 @@ open class GleanInternalAPI internal constructor() {
|
|||
|
||||
private lateinit var gleanDataDir: File
|
||||
|
||||
// Keep track of this value before Glean is initialized
|
||||
private var debugViewTag: String? = null
|
||||
|
||||
// Keep track of this value before Glean is initialized
|
||||
private var logPings: Boolean = false
|
||||
|
||||
// Keep track of source tags if set before Glean is initialized.
|
||||
private var sourceTags: Set<String>? = null
|
||||
|
||||
// Are we in testing mode?
|
||||
internal var testingMode: Boolean = false
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ class CustomDistributionMetricType(
|
|||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
@JvmOverloads
|
||||
fun testGetNumRecordedErrors(error: ErrorType, pingName: String? = null) = inner.testGetNumRecordedErrors(error, pingName)
|
||||
fun testGetNumRecordedErrors(error: ErrorType, pingName: String? = null) =
|
||||
inner.testGetNumRecordedErrors(error, pingName)
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
@JvmOverloads
|
||||
|
|
|
@ -73,7 +73,8 @@ class EventMetricType<ExtraKeysEnum, ExtraObject> internal constructor(
|
|||
/**
|
||||
* The public constructor used by automatically generated metrics.
|
||||
*/
|
||||
constructor(meta: CommonMetricData, allowedExtraKeys: List<String>) : this(inner = EventMetric(meta, allowedExtraKeys))
|
||||
constructor(meta: CommonMetricData, allowedExtraKeys: List<String>) :
|
||||
this(inner = EventMetric(meta, allowedExtraKeys))
|
||||
|
||||
/**
|
||||
* Record an event by using the information provided by the instance of this class.
|
||||
|
|
|
@ -35,7 +35,8 @@ class MemoryDistributionMetricType(meta: CommonMetricData, memoryUnit: MemoryUni
|
|||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
@JvmOverloads
|
||||
fun testGetNumRecordedErrors(error: ErrorType, pingName: String? = null) = inner.testGetNumRecordedErrors(error, pingName)
|
||||
fun testGetNumRecordedErrors(error: ErrorType, pingName: String? = null) =
|
||||
inner.testGetNumRecordedErrors(error, pingName)
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
@JvmOverloads
|
||||
|
|
|
@ -61,7 +61,8 @@ class TimingDistributionMetricType(meta: CommonMetricData, timeUnit: TimeUnit) :
|
|||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
@JvmOverloads
|
||||
fun testGetNumRecordedErrors(error: ErrorType, pingName: String? = null) = inner.testGetNumRecordedErrors(error, pingName)
|
||||
fun testGetNumRecordedErrors(error: ErrorType, pingName: String? = null) =
|
||||
inner.testGetNumRecordedErrors(error, pingName)
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
@JvmOverloads
|
||||
|
|
|
@ -58,6 +58,7 @@ class GleanTestRule(
|
|||
// Set the current system time to a known datetime.
|
||||
val fakeNow = Calendar.getInstance()
|
||||
fakeNow.clear()
|
||||
@Suppress("MagicNumber") // it's a fixed date only used in tests.
|
||||
fakeNow.set(2015, 6, 11, 2, 0, 0)
|
||||
SystemClock.setCurrentTimeMillis(fakeNow.timeInMillis)
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
package mozilla.telemetry.glean.private
|
||||
|
||||
import android.content.Context
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import mozilla.telemetry.glean.Glean
|
||||
|
@ -20,9 +19,6 @@ import org.junit.runner.RunWith
|
|||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class LabeledMetricTypeTest {
|
||||
private val context: Context
|
||||
get() = ApplicationProvider.getApplicationContext()
|
||||
|
||||
@get:Rule
|
||||
val gleanRule = GleanTestRule(ApplicationProvider.getApplicationContext())
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче