Skip to content

Commit

Permalink
Register missing ktlint_disabled_rules in editorConfigProperties and …
Browse files Browse the repository at this point in the history
…update documentation (#1671)

Co-authored-by: paul-dingemans <[email protected]>
  • Loading branch information
tbcrawford and paul-dingemans authored Oct 12, 2022
1 parent f51931f commit 2ea18f0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if (node.isRoot()) {
* 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))
* Read `.editorconfig` when running CLI with options `--stdin` and `--editorconfig` ([#1651](https://github.com/pinterest/ktlint/issue/1651))
* 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))
* Add missing `ktlint_disabled_rules` to exposed `editorConfigProperties` ([#1671](https://github.com/pinterest/ktlint/issue/1671))

### Changed
* Update Kotlin development version to `1.7.20` and Kotlin version to `1.7.20`.
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ Like with other `@Suppress` annotations, it can be placed on targets supported b


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

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.
8 changes: 4 additions & 4 deletions docs/rules/configuration-ktlint.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ ktlint_code_style = official

## Disabled rules

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.
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.

Example:
```ini
[*.{kt,kts}]
disabled_rules = some-standard-rule,experimental:some-experimental-rule,my-custom-ruleset:my-custom-rule
ktlint_disabled_rules = some-standard-rule,experimental:some-experimental-rule,my-custom-ruleset:my-custom-rule
```

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

Note that in this case 'import-ordering' rule will be active and 'indent' will be disabled
[api/*.{kt,kts}]
disabled_rules=indent
ktlint_disabled_rules=indent
```
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ public object DefaultEditorConfigProperties : UsesEditorConfigProperties {
override val editorConfigProperties: List<UsesEditorConfigProperties.EditorConfigProperty<*>> = listOf(
codeStyleSetProperty,
disabledRulesProperty,
ktlintDisabledRulesProperty,
indentStyleProperty,
indentSizeProperty,
insertNewLineProperty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ internal class EditorConfigGeneratorTest {
"indent_style = space",
"insert_final_newline = true",
"ktlint_code_style = official",
"ktlint_disabled_rules = ",
"max_line_length = -1",
)
}
Expand Down

0 comments on commit 2ea18f0

Please sign in to comment.