Skip to content

Commit 6c903a5

Browse files
committed
Remove markdown files from spotless
Markdown files are already checked by markdown lint, so no need to check them with spotless as well.
1 parent bb926c0 commit 6c903a5

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

conventions/src/main/kotlin/otel.spotless-conventions.gradle.kts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,9 @@ if (project == rootProject) {
8585
".gitattributes",
8686
".gitconfig",
8787
".editorconfig",
88-
"*.md",
8988
"gradle.properties",
90-
".github/**/*.md",
9189
".github/**/*.sh",
92-
"docs/**/*.md",
93-
"examples/**/*.md",
94-
"examples/**/gradle.properties",
95-
"licenses/**/*.md"
90+
"examples/**/gradle.properties"
9691
)
9792
leadingTabsToSpaces()
9893
trimTrailingWhitespace()

javaagent/build.gradle.kts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,22 @@ tasks {
303303
delete(rootProject.file("licenses"))
304304
}
305305

306+
val trimLicenseTrailingWhitespace by registering {
307+
val licenseFile = rootDir.toPath().resolve("licenses/licenses.md")
308+
val newline = System.lineSeparator()
309+
doLast {
310+
if (Files.exists(licenseFile)) {
311+
val content = String(Files.readAllBytes(licenseFile), Charsets.UTF_8)
312+
val normalized = content.lineSequence()
313+
.map { it.trimEnd() }
314+
.toList()
315+
.dropLastWhile { it.isEmpty() }
316+
.joinToString(newline) + newline
317+
Files.write(licenseFile, normalized.toByteArray(Charsets.UTF_8))
318+
}
319+
}
320+
}
321+
306322
val removeLicenseDate by registering {
307323
// removing the license report date makes it idempotent
308324
val rootDirPath = rootDir.toPath()
@@ -328,7 +344,7 @@ tasks {
328344
val generateLicenseReportTask = named("generateLicenseReport")
329345
generateLicenseReportTask.configure {
330346
dependsOn(cleanLicenses)
331-
finalizedBy(":spotlessApply")
347+
finalizedBy(trimLicenseTrailingWhitespace)
332348
finalizedBy(removeLicenseDate)
333349
// disable licence report generation unless this task is explicitly run
334350
// the files produced by this task are used by other tasks without declaring them as dependency

0 commit comments

Comments
 (0)