saveourtool/diktat

`WRONG_NEWLINES` false positives

Open

#1495 aperta il 9 ago 2022

Vedi su GitHub
 (0 commenti) (0 reazioni) (1 assegnatario)Kotlin (40 fork)github user discovery
buggood first issue

Metriche repository

Star
 (571 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Examples:

        private fun IndentedSourceCode.customConfig(): SortedMap<String, out Boolean> =
            mapOf(
                EXTENDED_INDENT_AFTER_OPERATORS to extendedIndentAfterOperators,
                EXTENDED_INDENT_BEFORE_DOT to extendedIndentBeforeDot,
                EXTENDED_INDENT_FOR_EXPRESSION_BODIES to extendedIndentForExpressionBodies,
                EXTENDED_INDENT_OF_PARAMETERS to extendedIndentOfParameters,
            ).mapValues { (_, value) ->
                value.valueOrNull
            }.filterValues { value ->
                value != null
            }.mapValues { (_, value) ->
                value!!
            }.toSortedMap()
                val columnNumbers = decimalNumber
                    .findAll(detail)
                    .map { match ->
                        match.groups[1]?.value
                    }.filterNotNull()
                    .map(String::toInt)
                    .toList()
                    .takeLast(2)
        val joinedPaths = keys
            .asSequence()
            .map { path ->
                path.tryToDeleteOnExit()
            }.map { path ->
                path.relativizeSafely()
            }.map(Any::toString)
            .joinToString()
        private val warningNames = WarningNames::class
            .declaredMemberProperties
            .asSequence()
            .map { property ->
                property.name
            }.toSet()
        val filteredCode = code
            .trimIndent()
            .lineSequence()
            .mapIndexed { index, line ->
                extractExpectedError(index, line, codeAnnotationRegex)
            }.map { (line, expectedError) ->
                if (expectedError != null) {
                    expectedErrors += expectedError
                }

                line
            }.joinToString(separator = NEWLINE.toString())
        val supportedTags = context
            .tags
            .asSequence()
            .filter { tag ->
                tag in warningNames
            }.toList()

Environment information

  • diktat version: 1.2.3

Guida contributor