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

Update ktlint to v0.48.0 #5625

Merged
merged 8 commits into from Dec 17, 2022
Merged

Update ktlint to v0.48.0 #5625

merged 8 commits into from Dec 17, 2022

Conversation

3flex
Copy link
Member

@3flex 3flex commented Dec 16, 2022

There are three new rules that I haven't added wrappers for, since we seem to have the same ones in detekt already:

  • Class naming
  • Function naming
  • Property naming

Also had to disable NoSemicolons rule on detekt's codebase because of pinterest/ktlint#1733 but I'm sure that will be fixed soon. When this is merged I'll open a tracking issue for that.

@@ -78,21 +77,20 @@ abstract class FormattingRule(config: Config) : Rule(config) {
this.root = root
positionByOffset = KtLintLineColCalculator
.calculateLineColByOffset(KtLintLineColCalculator.normalizeText(root.text))
root.node.putUserData(KtLint.FILE_PATH_USER_DATA_KEY, root.name)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value isn't read by any ktlint rules that we have wrappers for, so removing this line has no effect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This key is going to be removed anyway

// TODO: Remove in KtLint 0.49
                rootNode.putUserData(KtLint.FILE_PATH_USER_DATA_KEY, code.filePath.toString())

@@ -77,6 +79,8 @@ formatting:
active: true
MaximumLineLength:
active: false
NoSemicolons:
active: false # https://github.com/pinterest/ktlint/issues/1733
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to fast-follow on this since this is being addressed in Ktlint 0.48.1 according to the comments.

@@ -78,21 +77,20 @@ abstract class FormattingRule(config: Config) : Rule(config) {
this.root = root
positionByOffset = KtLintLineColCalculator
.calculateLineColByOffset(KtLintLineColCalculator.normalizeText(root.text))
root.node.putUserData(KtLint.FILE_PATH_USER_DATA_KEY, root.name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This key is going to be removed anyway

// TODO: Remove in KtLint 0.49
                rootNode.putUserData(KtLint.FILE_PATH_USER_DATA_KEY, code.filePath.toString())

@chao2zhang
Copy link
Member

There are three new rules that I haven't added wrappers for, since we seem to have the same ones in detekt already:

Class naming
Function naming
Property naming

I believe Detekt implementation for these rules is more flexible (Since ktlint is mostly on/off with limited configurability), hence I believe we should still add a wrapper rule for them (There can be cases where Detekt users turn off the detekt implementation and use ktlint). This can be a discussion / follow-up

@3flex 3flex merged commit 774468c into detekt:main Dec 17, 2022
@3flex 3flex deleted the ktlint-0.48.0 branch December 17, 2022 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file formatting rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants