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

rubocop: resolve Performance/RegexpMatch, Style/SoleNestedConditional, and Style/CaseEquality #1783

Merged
merged 3 commits into from
Jan 10, 2022

Conversation

takahashim
Copy link
Collaborator

rubocopのPerformance/RegexpMatch, Style/SoleNestedConditional, Style/CaseEqualityについて対応します。

Performance/RegexpMatch=~ではなくmatch?を使うと早い&キャプチャを使わないのが明確化できる、というものです。
Style/SoleNestedConditionalはif等のネストをflatにするものですが、confirmは例外的にネストにさせています。
Style/CaseEqualityもコメントで抑制しただけです(IntegerとRangeをうまいことまとめているため)。

@kmuto
Copy link
Owner

kmuto commented Jan 10, 2022

👍
match? 慣れない感じがしますが、怒られながら覚えます!

@takahashim
Copy link
Collaborator Author

match?はコードを読む際も「ここはキャプチャは無視していいんだな」というのが分かるので理解しやすくリーダビリティが高まるため、個人的にもおすすめなのでした。

@takahashim
Copy link
Collaborator Author

というわけでマージしておきます

@takahashim takahashim merged commit ae044c9 into master Jan 10, 2022
@takahashim takahashim deleted the rubocop-Performance-RegexpMatch branch January 10, 2022 07:47
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 this pull request may close these issues.

None yet

2 participants