Rubocop Rails Versions Save

A RuboCop extension focused on enforcing Rails best practices and coding conventions.

v2.24.1

1 month ago

Bug fixes

  • #1244: Fix a false positive for Rails/ActionControllerFlashBeforeRender when returning redirect_to. (@earlopain)
  • #1255: Fix an error for Rails/UniqBeforePluck with EnforcedStyle: aggressive when no receiver. (@earlopain)
  • #1247: Fix an error for Rails/UnusedIgnoredColumns when without tables in db/schema.rb. (@koic)
  • #1253: Fix an error for Rails/WhereMissing with leading where without receiver. (@earlopain)
  • #1254: Fix an error for Rails/ExpandedDateRange when passing an argument only to the first method call for weeks. (@earlopain)
  • #1256: Fix an error for Rails/ActiveSupportOnLoad when calling without arguments. (@earlopain)
  • #1230: Fix a false positive for Rails/SaveBang if persisted? is checked on parenthesised expression. (@earlopain)
  • #1200: Make Rails/TimeZone aware of safe navigation. (@earlopain)

Changes

  • #1257: Add Rails 7.1 load hooks and active_record_sqlite3adapter to Rails/ActiveSupportOnLoad. (@earlopain)

v2.24.0

2 months ago

New features

  • #1245: Support Prism as a Ruby parser (experimental). (@koic)

Bug fixes

  • #1234: Fix an incorrect autocorrect for Rails/FindBy when using multi-line leading dot method calls. (@ymap)
  • #1241: Fix an error for Rails/WhereExists with EnforcedStyle: where and implicit receivers. (@earlopain)

Changes

  • #1229: Make Rails/EnvironmentVariableAccess aware of initializers. (@markokajzer)
  • #1231: Remove object_id from Rails/DangerousColumnNames targets. (@r7kamura)

v2.23.1

4 months ago

Bug fixes

  • #1221: Fix an exception in Rails/WhereNot when calling .where on an implicit receiver (e.g. inside model code). (@bquorning)

v2.23.0

4 months ago

New features

Bug fixes

  • #1206: Fix an error for Rails/WhereMissing where join method is called without arguments. (@fatkodima)
  • #1189: Fix false negatives for Rails/Pluck when using safe navigation method calls. (@koic)
  • #1204: Make Rails/ActiveSupportAliases, Rails/FindBy, Rails/FindById, Rails/Inquiry, Rails/Pick Rails/PluckId, Rails/PluckInWhere, Rails/WhereEquals, Rails/WhereExists, and Rails/WhereNot cops aware of safe navigation operator. (@koic)

Changes

  • #1213: Update Rails/PluckInWhere to check for .ids call. (@fatkodima)
  • #1181: Support Nokogiri::HTML.parse and Nokogiri::HTML5.parse on Rails/ResponseParsedBody. (@r7kamura)
  • #1198: Support where.not for Rails/PluckInWhere. (@fatkodima)

v2.22.2

5 months ago

Bug fixes

  • #1172: Fix an error for Rails/UnknownEnv when using Rails 7.1. (@koic)
  • #1173: Fix an error for Rails/RedundantActiveRecordAllMethod cop when used with RuboCop 1.51 or lower. (@koic)

Changes

  • #1171: Change Rails/RedundantActiveRecordAllMethod to ignore delete_all and destroy_all when receiver is an association. (@masato-bkn)
  • #1178: Require RuboCop AST 1.30.0+. (@koic)

v2.22.1

6 months ago

Bug fixes

  • #1168: Fix a false positive for Rails/DuplicateAssociation when using duplicate belongs_to associations of same class without other arguments. (@koic)

v2.22.0

6 months ago

New features

  • #906: Add Rails/EnvLocal cop. (@sambostock)
  • #1128: Make Rails/DuplicateAssociation aware of duplicate class_name. (@koic)
  • #1157: Support some Rails 7.1's new querying methods for Rails/RedundantActiveRecordAllMethod. (@koic)
  • #1147: Support the Trilogy adapter for MySQL. (@koic)

Bug fixes

  • #952: Fix a false positive for Rails/NotNullColumn when using null: false for MySQL's TEXT type. (@koic)
  • #1041: Fix a false positive for Rails/Output when output method is called with block argument. (@koic)
  • #1143: Fix an error for Rails/RedundantActiveRecordAllMethod when using RuboCop 1.51 or lower. (@koic)
  • #1105: Fix false positives for Rails/RedundantPresenceValidationOnBelongsTo when using validates with :if or :unless options. (@koic)
  • #1158: Rails/HasManyOrHasOneDependent does not add offence when has_many or has_one is called on an explicit receiver. (@samrjenkins)
  • #1160: Fix Rails/SaveBang to ignore parenthesis. (@fatkodima)

Changes

  • #1152: Add more dangerous column names to Rails/DangerousColumnNames. (@r7kamura)
  • #1039: Deprecate Rails/ActionFilter cop; it will be disabled by default. (@koic)
  • #893: Support local as an environment for Rails/UnknownEnv from Rails 7.1 onward. (@ghiculescu)

v2.21.2

7 months ago

Bug fixes

  • #1126: Fix a false positive for Rails/RedundantActiveRecordAllMethod when using some Enumerable's methods with block argument. (@koic)
  • #1121: Fix an error for Rails/SelectMap when using select(:column_name).map(&:column_name) without receiver model. (@koic)
  • #1119: Fix an incorrect autocorrect for Rails/RedundantActiveRecordAllMethod when all has parentheses. (@masato-bkn)
  • #1130: Fix crash for Rails/UniqueValidationWithoutIndex with bare validate. (@jamiemccarthy)
  • #1124: Fix false positives for Rails/RedundantActiveRecordAllMethod when receiver is not an Active Record model. (@koic)

v2.21.1

7 months ago

Bug fixes

  • #1108: Fix an incorrect autocorrect for Rails/TimeZone when using String#to_time. (@koic)
  • #1109: Fix error for Rails/RedundantActiveRecordAllMethod when all is an argument for AR methods. (@masato-bkn)
  • #1110: Fix false positive for Rails/RedundantActiveRecordAllMethod when all has any parameters. (@masato-bkn)

v2.21.0

7 months ago

New features

  • #1075: Add new Rails/SelectMap cop that checks for uses of select(:column_name) with map(&:column_name). (@koic)
  • #158: Add Rails/DangerousColumnNames cop. (@r7kamura)
  • #1072: Add TransactionMethods config for Rails/TransactionExitStatement to detect custom transaction methods. (@marocchino)
  • #967: Add new Rails/UnusedRenderContent cop. (@samrjenkins)
  • #1052: Add explicit style to Rails/I18nLazyLookup. (@sunny)
  • #1016: Add new Rails/RedundantActiveRecordAllMethod cop. (@masato-bkn)

Bug fixes

  • #1078: Fix a false negative for Rails/LexicallyScopedActionFilter when no methods are defined. (@vlad-pisanov)
  • #1060: Fix a false positive for Rails/HttpStatus when using symbolic value that have no numeric value mapping. (@koic)
  • #1004: Fix a false-positive for Rails/RootPathnameMethods on Ruby 2.4 or lower. (@r7kamura)
  • #1066: Fix an error for Rails/FilePath when string interpolated Rails.root is followed by a message starting with .. (@koic)
  • #1049: Fix an incorrect autocorrect for Rails/FilePath when File.join with Rails.root and path starting with /. (@ydah)
  • #1045: Fix an incorrect autocorrect for Rails/NegateInclude when using Style/InverseMethods's autocorrection together. (@koic)
  • #1062: Fix autocorrection for Rails/RakeEnvironment when rake task accepts arguments. (@fastjames)
  • #1036: Fix an error for UniqueValidationWithoutIndex when db/schema.rb is empty. (@fatkodima)
  • #1042: Fix no offences for Rails/SchemaComment when create_table with multi t columns. (@nipe0324)

Changes

  • #1056: Fix database adapter detection for nested config. (@mjankowski)
  • #1031: Make Lint/SafeNavigationChain allow presence_in. (@koic)
  • #1080: Make Rails/HttpStatus aware of string number status. (@r7kamura)
  • #1094: Make Rails/TimeZone aware of String#to_time. (@koic)
  • #1015: Make Style/InvertibleUnlessCondition aware of Active Support methods. (@koic)
  • #903: Read database config for Rails/BulkChangeTable from environment variable. (@joergschiller)
  • #1058: Relax Include path for Rails/FindBy and Rails/FindEach. (@koic)
  • #994: Restrict DuplicateAssociation cop to ActiveRecord. (@mjankowski)