Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gantsign/doxia-sink-api-ktx
Kotlin extensions for doxia-sink-api
https://github.com/gantsign/doxia-sink-api-ktx
doxia maven maven-plugin
Last synced: 2 days ago
JSON representation
Kotlin extensions for doxia-sink-api
- Host: GitHub
- URL: https://github.com/gantsign/doxia-sink-api-ktx
- Owner: gantsign
- License: apache-2.0
- Created: 2018-05-12T09:05:53.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-27T14:22:38.000Z (6 months ago)
- Last Synced: 2024-04-27T15:29:17.562Z (6 months ago)
- Topics: doxia, maven, maven-plugin
- Language: Kotlin
- Size: 501 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kotlin Extensions for Doxia
[![Release](https://github.com/gantsign/doxia-sink-api-ktx/workflows/Build/badge.svg)](https://github.com/gantsign/doxia-sink-api-ktx/actions?query=workflow%3ABuild)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.gantsign.maven.doxia/doxia-sink-api-ktx/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.gantsign.maven.doxia/doxia-sink-api-ktx)
[![codecov](https://codecov.io/gh/gantsign/doxia-sink-api-ktx/branch/main/graph/badge.svg)](https://codecov.io/gh/gantsign/doxia-sink-api-ktx)
[![Known Vulnerabilities](https://snyk.io/test/github/gantsign/doxia-sink-api-ktx/badge.svg)](https://snyk.io/test/github/gantsign/doxia-sink-api-ktx)Kotlin extensions for the [Apache Doxia](https://maven.apache.org/doxia/) is a
content generation framework. The main use of these extensions are for
generating reports in custom Maven plugins.**This API is currently unstable, no compatibility guarantees are made between versions.**
## Writing Maven Report Content
This library provides a Kotlin DSL for writing content using Doxia Sink. The
following is an extract from the [ktlint Maven Plugin](https://github.com/gantsign/ktlint-maven-plugin/blob/master/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/KtlintReportGenerator.kt):```kotlin
fun generatorReport(results: CheckResults) {
sink {
head {
title {
+title
}
}
body {
section(1) {
title {
+title
}
paragraph {
+"${bundle["report.ktlint.ktlintlink"]} "
link("https://github.com/shyiko/ktlint") {
+"ktlint"
}
if (ktlintVersion != null) {
+" $ktlintVersion"
}
+"."
}
}section(1) {
title {
+bundle["report.ktlint.summary"]
}
table {
tableRows {
tableRow {
tableHeaderCell {
+bundle["report.ktlint.files"]
}
tableHeaderCell {
+bundle["report.ktlint.errors"]
}
}
tableRow {
tableCell {
+"${results.fileCount}"
}
tableCell {
+"${results.errors.size}"
}
}
}
}
}val errorsByFile =
results.errors.groupBy(FileLintError::file).toSortedMap()if (errorsByFile.isNotEmpty()) {
section(1) {
title {
+bundle["report.ktlint.files"]
}
table {
tableRows {
tableRow {
tableHeaderCell {
+bundle["report.ktlint.file"]
}
tableHeaderCell {
+bundle["report.ktlint.errors"]
}
}for ((file, errors) in errorsByFile) {
tableRow {
tableCell {
link("#${file.replace('/', '.')}") {
+file
}
}
tableCell {
+"${errors.size}"
}
}
}
}
}
}section(1) {
title {
+bundle["report.ktlint.details"]
}
for ((file, errors) in errorsByFile) {
val sortedErrors = errors.sortedWith(
Comparator.comparingInt(FileLintError::line)
.thenComparingInt(FileLintError::col)
.thenComparing(FileLintError::ruleId)
)
section(2, id = file.replace('/', '.')) {
title {
+file
}
}
table {
tableRows {
tableRow {
tableHeaderCell {
+bundle["report.ktlint.detail"]
}
tableHeaderCell {
+bundle["report.ktlint.ruleId"]
}
tableHeaderCell {
+bundle["report.ktlint.line"]
}
}
for (error in sortedErrors) {
tableRow {
tableCell {
+error.detail
}
tableCell {
+error.ruleId
}
tableCell {
+"${error.line}"
}
}
}
}
}
}
}
}
}
}
}```
## License
This software is licensed under the terms in the file named "LICENSE" in the
root directory of this project. This project has dependencies that are under
different licenses.## Author Information
John Freeman
GantSign Ltd.
Company No. 06109112 (registered in England)