Skip to content

Commit 947ff8d

Browse files
Merge pull request #2988 from pinterest/1.6.0-prep
1.6.0 prep
2 parents f2090c5 + d31e07c commit 947ff8d

4 files changed

Lines changed: 51 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [1.6.0] - 2025-05-19
6+
7+
### 🆕 Features
8+
9+
10+
* Add configuration option to handle (certain) annotation with parameters identical to annotations without parameters - [#2950](https://github.com/pinterest/ktlint/pull/2950), by @paul-dingemans
11+
12+
* Set system properties to prevent failure when running in ktlint-intellij-plugin with custom installation - [#2970](https://github.com/pinterest/ktlint/pull/2970), by @paul-dingemans
13+
14+
* chore(deps): update dependency gradle to v8.14 - [#2971](https://github.com/pinterest/ktlint/pull/2971), by @renovate[bot]
15+
16+
* chore(deps): update plugin com.gradle.develocity to v4.0.1 - [#2972](https://github.com/pinterest/ktlint/pull/2972), by @renovate[bot]
17+
18+
* fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v2.2.0-beta2 - [#2977](https://github.com/pinterest/ktlint/pull/2977), by @renovate[bot]
19+
20+
* fix(deps): update dependency org.ec4j.core:ec4j-core to v1.1.1 - [#2987](https://github.com/pinterest/ktlint/pull/2987), by @renovate[bot]
21+
22+
* fix(deps): update dependency dev.drewhamilton.poko:poko-gradle-plugin to v0.18.7 - [#2986](https://github.com/pinterest/ktlint/pull/2986), by @renovate[bot]
23+
24+
* fix(deps): update kotlin monorepo to 2.1.21 - [#2985](https://github.com/pinterest/ktlint/pull/2985), by @renovate[bot]
25+
26+
### 💬 Other
27+
28+
29+
* ignore `.kotlin` directory - [#2916](https://github.com/pinterest/ktlint/pull/2916), by @mgroth0
30+
531
## [1.5.0] - 2024-12-04
632

733
The release of Kotlin 2.1 is the primary reason for publishing this release earlier than planned. Because of the removal of some language elements in Kotlin 2.1, the embedded Kotlin compiler in KtLint blocked Kotlinter users from upgrading to Kotlin 2.1.
@@ -2645,6 +2671,7 @@ set in `[*{kt,kts}]` section).
26452671

26462672
## 0.1.0 - 2016-07-27
26472673

2674+
[1.6.0]: https://github.com/pinterest/ktlint/compare/1.6.0...1.5.0
26482675
[1.5.0]: https://github.com/pinterest/ktlint/compare/1.5.0...1.4.1
26492676
[1.4.1]: https://github.com/pinterest/ktlint/compare/1.4.1...1.4.0
26502677
[1.4.0]: https://github.com/pinterest/ktlint/compare/1.4.0...1.3.1

RELEASE_TESTING.MD

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -99,40 +99,39 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
9999
```shell
100100
./exec-in-each-project.sh "git add --all && git commit -m \"Update .editorconfig to fallback to integration test settings\""
101101
```
102-
3. Build baseline file with previous (*latest released*) version of Lint (when building with format the offsets of the error are not saved correctly in the baseline)
102+
3. Format with previous (*latest released*) version of Lint
103103
```shell
104-
rm baseline.xml
105-
ktlint-prev --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script.
106-
```
107-
Note: Ignore all output as this is the old version!
108-
4. Format the sample projects with the previous (*latest released*) ktlint version:
109-
```shell
110-
ktlint-prev -F --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script.
104+
ktlint-prev --format --relative # Do not call this command via the "./exec-in-each-project.sh" script.
111105
```
112106
Note: Ignore all output as this is the old version!
113-
5. Commit changes:
107+
4. Commit changes:
114108
```shell
115109
./exec-in-each-project.sh "git add --all && git commit -m \"Format with previous ktlint version (round #)\""
116110
```
117111
Repeat step 4 and 5 until no files are changed anymore. Although ktlint reruns up to 3 times in case new violations are introduced, it can still happen that not all violations have been fixed with a single invocation.
118-
6. Check that besides the `baseline.xml` no files are changed (in step 4 and 5 all violations which could be autocorrected have already been committed). Remaining violations which could not be autocorrected are saved in the `baseline.xml` which is stored outside the project directories.
119-
```shell
120-
./exec-in-each-project.sh "git status"
121-
```
122-
7. Rebuild baseline file with previous (*latest released*) ktlint (when building with format the offsets of the error are not saved correctly in the baseline) so that all violations are now stored in the baseline. Note the old `baseline.xml` still contains all errors which are already autocorrected. After running next command, only the error which can not be autocorrected with the previous ktlint version remain.
112+
5. Build baseline file with previous (*latest released*) version of Lint (when building with format the offsets of the error are not saved correctly in the baseline) so that all errors which cannot be autocorrected are ignored.
123113
```shell
124114
rm baseline.xml
125115
ktlint-prev --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script.
126116
```
127-
Note: Ignore all output as this is the old version!
117+
Note: Ignore all output as this is the old version! Inspect the baseline roughly to verify that it only contains errors that cannot be autocorrected.
118+
6. Format the sample projects with the previous (*latest released*) ktlint version:
119+
```shell
120+
ktlint-prev -F --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script.
121+
```
122+
Note: The output should not report any violations, as the baseline should suppress every error that could not autocorrected.
123+
7. Check that besides the `baseline.xml` no files are changed (in step 4 and 5 all violations which could be autocorrected have already been committed). Remaining violations which could not be autocorrected are saved in the `baseline.xml` which is stored outside the project directories.
124+
```shell
125+
./exec-in-each-project.sh "git status"
126+
```
128127
8. Lint with *latest development* version:
129128
```shell
130129
ktlint-dev --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script as we want to use the one combined baseline.xml file for all projects.
131130
```
132131
Inspect the output roughly (detailed inspection is done when formatting):
133-
* Is the amount of logging messages comparable to before? If not, are the changes intended?
134-
* Are violations related to rules that have actually been added or changed?
135-
* If you see an error like below, then this version obviously may *not* be released. It is best to fix this error before continuing with testing and validating!
132+
* Is the amount of logging messages comparable to before? If not, are the changes intended?
133+
* Are violations related to rules that have actually been added or changed?
134+
* If you see an error like below, then this version obviously may *not* be released. It is best to fix this error before continuing with testing and validating!
136135
```plain
137136
Internal Error (...) in file '...' at position '0:0. Please create a ticket at https://github.com/pinterest/ktlint/issues ...
138137
```
@@ -141,14 +140,14 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
141140
ktlint-dev -F --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script as we want to use the one combined baseline.xml file for all projects.
142141
```
143142
Inspect the output carefully:
144-
* If you see an error like below, then this version obviously may *not* be released. It is best to fix this error before continuing with testing and validating!
143+
* If you see an error like below, then this version obviously may *not* be released. It is best to fix this error before continuing with testing and validating!
145144
```plain
146145
Internal Error (...) in file '...' at position '0:0. Please create a ticket at https://github.com/pinterest/ktlint/issues ...
147146
```
148-
* Usually it helps to disable all rules that emit violations, except one of those rules. In this way it is possible to evaluate the changes rule by rule.
149-
* Ideally, no violations are shown. This means that all violations have been autocorrected. Note that violations might pop up that previously were suppressed via the baseline. This can happen as due to code changes, the references in the baseline.xml no longer match with the positions where they occur. First check the code changes, and regenerating the baseline before verifying the next can be a helpful approach.
150-
* Violations which could not be autocorrected should be validated for correctness but do not block the release as most likely this is intended behavior.
151-
* If a violation is shown which is not marked as being "can not be autocorrected" this means that during autocorrect of another violation a new violations has been introduced. This should be fixed before releasing especially when the next format introduces the original violation again which of course would result in an endless loop.
147+
* Usually it helps to disable all rules that emit violations, except one of those rules. In this way it is possible to evaluate the changes rule by rule.
148+
* Ideally, no violations are shown. This means that all violations have been autocorrected. Note that violations might pop up that previously were suppressed via the baseline. This can happen as due to code changes, the references in the baseline.xml no longer match with the positions where they occur. First check the code changes, and regenerating the baseline before verifying the next can be a helpful approach.
149+
* Violations which could not be autocorrected should be validated for correctness but do not block the release as most likely this is intended behavior.
150+
* If a violation is shown which is not marked as being "can not be autocorrected" this means that during autocorrect of another violation a new violations has been introduced. This should be fixed before releasing especially when the next format introduces the original violation again which of course would result in an endless loop.
152151
10. Inspect all fixed violations, Of course inspection similar violations tens of times does not make sense. At least check different types of violations a couple of times. Commit changes which do not need to be inspected again:
153152
```shell
154153
./exec-in-each-project.sh "git add --all && git commit -m \"Fixed with latest development version\""

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=1.5.1-SNAPSHOT
1+
VERSION_NAME=1.6.0
22
POM_GROUP_ID=com.pinterest.ktlint
33

44
POM_DESCRIPTION=An anti-bikeshedding Kotlin linter with built-in formatter.

ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/rules/TrailingCommaOnDeclarationSiteRule.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,7 @@ public class TrailingCommaOnDeclarationSiteRule :
428428

429429
private fun ASTNode.hasWhenEntryGuard() = elementType == WHEN_ENTRY && hasWhenEntryGuardKotlin21()
430430

431-
private fun ASTNode.hasWhenEntryGuardKotlin21(): Boolean =
432-
// TODO: Remove try-catch wrapping once kotlin version is upgraded to 2.1 or above
433-
try {
434-
children().any { it.elementType == WHEN_ENTRY_GUARD }
435-
} catch (e: NoSuchFieldError) {
436-
// Prior to Kotlin 2.1 the WHEN_ENTRY_GUARD can not be retrieved successfully.
437-
false
438-
}
431+
private fun ASTNode.hasWhenEntryGuardKotlin21(): Boolean = children().any { it.elementType == WHEN_ENTRY_GUARD }
439432

440433
private fun containsLineBreakInLeavesRange(
441434
from: PsiElement,

0 commit comments

Comments
 (0)