Skip to content

Commit

Permalink
Copyright as code
Browse files Browse the repository at this point in the history
### What's done:
   Fixed after review
  • Loading branch information
kentr0w committed Feb 2, 2021
1 parent 1ed3f84 commit ce74f67
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class CommentsRule(private val configRules: List<RulesConfig>) : Rule("comments"
private val functionRegex = """^(public|private|protected)*\s*(override|abstract|actual|expect)*\s?fun\s+\w+(\(.*\))?(\s*:\s*\w+)?\s*[{=]${'$'}""".toRegex()
private val rightBraceRegex = """^\s*}$""".toRegex()
private val requirePartOfCode = """val |var |=|(\{((.|\n)*)\})""".toRegex()
private val codeFileStartCases = listOf(classRegex, importOrPackageRegex, functionRegex, rightBraceRegex, requirePartOfCode)
private val codeFileStartCases = listOf(classRegex, importOrPackageRegex, functionRegex, rightBraceRegex)
private val eolCommentStart = """// \S""".toRegex()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CompactInitialization(private val configRules: List<RulesConfig>) : Rule("
* Check property's initializer: if it is a method call, we find all consecutive statements that are this property's
* fields accessors and wrap them in an `apply` function.
*/
@Suppress("UnsafeCallOnNullableType", "COMMENTED_OUT_CODE")
@Suppress("UnsafeCallOnNullableType")
private fun handleProperty(property: KtProperty) {
property.run {
val propertyName = name
Expand Down Expand Up @@ -81,7 +81,7 @@ class CompactInitialization(private val configRules: List<RulesConfig>) : Rule("
}
}

@Suppress("UnsafeCallOnNullableType", "NestedBlockDepth", "COMMENTED_OUT_CODE")
@Suppress("UnsafeCallOnNullableType", "NestedBlockDepth")
private fun moveAssignmentIntoApply(property: KtProperty, assignment: KtBinaryExpression) {
// get apply expression or create empty; convert `apply(::foo)` to `apply { foo(this) }` if necessary
getOrCreateApplyBlock(property).let(::convertValueParametersToLambdaArgument)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ class CommentedCodeTest : LintTestBase(::CommentsRule) {
*/
""".trimMargin(),
LintError(7, 13, ruleId, "${COMMENTED_OUT_CODE.warnText()} ", false),
LintError(10, 13, ruleId, "${COMMENTED_OUT_CODE.warnText()} x = 2+4", false),
LintError(14, 13, ruleId, "${COMMENTED_OUT_CODE.warnText()} ", false)
)
}
Expand Down

0 comments on commit ce74f67

Please sign in to comment.