You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -40,12 +40,12 @@ Before releasing a new version of KtLint, the release candidate is tested on a s
40
40
```
41
41
4. Create an alias or script to run the latest released version of ktlint (note that this script will print the version as reference to which version is used):
42
42
```shell
43
-
alias ktlint-prev="ktlint-1.3.0$@"# Replace with the latest release version
43
+
alias ktlint-prev="ktlint-1.3.1$@"# Replace with the latest release version
44
44
```
45
45
Note that `~/git/ktlint` is the directory in which the ktlint project is checked out and that `~/git/ktlint/ktlint` refers to the `ktlint` CLI-module.
46
46
5. Create an alias or script to run the latest development-version of ktlint (note that this script will print the version and the datetime of compilation as reference to which version is used):
47
47
```shell
48
-
alias ktlint-dev="echo 'ktlint-dev version:';ls -aslh ~/git/ktlint/pinterest/ktlint/ktlint-cli/build/run/ktlint;echo ' ';~/git/ktlint/pinterest/ktlint/ktlint-cli/build/run/ktlint $@"
48
+
alias ktlint-dev="echo 'ktlint-dev version:';ls -aslh ~/git/ktlint/ktlint/ktlint-cli/build/run/ktlint;echo ' ';~/git/ktlint/ktlint/ktlint-cli/build/run/ktlint $@"
49
49
```
50
50
Note that `~/git/ktlint/pinterest/ktlint` is the directory in which the ktlint project is checked out.
51
51
@@ -82,7 +82,6 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
82
82
83
83
[graphql-kotlin/**/*.{kt,kts}]
84
84
ktlint_standard_no-unused-imports = disabled
85
-
ktlint_standard_import-ordering = disabled
86
85
87
86
[kotlinx.coroutines/**/*.{kt,kts}]
88
87
ktlint_standard_no-wildcard-imports = disabled
@@ -92,7 +91,6 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
92
91
# be changed:
93
92
# 1) Disable the "root = true" property so that each project ultimately falls back on this file. In this way offending
94
93
# rules can be easily enabled/disabled for all test projects
95
-
# 2) From the graphql project remove the `disabled_rules` property
96
94
ktlint_code_style = ktlint_official
97
95
ktlint_experimental = enabled
98
96
ktlint_standard = enabled
@@ -109,7 +107,7 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
109
107
Note: Ignore all output as this is the old version!
110
108
4. Format the sample projects with the previous (*latest released*) ktlint version:
111
109
```shell
112
-
ktlint-prev --format --force-lint-after-format --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script.
110
+
ktlint-prev -F --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script.
113
111
```
114
112
Note: Ignore all output as this is the old version!
115
113
5. Commit changes:
@@ -132,25 +130,25 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
132
130
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.
133
131
```
134
132
Inspect the output roughly (detailed inspection is done when formatting):
135
-
* Is the amount of logging messages comparable to before? If not, are the changes intended?
136
-
* Are violations related to rules that have actually been added or changed?
137
-
* 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!
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!
138
136
```plain
139
137
Internal Error (...) in file '...' at position '0:0. Please create a ticket at https://github.com/pinterest/ktlint/issues ...
140
138
```
141
139
9. Format with *latest development* version:
142
140
```shell
143
-
ktlint-dev --format --force-lint-after-format --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.
141
+
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.
144
142
```
145
143
Inspect the output carefully:
146
-
* 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!
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!
147
145
```plain
148
146
Internal Error (...) in file '...' at position '0:0. Please create a ticket at https://github.com/pinterest/ktlint/issues ...
149
147
```
150
-
* 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.
151
-
* 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.
152
-
* Violations which could not be autocorrected should be validated for correctness but do not block the release as most likely this is intended behavior.
153
-
* 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.
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.
154
152
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:
155
153
```shell
156
154
./exec-in-each-project.sh "git add --all && git commit -m \"Fixed with latest development version\""
@@ -165,14 +163,14 @@ Formatting projects in which ktlint is not used may result in a huge amount of f
165
163
Internal Error (...) in file '...' at position '0:0. Please create a ticket at https://github.com/pinterest/ktlint/issues ...
166
164
```
167
165
12. Rerun lint with *latest development* version and verify that no violations are reported:
168
-
```shell
169
-
ktlint-dev --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script as we want one combined baseline.xml file for all projects.
170
-
```
166
+
```shell
167
+
ktlint-dev --baseline=baseline.xml --relative # Do not call this command via the "./exec-in-each-project.sh" script as we want one combined baseline.xml file for all projects.
168
+
```
171
169
No violations should be reported in this run.
172
170
13. Rerun format with *latest development* version without baseline:
173
-
```shell
174
-
ktlint-dev --format --force-lint-after-format --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.
175
-
```
171
+
```shell
172
+
ktlint-dev -F --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.
173
+
```
176
174
As the baseline is removed, thousands of violations are to be expected. Check at least in the summary that no internal errors are thrown like below:
177
175
```plain
178
176
Internal Error (...) in file '...' at position '0:0. Please create a ticket at https://github.com/pinterest/ktlint/issues ...
Copy file name to clipboardexpand all lines: ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/rules/BlankLineBetweenWhenConditions.kt
+1-2
Original file line number
Diff line number
Diff line change
@@ -84,8 +84,7 @@ public class BlankLineBetweenWhenConditions :
84
84
?.let { whitespaceBeforeWhenEntry ->
85
85
emitAndApprove(
86
86
whitespaceBeforeWhenEntry.startOffset +1,
87
-
"Add a blank line between all when-condition in case at least one multiline when-condition is found in the "+
88
-
"statement",
87
+
"Add a blank line between all when-conditions in case at least one multiline when-condition is found in the statement",
Copy file name to clipboardexpand all lines: ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/BlankLineBetweenWhenConditionsTest.kt
+8-8
Original file line number
Diff line number
Diff line change
@@ -84,8 +84,8 @@ class BlankLineBetweenWhenConditionsTest {
0 commit comments