Skip to content

Commit

Permalink
detekt: Only configure the differences to the default configuration
Browse files Browse the repository at this point in the history
Remove settings that are part of the default configurations, and
override default settings that would otherwise cause issues to be
reported that were not reported before.

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch-si.com>
  • Loading branch information
sschuberth committed Aug 9, 2019
1 parent eb2b13b commit 97bbecc
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 18 deletions.
49 changes: 31 additions & 18 deletions .detekt.yml
@@ -1,21 +1,34 @@
# Configuration of Detekt rule sets, see: https://github.com/arturbosch/detekt#rulesets
# Configuration of detekt rule sets, see https://arturbosch.github.io/detekt/comments.html.
# This file only lists the differences to the default configuration at
# https://github.com/arturbosch/detekt/blob/master/detekt-cli/src/main/resources/default-detekt-config.yml.

build:
maxIssues: 0
weights:
comments: 0

comments:
CommentOverPrivateMethod:
active: false
CommentOverPrivateProperty:
active: false

complexity:
LargeClass:
threshold: 150
ComplexMethod:
threshold: 33
LongMethod:
threshold: 158
LongParameterList:
threshold: 8
NestedBlockDepth:
threshold: 4
threshold: 10
TooManyFunctions:
thresholdInClasses: 19
thresholdInObjects: 14

# Formatting rules are implemented via the ktlint plugin. As ktlint does not allow exceptions, we need to disable
# respective rules completely.
formatting:
ChainWrapping:
active: false
NoItParamInMultilineLambda:
active: false
NoWildcardImports:
active: false
ParameterListWrapping:
active: false

performance:
SpreadOperator:
Expand All @@ -24,17 +37,17 @@ performance:
style:
ForbiddenComment:
active: false
MaxLineLength:
active: true
maxLineLength: 120
NewLineAtEndOfFile:
active: true
MagicNumber:
active: false
ReturnCount:
active: false
SpacingBetweenPackageAndImports:
active: true
ThrowsCount:
max: 5
UnusedImports:
active: true
WildcardImport:
active: true
excludeImports: '
ch.frankel.slf4k.*,
com.here.ort.analyzer.managers.*,
Expand Down
2 changes: 2 additions & 0 deletions analyzer/src/main/kotlin/MavenSupport.kt
Expand Up @@ -401,6 +401,8 @@ class MavenSupport(workspaceReader: WorkspaceReader) {
val tempFile = File.createTempFile("ort", "checksum-${checksum.algorithm}")

val transporter = transporterProvider.newTransporter(repositorySystemSession, repository)

@Suppress("TooGenericExceptionCaught")
val actualChecksum = try {
transporter.get(GetTask(checksum.location).setDataFile(tempFile))

Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Expand Up @@ -145,7 +145,10 @@ subprojects {
// Align the detekt core and plugin versions.
toolVersion = detektPluginVersion

// Only configure differences to the default.
buildUponDefaultConfig = true
config = files("../.detekt.yml")

input = files("src/main/kotlin", "src/test/kotlin", "src/funTest/kotlin")
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/main/kotlin/commands/ReporterCommand.kt
Expand Up @@ -154,6 +154,7 @@ object ReporterCommand : CommandWithHelp() {
absoluteOutputDir.safeMkdirs()

reports.forEach { (reporter, file) ->
@Suppress("TooGenericExceptionCaught")
try {
reporter.generateReport(
ortResult,
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/kotlin/commands/RequirementsCommand.kt
Expand Up @@ -52,6 +52,7 @@ object RequirementsCommand : CommandWithHelp() {
classes.filterNot {
Modifier.isAbstract(it.modifiers) || it.isAnonymousClass || it.isLocalClass
}.sortedBy { it.simpleName }.forEach {
@Suppress("TooGenericExceptionCaught")
try {
val kotlinObject = it.kotlin.objectInstance

Expand Down
1 change: 1 addition & 0 deletions model/src/main/kotlin/OrtResult.kt
Expand Up @@ -36,6 +36,7 @@ import java.util.SortedSet
* The common output format for the analyzer and scanner. It contains information about the scanned repository, and the
* analyzer and scanner will add their result to it.
*/
@Suppress("TooManyFunctions")
data class OrtResult(
/**
* Information about the repository that was used as input.
Expand Down
1 change: 1 addition & 0 deletions model/src/main/kotlin/PackageReference.kt
Expand Up @@ -25,6 +25,7 @@ import java.util.SortedSet

// A custom value filter for [PackageLinkage] to work around
// https://github.com/FasterXML/jackson-module-kotlin/issues/193.
@Suppress("EqualsWithHashCodeExist")
class PackageLinkageValueFilter {
override fun equals(other: Any?) = other == PackageLinkage.DYNAMIC
}
Expand Down
1 change: 1 addition & 0 deletions reporter/src/main/kotlin/reporters/StaticHtmlReporter.kt
Expand Up @@ -45,6 +45,7 @@ import javax.xml.parsers.DocumentBuilderFactory
import kotlinx.html.*
import kotlinx.html.dom.*

@Suppress("LargeClass")
class StaticHtmlReporter : Reporter() {
private val css = javaClass.getResource("/static-html-reporter.css").readText()

Expand Down
1 change: 1 addition & 0 deletions scanner/src/test/kotlin/ScanCodeTest.kt
Expand Up @@ -35,6 +35,7 @@ import io.kotlintest.specs.WordSpec
import java.io.File
import java.time.Instant

@Suppress("LargeClass")
class ScanCodeTest : WordSpec({
val scanner = ScanCode("ScanCode", ScannerConfiguration())

Expand Down
1 change: 1 addition & 0 deletions spdx-utils/build.gradle.kts
Expand Up @@ -153,6 +153,7 @@ fun generateEnumClass(
* An enum containing all SPDX $description IDs. This class is generated by the Gradle task
* '$taskName'.
*/
@Suppress("EnumNaming")
enum class $className(
/**
* The id of the $description.
Expand Down
1 change: 1 addition & 0 deletions spdx-utils/src/main/kotlin/SpdxLicense.kt
Expand Up @@ -23,6 +23,7 @@ package com.here.ort.spdx
* An enum containing all SPDX license IDs. This class is generated by the Gradle task
* 'generateSpdxLicenseEnum'.
*/
@Suppress("EnumNaming")
enum class SpdxLicense(
/**
* The id of the license.
Expand Down
1 change: 1 addition & 0 deletions spdx-utils/src/main/kotlin/SpdxLicenseException.kt
Expand Up @@ -23,6 +23,7 @@ package com.here.ort.spdx
* An enum containing all SPDX license exception IDs. This class is generated by the Gradle task
* 'generateSpdxLicenseExceptionEnum'.
*/
@Suppress("EnumNaming")
enum class SpdxLicenseException(
/**
* The id of the license exception.
Expand Down
2 changes: 2 additions & 0 deletions utils/src/main/kotlin/Extensions.kt
Expand Up @@ -17,6 +17,8 @@
* License-Filename: LICENSE
*/

@file:Suppress("TooManyFunctions")

package com.here.ort.utils

import com.fasterxml.jackson.databind.JsonNode
Expand Down

0 comments on commit 97bbecc

Please sign in to comment.