saveourtool/diktat

`WRONG_NEWLINES` false positives

Open

#1,495 创建于 2022年8月9日

在 GitHub 查看
 (0 评论) (0 反应) (1 负责人)Kotlin (40 fork)github user discovery
buggood first issue

仓库指标

Star
 (571 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南