saveourtool/diktat

`WRONG_NEWLINES` false positives

Open

#1,495 opened on 2022年8月9日

GitHub で見る
 (0 comments) (0 reactions) (1 assignee)Kotlin (40 forks)github user discovery
buggood first issue

Repository metrics

Stars
 (571 stars)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド