Skip to content

Add wrapper for KtLint rules - #6037

Merged
cortinico merged 3 commits into
detekt:mainfrom
atulgpt:fixes/5627
Apr 30, 2023
Merged

cortinico merged 3 commits into
detekt:mainfrom
atulgpt:fixes/5627

Conversation

@atulgpt

@atulgpt atulgpt commented Apr 24, 2023

Copy link
Copy Markdown
Contributor

Fixes #5627

@github-actions

github-actions Bot commented Apr 24, 2023 •

Copy link
Copy Markdown
Warnings
⚠️ It looks like this PR contains functional changes without a corresponding test.

Generated by 🚫 dangerJS against 3683844

@codecov

codecov Bot commented Apr 24, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #6037 (53bd0f4) into main (9045cea) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 53bd0f4 differs from pull request most recent head 3683844. Consider uploading reports for the commit 3683844 to get more accurate results

@@             Coverage Diff              @@
##               main    #6037      +/-   ##
============================================
+ Coverage     84.84%   84.86%   +0.01%     
- Complexity     3944     3953       +9     
============================================
  Files           561      564       +3     
  Lines         13251    13266      +15     
  Branches       2313     2313              
============================================
+ Hits          11243    11258      +15     
  Misses          868      868              
  Partials       1140     1140              
Impacted Files Coverage Δ
...ab/arturbosch/detekt/formatting/KtLintMultiRule.kt 98.93% <100.00%> (+0.03%) ⬆️
...turbosch/detekt/formatting/wrappers/ClassNaming.kt 100.00% <100.00%> (ø)
...urbosch/detekt/formatting/wrappers/FunctionName.kt 100.00% <100.00%> (ø)
...urbosch/detekt/formatting/wrappers/PropertyName.kt 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

ClassNaming:
active: true
classPattern: '[A-Z][a-zA-Z0-9]*'
active: false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this changed?

@atulgpt atulgpt Apr 24, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that was my question. Ideally, it should not be changed but it got changed automatically after running generateDocumentation. This could be a bug in generateDocumentation as I have also added the ClassNaming rule from KtLint and there was one preexisting ClassNaming rule as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cortinico here my only concern which is not related to this PR is how we handle the same name rules, should generateDocumentation fail in cases like that? Or should we support the same name rules(if yes then when? Like should we allow the same name rules only when those are in different rule sections?) If we allow same name rules then the above change should also be addressed as generateDocumentation wrongly updates the wrong rules config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In other words, in detekt what is a unique identifier for a rule? Is this just rule name or combination of rule provider id and name?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how we handle the same name rules, should generateDocumentation fail in cases like that?

I think that's a bug and we should investigate here. Rules with same ID coudl occur, especially if coming from external packages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right now, I have reverted the unintentional change. I will create a separate issue for the bug

@3flex

3flex commented Apr 25, 2023

Copy link
Copy Markdown
Member

I believe these rules are all enabled by default in ktlint so to keep with convention we would enable them by default here too?

Or do we make an exception and keep them disabled when detekt has an equivalent rule

@atulgpt

atulgpt commented Apr 25, 2023

Copy link
Copy Markdown
Contributor Author

Or do we make an exception and keep them disabled when detekt has an equivalent rule

We should not make two different rules enabled. That can potentially cause problems due to conflicting analysis

@cortinico cortinico added this to the 1.23.0 milestone Apr 30, 2023
@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Apr 30, 2023
@cortinico
cortinico merged commit 1191dbf into detekt:main Apr 30, 2023
@detekt-ci

This comment was marked as off-topic.

This branch was successfully deployed

1 active deployment
Preview — 3683844c Deployed Apr 25, 2023 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

formatting notable changes Marker for notable changes in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add wrappers for new rules in ktlint 0.48

4 participants