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

Implement AlsoCouldBeApply Rule #5333

Merged
merged 10 commits into from Oct 4, 2022
Merged

Implement AlsoCouldBeApply Rule #5333

merged 10 commits into from Oct 4, 2022

Conversation

Tommyten
Copy link
Contributor

This pullrequest adds a rule to detect also blocks, which could be simplified by using an apply block, as discussed in #518.

Closes #518

@github-actions github-actions bot added the rules label Sep 22, 2022
@github-actions
Copy link

github-actions bot commented Sep 22, 2022

Messages
📖 Thanks for adding a new rule to Detekt ❤️

Generated by 🚫 dangerJS against 308e003

Copy link
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

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

Thanks to implement this rule! 5 years since it was proposed 😄. LGTM.

@3flex
Copy link
Member

3flex commented Sep 24, 2022

I think the rule name should be a little more specific, like AlsoCouldBeApply. I haven't reviewed, but thank you for the PR, this is a great contribution!

Copy link
Member

@TWiStErRob TWiStErRob left a comment

Choose a reason for hiding this comment

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

This looks like a nice rule, well done!

@cortinico cortinico added this to the 1.22.0 milestone Sep 25, 2022
Copy link
Member

@TWiStErRob TWiStErRob left a comment

Choose a reason for hiding this comment

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

I'm good, except pending conversations, @BraisGabin can you please look again?

@Tommyten Tommyten changed the title Implement MisusedAlso Rule Implement AlsoCouldBeApply Rule Sep 27, 2022
Copy link
Member

@TWiStErRob TWiStErRob left a comment

Choose a reason for hiding this comment

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

I had a dream about this, left 3 more comments :)

Copy link
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

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

I re-reviewed the PR and it looks great. Thanks for the reviews @TWiStErRob and the changes @Tommyten.

Copy link
Member

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

Great stuff! Just a minor nit

@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Oct 4, 2022
@cortinico cortinico enabled auto-merge (squash) October 4, 2022 13:24
@cortinico cortinico merged commit 24dce51 into detekt:main Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable changes Marker for notable changes in the changelog rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule: detect 'also' library function misuse instead of 'apply'
5 participants