-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retrieve value from ".editorconfig" properties directly from ASTNode (#…
…1389) From the perspective of the Rule developer, simplify the retrieval of an ".editorconfig" property for the current ASTNode. By using the ASTNode as receiver, it is no longer needed to pass the "isAndroidCodeStyle" boolean as well. All logic regarding the determination of the actual value of the property is now defined as part of the definition of that property instead of being spread around multiple places in the ktlint code. Especially the handling of value "unset" (for properties max_line_length and indent_size) and "off" (property max_line_length) is now clearly centralized. This closes #1387. Property definitions indentStyleProperty, indentSizeProperty, insertNewLineProperty and maxLineLengthProperty are moved to the DefaultEditorConfigProperties as those properties are based on types provided by the ec4j library. Class IndentConfig now needs to be initialized based on the values of ".editorconfig" properties indentStyleProperty and indentSizeProperty. Although, this is less convenient, it is more explicit and consistent with how rules should interact with the ".editorconfig" properties. All rules provided by KtLint itself, now only use the interface UsesEditorConfigProperties to retrieve values for the ".editorconfig" property. As a result, the EditConfig became obsolete. It is marked for deletion in Ktlint 0.46.
- Loading branch information
1 parent
4079b94
commit 68990c8
Showing
17 changed files
with
522 additions
and
118 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
Oops, something went wrong.