Skip to content

Commit

Permalink
[NO JIRA] Stop adding new rule to check list in generate-rule script (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
irina-batinic-sonarsource authored Jun 26, 2024
1 parent ea6136f commit 26ad55d
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions java-checks/generate-rule-stubs.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -127,32 +127,6 @@ samplePath.writeText(
""".trimIndent()
)

// Add check to check list
val checkListPath = listOf("..", "sonar-java-plugin", "src", "main", "java", "org", "sonar", "plugins", "java", "CheckList.java")
.fold(javaChecksModulePath) { acc, part ->
acc.resolve(part)
}

val remainingLines = checkListPath.readLines().toMutableList()
val newLines = mutableListOf<String>()

while (!remainingLines.first().startsWith("import")) newLines.add(remainingLines.removeFirst())

val newCheckImportLine = "import ${pckg.joinToString(".")}.${checkName};"
while (remainingLines.first()
.startsWith("import") && remainingLines.first().lowercase() < newCheckImportLine.lowercase()
) newLines.add(remainingLines.removeFirst())
newLines.add(newCheckImportLine)

while (newLines.isEmpty() || !newLines.last().contains("// IssuableSubscriptionVisitor")) newLines.add(remainingLines.removeFirst())

val checkListLine = " $checkName.class,"
while (remainingLines.first().endsWith(".class,") && remainingLines.first().lowercase() < checkListLine.lowercase()) newLines.add(remainingLines.removeFirst())
newLines.add(checkListLine)

newLines.addAll(remainingLines)

checkListPath.writeText(newLines.joinToString("\n", postfix = "\n"))

// License headers using "mvn license:format"
val mvnCmd = if (System.getProperty("os.name").lowercase().startsWith("windows")) {
Expand Down

0 comments on commit 26ad55d

Please sign in to comment.