-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependencies on discouraged-comment-location rule (#2371)
Rule `discouraged-comment-location` intended to make implementation of rules easier. By disallowing those locations, the rules did not need to take them into accound. Disabling the `discouraged-comment-location` rule however also forced users to disable other rules as well (for example see #2338). With the number of rules that depended on `discouraged-comment-location` and the number of locations which were forbidden, this became more and more a useability problem for certain users. Disabling the `discouraged-comment-location` rule for one specific type of comment location was not possible. So only choiche was to disable the entire rule and all rules that depend on it. The `discouraged-comment-location` rule still exists to avoid a breaking change. But it no longer provides any functionality anymore. The logic of this rule has been moved to normal rule classes in case a discouraged comment location was added for one specific rule only. Comment locations that are more generic (e.g. used by at least two different rules) are moved to separate rules as this provides more clarity about rule dependencies. Rules below no longer depend on any other rule to handle disallowed comment location. If needed, the rules provide custom checks: * `chain-method-continuation` * `if-else-wrapping` New rules below are added to check for disallowed comment locations in constructs that are used by multiple rules: * `type-argument/type-argument-list` * `type-projection/type-parameter-list` * `value-argument/value-argument-list` * `value-parameter/value-parameter-list` Rules that previously relied explicitly or implicitly on the `discouraged-comment-location` rule now explicitly depend on rules above. If rules above are disabled, it is now more clear why a rule has a dependency on that rule as it is more specific. To provide above, following functionality was added as well: * Add utility methods `afterCodeSibling`, `beforeCodeSibling` and `betweenCodeSiblings` to ASTNodeExtensions * KtlintAssertThat now provides a more consistent interface for building rule assertion function which are depending on another rule. For some rules, the editorconfig properties regarding setting code style to `ktlint_official` have been removed as this code style is by default. Closes #2367
- Loading branch information
1 parent
fbd815f
commit 6b7f2b0
Showing
37 changed files
with
1,860 additions
and
1,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.