rubocop-rails.yml in gitlab-styles-4.3.0 vs rubocop-rails.yml in gitlab-styles-5.0.0
- old
+ new
@@ -1,14 +1,27 @@
+---
# Enables Rails cops.
Rails:
Enabled: true
# Enforces consistent use of action filter methods.
Rails/ActionFilter:
Enabled: true
EnforcedStyle: action
+# Checks that Active Record callbacks are declared in the order in which they will be executed.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsactiverecordcallbacksorder
+Rails/ActiveRecordCallbacksOrder:
+ Enabled: true
+
+# Enforces that there is only one call to after_commit
+# (and its aliases - after_create_commit, after_update_commit, and after_destroy_commit)
+# with the same callback name per model.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsaftercommitoverride
+Rails/AfterCommitOverride:
+ Enabled: true
+
# Check that models subclass ApplicationRecord.
Rails/ApplicationRecord:
Enabled: false
# Enforce using `blank?` and `present?`.
@@ -41,10 +54,16 @@
Enabled: true
Include:
- 'app/**/*.rb'
- 'lib/**/*.rb'
+# Enforces that ActiveRecord#find is used instead of where.take!, find_by!, and find_by_id!
+# to retrieve a single record by primary key when you expect it to be found.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsfindbyid
+Rails/FindById:
+ Enabled: true
+
# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
Enabled: true
# Prefer has_many :through to has_and_belongs_to_many.
@@ -55,10 +74,30 @@
# `put`, `patch` without the usage of keyword arguments in your tests and
# change them to use keyword args.
Rails/HttpPositionalArguments:
Enabled: true
+# Checks that Active Support’s inquiry method is not used.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsinquiry
+Rails/Inquiry:
+ Enabled: true
+
+# Enforces that mailer names end with Mailer suffix.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmailername
+Rails/MailerName:
+ Enabled: true
+
+# Identifies places where defining routes with match can be replaced with a specific HTTP method.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmatchroute
+Rails/MatchRoute:
+ Enabled: true
+
+# Enforces the use of collection.exclude?(obj) over !collection.include?(obj).
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsnegateinclude
+Rails/NegateInclude:
+ Enabled: true
+
# Checks for calls to puts, print, etc.
Rails/Output:
Enabled: true
Exclude:
- lib/gitlab/seeder.rb
@@ -69,10 +108,20 @@
# This cop checks for the use of output safety calls like html_safe and
# raw.
Rails/OutputSafety:
Enabled: false
+# Enforces the use of pluck over map.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluck
+Rails/Pluck:
+ Enabled: true
+
+# Identifies places where pluck is used in where query methods and can be replaced with select.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluckinwhere
+Rails/PluckInWhere:
+ Enabled: true
+
# Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar:
Enabled: true
# Enforce using `blank?` and `present?`.
@@ -85,16 +134,46 @@
# Do not assign relative date to constants.
Rails/RelativeDateConstant:
Enabled: false
+# Looks for inline rendering within controller actions.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderinline
+Rails/RenderInline:
+ Enabled: true
+
+# Identifies places where render text: can be replaced with render plain:.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderplaintext
+Rails/RenderPlainText:
+ Enabled: true
+
# Checks the arguments of ActiveRecord scopes.
Rails/ScopeArgs:
Enabled: true
+# Enforces that short forms of I18n methods are used: t instead of translate and l instead of localize.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsshorti18n
+Rails/ShortI18n:
+ Enabled: true
+
+# Checks SQL heredocs to use .squish.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railssquishedsqlheredocs
+Rails/SquishedSQLHeredocs:
+ Enabled: true
+
# This cop checks for the use of Time methods without zone.
Rails/TimeZone:
Enabled: false
# This cop checks for the use of old-style attribute validation macros.
Rails/Validation:
+ Enabled: true
+
+# Enforces consistent style when using exists?.
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswhereexists
+Rails/WhereExists:
+ Enabled: true
+
+# Identifies places where manually constructed SQL in where can be replaced with where.not(...).
+# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswherenot
+Rails/WhereNot:
Enabled: true