Skip to content

Commit d45cdd2

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 d45cdd2

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-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: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,23 @@ tasks {
303303
delete(rootProject.file("licenses"))
304304
}
305305

306+
val trimLicenseTrailingWhitespace by registering {
307+
// trim trailing whitespace from license markdown file
308+
val licenseFile = rootDir.toPath().resolve("licenses/licenses.md")
309+
val newline = System.lineSeparator()
310+
doLast {
311+
if (Files.exists(licenseFile)) {
312+
val content = String(Files.readAllBytes(licenseFile), Charsets.UTF_8)
313+
val normalized = content.lineSequence()
314+
.map { it.trimEnd() }
315+
.toList()
316+
.dropLastWhile { it.isEmpty() }
317+
.joinToString(newline) + newline
318+
Files.write(licenseFile, normalized.toByteArray(Charsets.UTF_8))
319+
}
320+
}
321+
}
322+
306323
val removeLicenseDate by registering {
307324
// removing the license report date makes it idempotent
308325
val rootDirPath = rootDir.toPath()
@@ -328,7 +345,7 @@ tasks {
328345
val generateLicenseReportTask = named("generateLicenseReport")
329346
generateLicenseReportTask.configure {
330347
dependsOn(cleanLicenses)
331-
finalizedBy(":spotlessApply")
348+
finalizedBy(trimLicenseTrailingWhitespace)
332349
finalizedBy(removeLicenseDate)
333350
// disable licence report generation unless this task is explicitly run
334351
// the files produced by this task are used by other tasks without declaring them as dependency

0 commit comments

Comments
 (0)