Skip to content

Commit

Permalink
Refactoring: use more readable functions (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
schalkms authored and 3flex committed Sep 13, 2019
1 parent f80fe60 commit 8803173
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -21,7 +21,7 @@ class KotlinEnvironmentUtilsTest : Spek({
.toList()

val languageVersion = classpathFiles.getKotlinLanguageVersion()
assertThat(languageVersion).isNotNull()
assertThat(languageVersion).isNotNull
assertThat(languageVersion?.versionString).isEqualTo(expectedVersionString)
}
}
Expand Down
Expand Up @@ -31,11 +31,11 @@ class HtmlOutputReport : OutputReport() {
}

private fun renderFindings(findings: Map<String, List<Finding>>) = htmlSnippet {
for ((group, groupFindings) in findings.filter { !it.value.isEmpty() }) {
for ((group, groupFindings) in findings.filter { it.value.isNotEmpty() }) {
h3 { group }

groupFindings.groupBy { it.id }.forEach { rule, findings ->
if (!findings.isEmpty()) {
if (findings.isNotEmpty()) {
div("rule-container") {
span("rule") { rule }
span("description") { findings.first().issue.description }
Expand All @@ -45,7 +45,7 @@ class HtmlOutputReport : OutputReport() {
list(findings) {
span("location") { "${it.file}:${it.location.source.line}:${it.location.source.column}" }

if (!it.message.isEmpty()) {
if (it.message.isNotEmpty()) {
br()
span("message") { it.message }
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ class SpacingBetweenPackageAndImports(config: Config = Config.empty) : Rule(conf
element is KtPackageDirective && element.text.isNotEmpty()

private fun checkKtElementsDeclaration(importList: KtImportList) {
val ktElements = importList.siblings(withItself = false).toList().filter { it is KtElement }
val ktElements = importList.siblings(withItself = false).toList().filterIsInstance<KtElement>()
val nextSibling = importList.nextSibling
if (ktElements.isNotEmpty() &&
(nextSibling is PsiWhiteSpace || nextSibling is KtElement)) {
Expand Down

0 comments on commit 8803173

Please sign in to comment.