Skip to content

Commit 2ea18f0

Browse files
Register missing ktlint_disabled_rules in editorConfigProperties and update documentation (#1671)
Co-authored-by: paul-dingemans <paul-dingemans@users.noreply.github.com>
1 parent f51931f commit 2ea18f0

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ if (node.isRoot()) {
3434
* Let a rule process all nodes even in case the rule is suppressed for a node so that the rule can update the internal state ([#1644](https://github.com/pinterest/ktlint/issue/1644))
3535
* Read `.editorconfig` when running CLI with options `--stdin` and `--editorconfig` ([#1651](https://github.com/pinterest/ktlint/issue/1651))
3636
* Do not add a trailing comma in case a multiline function call argument is found but no newline between the arguments `trailing-comma-on-call-site` ([#1642](https://github.com/pinterest/ktlint/issue/1642))
37+
* Add missing `ktlint_disabled_rules` to exposed `editorConfigProperties` ([#1671](https://github.com/pinterest/ktlint/issue/1671))
3738

3839
### Changed
3940
* Update Kotlin development version to `1.7.20` and Kotlin version to `1.7.20`.

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ Like with other `@Suppress` annotations, it can be placed on targets supported b
114114

115115

116116
## How do I globally disable a rule?
117-
With [`.editorConfig` property `disabled_rules`](../rules/configuration#disabled-rules) a rule can be disabled globally.
117+
With [`.editorConfig` property `ktlint_disabled_rules`](../rules/configuration-ktlint#disabled-rules) a rule can be disabled globally.
118118

119119
You may also pass a list of disabled rules via the `--disabled_rules` command line flag. It has the same syntax as the EditorConfig property.

docs/rules/configuration-ktlint.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ ktlint_code_style = official
1515

1616
## Disabled rules
1717

18-
By default, no rules are disabled. The property `disabled_rules` holds a comma separated list (without spaces). Rules which are not defined in the `standard` ruleset have to be prefixed. Rules defined in the `standard` ruleset may optionally be prefixed.
18+
By default, no rules are disabled. The property `ktlint_disabled_rules` holds a comma separated list (without spaces). Rules which are not defined in the `standard` ruleset have to be prefixed. Rules defined in the `standard` ruleset may optionally be prefixed.
1919

2020
Example:
2121
```ini
2222
[*.{kt,kts}]
23-
disabled_rules = some-standard-rule,experimental:some-experimental-rule,my-custom-ruleset:my-custom-rule
23+
ktlint_disabled_rules = some-standard-rule,experimental:some-experimental-rule,my-custom-ruleset:my-custom-rule
2424
```
2525

2626
## Final newline
@@ -205,9 +205,9 @@ This setting only takes effect when rule `trailing-comma-on-declaration-site` is
205205
You can [override](https://editorconfig.org/#file-format-details) properties for specific directories inside your project:
206206
```ini
207207
[*.{kt,kts}]
208-
disabled_rules=import-ordering
208+
ktlint_disabled_rules=import-ordering
209209

210210
Note that in this case 'import-ordering' rule will be active and 'indent' will be disabled
211211
[api/*.{kt,kts}]
212-
disabled_rules=indent
212+
ktlint_disabled_rules=indent
213213
```

ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/api/UsesEditorConfigProperties.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public object DefaultEditorConfigProperties : UsesEditorConfigProperties {
331331
override val editorConfigProperties: List<UsesEditorConfigProperties.EditorConfigProperty<*>> = listOf(
332332
codeStyleSetProperty,
333333
disabledRulesProperty,
334+
ktlintDisabledRulesProperty,
334335
indentStyleProperty,
335336
indentSizeProperty,
336337
insertNewLineProperty,

ktlint-core/src/test/kotlin/com/pinterest/ktlint/core/internal/EditorConfigGeneratorTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal class EditorConfigGeneratorTest {
3636
"indent_style = space",
3737
"insert_final_newline = true",
3838
"ktlint_code_style = official",
39+
"ktlint_disabled_rules = ",
3940
"max_line_length = -1",
4041
)
4142
}

0 commit comments

Comments
 (0)