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-20221003233959 #795

Merged
merged 4 commits into from
Jan 16, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 3, 2022

Rubocop challenge!

Style/CaseLikeIf

Safe autocorrect: No
⚠️ The autocorrect a cop can yield false positives by design.

Description

Overview

Identifies places where if-elsif constructions
can be replaced with case-when.

Examples

# bad
if status == :active
  perform_action
elsif status == :inactive || status == :hibernating
  check_timeout
else
  final_action
end

# good
case status
when :active
  perform_action
when :inactive, :hibernating
  check_timeout
else
  final_action
end

Auto generated by rubocop_challenger

@mathieujobin
Copy link
Collaborator

@PanosCodes An opinion on this ?

@PanosCodes
Copy link
Contributor

I like it, changes at a146126 make the code more readable 🤓

@mathieujobin mathieujobin merged commit bbbe5d3 into master Jan 16, 2023
@mathieujobin mathieujobin deleted the rubocop-challenge/20221003233959 branch January 16, 2023 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants