Merged
Conversation
📝 WalkthroughWalkthroughRuboCop設定をrequireからpluginsへ移行し、Gemのバージョン更新を行いました。複数箇所で明示的メソッドをRailsのdelegateに置き換え、テストのHTTPステータスアサーションを数値から記号へ変更し、未使用のダンプユーティリティを削除しました。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
744d400 to
3a028c4
Compare
6b091ff to
2d85cf2
Compare
2d85cf2 to
24b7378
Compare
f96289f to
671706a
Compare
Contributor
Author
|
@ryufuta |
Contributor
|
@tyrrell-IH |
ryufuta
approved these changes
Jan 29, 2026
Contributor
ryufuta
left a comment
There was a problem hiding this comment.
@tyrrell-IH
コミットと説明が丁寧でわかりやすかったです。
Approveします。
Contributor
Author
671706a to
977fb03
Compare
11 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
概要
RuboCopの拡張用Gemの読み込み方式を
requireからpluginsへ変更しました。それに合わせてRuboCopも最新のバージョン(
1.82.1参考)へアップデートし、RuboCop拡張
rubocop-minitestrubocop-capybararubocop-performancerubocop-railsもアップデートしました。変更確認方法
chore/migrate-rubocop-pluginsをローカルに取り込むbin/lintを実行しRuboCopの警告・エラー、slim-lintの警告・エラーが発生しないことを確認する。参考
以下にRuboCop導入手順等を載せておきます。
量が多いので必ず目を通してもらう必要はないですが、実装に疑問点があった際によかったら参照してください。
RuboCop導入手順
導入手順
1. parserのアップデート
RuboCopを最新の
1.82系にアップデートしようとするとparserの互換性の警告が出ます。なので最初にparserのバージョンを
3.3.7.2に指定しました。2. RuboCopのアップデート
GemfileにRuboCopのバージョンを
'~> 1.82'と指定してアップデートしました。バージョンを固定しなくても最新にはアップデートできると思いますが、意図せずバージョンが上がらないように今回は固定しました。
拡張Gemのアップデート
特にバージョン等を指定せずに
bundle update rubocop-minitest rubocop-capybara rubocop-performance rubocop-railsを実行してアップデートしました。
RuboCop(及び拡張Gem)のアップデートに伴い新たに発生した警告について
RuboCop及び拡張Gemのアップデートに伴い
bin/lint(bundle exec rubocopとbundle exec slim-lint)実行時、RuboCop関連の警告25件、slim-lint関連の警告3件、合計28件の追加の警告が発生しました。追加の警告
bundle exec rubocopbundle exec slim-lintリファレンスに従い修正し、以下の通りに動作確認しました。
動作確認を省略したものもあります
1. Rails/HttpStatus: 14件
警告
commit
27e1335
リファレンス
https://www.rubydoc.info/gems/rubocop/0.61.1/RuboCop/Cop/Rails/HttpStatus
動作確認
変更箇所は全てアサーションメソッドのexpectedの値だったので、
上記テストが問題なく通ることを確認しました。
2.Rails/Delegate: 4件
commit
8553b9e
リファレンス
https://www.rubydoc.info/gems/rubocop/0.41.2/RuboCop/Cop/Rails/Delegate
動作確認
2-1.
app/components/users/micro_reports/micro_report_component.rb:10:3警告↓
MicroReportComponent#comment_userに対する単体のテストなし。bootcamp/app/components/users/micro_reports/micro_report_component.html.slim
Line 8 in 90b5034
にて
comment_userを使用したリンクが正しく作成されているので、委譲処理が正しく動作していると判断しました。2-2.
app/models/customer.rb:4:3警告↓
Customer#retrieveに対する単体のテストなし。Customer#retrieveはbootcamp/app/models/user.rb
Lines 627 to 631 in e70c100
User#customer内にて使用されている。コンソール上で
user.customerを呼び出すとStripe::Customerオブジェクトが返ってくることを確認。delegateによってCustomer#retrieveからStripe::Customer.retrieveへの委譲処理が正しく動作していると判断しました。2-3.
app/models/subscription.rb:11:3警告↓
単体テストあり。
bootcamp/test/models/subscription_test.rb
Lines 6 to 9 in dedfce1
が問題なく通ることを確認しました。
2-4.
test/system/notification/assigned_as_checker_test.rb:15:3警告↓
テスト内で定義されている箇所の修正なので
が問題なく通ることを確認しました。
3. test/system/notification/assigned_as_checker_test.rb: 2件
警告
commit
09b38ac
f303952
リファレンス
https://www.rubydoc.info/gems/rubocop/0.41.2/RuboCop/Cop/Style/RedundantParentheses
動作確認
評価順が変わらないことはコードを見て判断できたため、動作確認は省略しました。
4. Layout/EmptyLinesAroundMethodBody: 1件
警告
commit
06a2900
リファレンス
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/EmptyLinesAroundMethodBody
動作確認
不要な空行を削除しただけなので、こちらも動作確認は省略しました。
5. Layout/IndentationWidth: 1件
警告
commit
8f3df07
リファレンス
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/IndentationWidth
動作確認
インデントの調整のみなので、こちらも動作確認は省略しました。
6. Layout/TrailingWhitespace: 1件
警告
commit
40304ef
リファレンス
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/TrailingWhitespace
動作確認
行末の不要な空白を削除しただけなので、動作確認は省略しました。
7. Rails/Output: 3件
警告
commit
5b0bedc
リファレンス
https://www.rubydoc.info/gems/rubocop-rails/RuboCop/Cop/Rails/Output
対応
2025/1/14 チーム開発ミーティング夜の部にて、駒形さんより「ファイル毎削除して良い」との回答を得たのでファイルを削除しました。
8. Style/MultipleComparison: 2件
commit
671706a
リファレンス
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/MultipleComparison
動作確認
8-1.
app/views/comments/_new_comment.html.slim:31警告↓
bootcamp/app/views/comments/_new_comment.html.slim
Lines 31 to 38 in 671706a
commentable_typeがReportもしくはProductの時に.card-main-actions__item.is-only-mentorクラスのボタンが表示されていることを確認しました。8-2.
app/views/practices/questions/index.html.slim:17警告↓
bootcamp/app/views/practices/questions/index.html.slim
Lines 12 to 23 in 671706a
クエリに
target=not_solvedもしくはtarget=solvedがついていた場合、「全ての質問ボタン」が非active状態になっていることを確認しました。Screenshot
内部的な修正のためスクリーンショットなし。
Summary by CodeRabbit
リリースノート
リファクタリング
依存関係
テスト
その他
✏️ Tip: You can customize this high-level summary in your review settings.