diktat
diktat copied to clipboard
`WRONG_NEWLINES` false positives
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