Skip to content

Commit

Permalink
Fix remaining Spotless problems
Browse files Browse the repository at this point in the history
  • Loading branch information
serras committed Oct 19, 2023
1 parent 821c64b commit 83d6fa3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("ktlint:standard:property-naming")

package arrow.optics.plugin.internals

import arrow.optics.plugin.companionObject
Expand Down Expand Up @@ -28,6 +30,7 @@ data class ADT(val pckg: KSName, val declaration: KSClassDeclaration, val target
copy(imports = imports + snippet.imports, content = "$content\n${snippet.content}")
}

@Suppress("RecursivePropertyAccessor")
val KSClassDeclaration.nameWithParentClass: String
get() = when (val parent = parentDeclaration) {
is KSClassDeclaration -> parent.nameWithParentClass + "." + simpleName.asString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fun String.plusIfNotBlank(prefix: String = "", postfix: String = "") =
* Sanitizes each delimited section if it matches with Kotlin reserved keywords.
*/
fun KSName.asSanitizedString(delimiter: String = ".", prefix: String = "") =
asString().splitToSequence(delimiter).joinToString(delimiter, prefix) { if (it in kotlinKeywords) "`$it`" else it }
asString().splitToSequence(delimiter).joinToString(delimiter, prefix) { if (it in KOTLIN_KEYWORDS) "`$it`" else it }

private val kotlinKeywords = setOf(
private val KOTLIN_KEYWORDS = setOf(
// Hard keywords
"as",
"break",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("ktlint:standard:property-naming")

package arrow.optics.plugin

const val `package` = "package `if`.`this`.`object`.`is`.`finally`.`null`.`expect`.`annotation`"
Expand Down

0 comments on commit 83d6fa3

Please sign in to comment.