Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register missing ktlint_disabled_rules in editorConfigProperties #1671

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Calling this API with a file path results in the `.editorconfig` files that will
* 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