前提・実現したいこと
rails初心者でrailsチュートリアルを終了したファイルにrubocop-airbnbの追加をしようとしております
現在81 offensesが発生しており、この修正をしたいです
ここに質問の内容を詳しく書いてください。
いくつかqiitaのサイトで調べた結果
Missing top-level class documentation comment.のエラーに対して
rubocop.ymlにて
Style/Documentation:
Enabled: false
の設定を追加してもエラーが発生したままなので解決できずに困っております。
その他たくさんのエラーメッセージが出ているのでエラーメッセージに対しての無効化の設定方法などあれば教えて頂きたいです。
発生している問題・エラーメッセージ
エラーメッセージ app/mailers/application_mailer.rb:3:1: C: Style/Documentation: Missing top-level class documentation comment. class ApplicationMailer < ActionMailer::Base app/models/micropost.rb:5:3: C: Airbnb/DefaultScope: Avoid default_scope. Default scopes make it difficult to refactor data access patterns since the scope becomes part of every query unless explicitly excluded, even when it is unnecessary or incidental to the desired logic. default_scope -> { order(created_at: :desc) } app/models/micropost.rb:14:5: C: Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression. if picture.size > 5.megabytes
あまりにも多くのエラーがあるので一部抜粋としてさせていただきました。
該当のソースコード
rails
1ファイル名:rubocop.yml 2 3inherit_from: 4 - .rubocop_airbnb.yml 5 6 Rails: 7 Enabled: true 8 9LineLength: 10 Max: 130 11 12 13AllCops: 14 Exclude: 15 - 'db/**/*' 16 - 'bin/*' 17 - 'config/**/*' 18 - 'lib/tasks/*' 19 - 'vendor/**/*' 20 - 'path/ruby' 21 22 23Style/Documentation: 24 Enabled: false 25 26 27Style/StringLiterals: 28 Enabled: false 29 30Metrics/LineLength: 31 Enabled: false 32
rails
1ファイル名:rubocop-airbnb.yml 2 require: 3 - rubocop-airbnb
試したこと
上述した通りです
補足情報(FW/ツールのバージョンなど)
プログラミング初心者、teratail初投稿なので至らない点が多々あると思うのですが何卒お願い致します
あなたの回答
tips
プレビュー