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

Add wrapper for KtLint rules #6037

Merged
merged 3 commits into from Apr 30, 2023
Merged

Add wrapper for KtLint rules #6037

merged 3 commits into from Apr 30, 2023

Conversation

atulgpt
Copy link
Contributor

@atulgpt atulgpt commented Apr 24, 2023

Fixes #5627

@github-actions
Copy link

github-actions bot commented Apr 24, 2023

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

Generated by 🚫 dangerJS against 3683844

@codecov
Copy link

codecov bot commented Apr 24, 2023

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.

@@ -309,8 +309,7 @@ naming:
active: false
allowedPattern: '^(is|has|are)'
ClassNaming:
active: true
classPattern: '[A-Z][a-zA-Z0-9]*'
active: false
Copy link
Member

Choose a reason for hiding this comment

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

Why this changed?

Copy link
Contributor Author

@atulgpt atulgpt Apr 24, 2023

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
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
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
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
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

detekt-formatting/src/main/resources/config/config.yml Outdated Show resolved Hide resolved
@3flex
Copy link
Member

3flex commented Apr 25, 2023

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
Copy link
Contributor Author

atulgpt commented Apr 25, 2023

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
21 checks passed
@detekt-ci

This comment was marked as off-topic.

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