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

Style/CaseLikeIf add an option for X or more occurrances #11649

Closed
matthewhively opened this issue Mar 1, 2023 · 1 comment · Fixed by #11653
Closed

Style/CaseLikeIf add an option for X or more occurrances #11649

matthewhively opened this issue Mar 1, 2023 · 1 comment · Fixed by #11653

Comments

@matthewhively
Copy link

The Style/CaseLikeIf cop currently always flags any if/elsif sections that could be refactored to use case/when instead.
I would like the ability to restrict failures to if/elsif sections that have X or more branches.

It makes sense to my team that large blocks of if/elsif that have simple actions in each branch make sense to convert to case/when. But if there are only 2 branches, or if the code within each branch is a large block, it is clearer to keep it as if/elsif.

So additional options for the cop configuration would be welcome. For now we will be disabling this cop.

@fatkodima
Copy link
Contributor

Makes sense to me. There is a similar config option for Style/HashLikeCase cop. I will try to implement that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants