source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.1.2'
...
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# ↓に追加
gem 'rubocop', require: false
# Rails向けの拡張で、Railsアプリケーション向けのコーディング規約をチェックする
gem 'rubocop-rails', require: false
# パフォーマンスをチェックする
gem 'rubocop-performance', require: false
end
...
...
# 注目するのは大文字のC
# 大文字のCは違反レベルで、レベルはC,R,F,E,Wとある。
# 修正の重要度としては、要修正(F,E,W) 修正の余地あり(C,R)となる。
# 違反レベルの後に続くエラー内容を確認し、修正を行う。
app/models/user.rb:37:7: C: [Correctable] Style/RedundantSelf: Redundant self detected.
self.posts
^^^^
# エラーの数
# 102ファイルをチェックし、50件の違反を確認。そのうち34件は自動修正可能という意味
102 files inspected, 50 offenses detected, 34 offenses autocorrectable