Skip to content

Commit

Permalink
Merge pull request #85 from tnorbye/1.5.8
Browse files Browse the repository at this point in the history
1.5.8
  • Loading branch information
tnorbye authored Dec 9, 2022
2 parents 42b1c34 + b57e734 commit d1ec377
Show file tree
Hide file tree
Showing 42 changed files with 6,031 additions and 5,527 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

# KDoc Formatter Changelog

## [1.5.8]
- Fixed a number of bugs:
- #84: Line overrun when using closed-open interval notation
- More gracefully handle unterminated [] references (for example when
comment is using it in things like [closed, open) intervals)
- Recognize and convert accidentally capitalized kdoc tags like @See
- If you have a [ref] which spans a line such that the # ends up as a
new line, don't treat this as a "# heading".
- Make sure we don't line break at an expression starting with ">"
since that would turn into a quoted line.
- If you're using optimal line breaking and there's a really long,
unbreakable word in the paragraph, switch that paragraph over to
greedy line breaking (to make the paragraph better balanced since
the really long word throws the algorithm off.)
- Fix a few scenarios where markup conversion from <p> and </p>
wasn't converting everything.
- Allow @property[name], not just @param[name]
- The --hanging-indent flag now also sets the nested list indent
(if >= 3)
- Some minor code cleanup.

## [1.5.7]
- Fixed the following bugs:
- #76: Preserve newline style (CRLF on Windows)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Options:
@<filename>
Read filenames from file.
kdoc-formatter: Version 1.5.7
kdoc-formatter: Version 1.5.8
https://github.com/tnorbye/kdoc-formatter
```

Expand Down
34 changes: 10 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
apply from: "$rootDir/version.gradle"

ext {
gradlePluginVersion = '7.4.0-alpha08'
gradlePluginVersion = '8.0.0-alpha09'
}

repositories {
Expand All @@ -17,8 +17,15 @@ buildscript {

plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
//id 'com.ncorti.ktfmt.gradle' version '0.8.0'
id 'org.jetbrains.kotlin.jvm' version '1.7.22'
// Formatting is commented out in library/, cli/ and ide-plugin
// because it reformats comments with the old formatter; this
// breaks the "check" target because it/ tries to format.
//
// To manually format, uncomment these, then run
// ./gradlew ktfmtFormat and then run
// kdoc-formatter --max-line-width=72 --add-punctuation --convert-markup --hanging-indent=2 .
id 'com.ncorti.ktfmt.gradle' version '0.11.0'
}

group 'kdocformatter'
Expand All @@ -40,27 +47,6 @@ test {
useJUnitPlatform()
}

configurations {
ktlint
}

dependencies {
ktlint "com.pinterest:ktlint:0.46.0"
}

task format(type: JavaExec, group: "verification") {
description = "Format lint Kotlin files"
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "--disabled_rules=import-ordering", "**/*.kt"
}

//ktfmt {
// // To format, run ./gradlew ktfmtFormat and then run
// // kdoc-formatter --max-line-width=72 --add-punctuation --convert-markup .
// kotlinLangStyle()
//}

task lint {
dependsOn ':library:lint', ':cli:lint', ':ide-plugin:lint'
}
Expand Down
4 changes: 0 additions & 4 deletions cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ lint {
textReport true
}

//ktfmt {
// kotlinLangStyle()
//}

test {
useJUnitPlatform()
}
Expand Down
59 changes: 29 additions & 30 deletions cli/src/main/kotlin/kdocformatter/cli/Driver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,41 @@ import kdocformatter.cli.KDocFileFormattingOptions.Companion.usage
import kotlin.system.exitProcess

fun main(args: Array<String>) {
if (args.isEmpty()) {
println(usage())
exitProcess(-1)
}

val options = KDocFileFormattingOptions.parse(args)
val files = options.files
if (files.isEmpty()) {
error("no files were provided")
} else if (options.filter.isEmpty()) {
if (!options.quiet && (options.gitStaged || options.gitHead)) {
println(
"No changes to Kotlin files found in ${
if (args.isEmpty()) {
println(usage())
exitProcess(-1)
}

val options = KDocFileFormattingOptions.parse(args)
val files = options.files
if (files.isEmpty()) {
error("no files were provided")
} else if (options.filter.isEmpty()) {
if (!options.quiet && (options.gitStaged || options.gitHead)) {
println(
"No changes to Kotlin files found in ${
if (options.gitStaged) "the staged files" else "HEAD"
}"
)
}
exitProcess(0)
}")
}
val formatter = KDocFileFormatter(options)
exitProcess(0)
}
val formatter = KDocFileFormatter(options)

var count = 0
for (file in files) {
count += formatter.formatFile(file)
}
var count = 0
for (file in files) {
count += formatter.formatFile(file)
}

if (!options.quiet) {
println("Formatted $count files")
}
if (!options.quiet) {
println("Formatted $count files")
}

exitProcess(0)
exitProcess(0)
}

fun error(message: String): Nothing {
System.err.println(message)
System.err.println()
System.err.println(usage())
exitProcess(-1)
System.err.println(message)
System.err.println()
System.err.println(usage())
exitProcess(-1)
}
Loading

0 comments on commit d1ec377

Please sign in to comment.