Skip to content

Releases: rubocop/rubocop-rails

RuboCop Rails 2.21.1

14 Sep 03:54
Compare
Choose a tag to compare

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)

RuboCop Rails 2.21.0

09 Sep 08:17
Compare
Choose a tag to compare

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)

RuboCop Rails 2.20.2

19 Jun 15:37
Compare
Choose a tag to compare

Bug fixes

  • #1028: Fix an error for Rails/UniqueValidationWithoutIndex when the presence: true option is used alone for the validates method. (@koic)

RuboCop Rails 2.20.1

19 Jun 08:05
Compare
Choose a tag to compare

Bug fixes

  • #1021: Fix an error for Rails/UniqueValidationWithoutIndex. (@ydah)

RuboCop Rails 2.20.0

18 Jun 08:14
Compare
Choose a tag to compare

New features

Bug fixes

  • #1005: Flag break in with_lock for Rails/TransactionExitStatement. (@splattael)
  • #997: Fix to Allow NotNullColumn to work with method calls and variables. (@fidalgo)
  • #989: Fix Rails/FilePath to detect offenses from complex string interpolation. (@r7kamura)
  • #1010: Fix Rails/ThreeStateBooleanColumn for dynamic tables/columns. (@fatkodima)
  • #1008: Fix UniqueValidationWithoutIndex to not detect offenses when a validation specifies uniqueness: false. (@samrjenkins)

Changes

  • #1011: Add *_create_active_storage_variant_records.active_storage.rb to Rails/CreateTableWithTimestamps exclude file list. (@tka5)
  • #995: Check for or method in Rails/FindEach cop. (@masato-bkn)
  • #1019: Change db migration file pattern so that it supports multiple db. (@r7kamura)
  • #986: (Breaking) Drop Ruby 2.6 support. (@koic)
  • #992: Exclude app/assets/**/* by default. (@r7kamura)
  • #1014: Make Lint/RedundantSafeNavigation aware of presence and present? methods. (@koic)
  • #1007: Support flash.now for Rails/I18nLocaleTexts. (@fatkodima)

RuboCop Rails 2.19.1

16 Apr 04:36
Compare
Choose a tag to compare

Bug fixes

  • #979: Fix an error for Rails/ThreeStateBooleanColumn when using t.boolean in drop_table. (@koic)

RuboCop Rails 2.19.0

07 Apr 04:00
Compare
Choose a tag to compare

New features

  • #337: Add new Rails/ThreeStateBooleanColumn cop. (@fatkodima)
  • #45: Make Rails/Delegate aware of self. (@koic)

Bug fixes

  • #934: Fix a false negative for Rails/Output when print methods without arguments. (@koic)
  • #99: Fix a false positive for Rails/HttpPositionalArguments when using include Rack::Test::Methods. (@koic)
  • #501: Fix a false positive for Rails/OutputSafety when using html_safe for I18n methods. (@koic)
  • #860: Fix a false positive for Rails/Pluck when using regexp literal key for String#[]. (@koic)
  • #938: Fix an error for Rails/WhereNotWithMultipleConditions when using where.not.lt(condition) as a Mongoid API'. (@koic)
  • #941: Remove redundant config for Style/InverseMethods. (@koic)

Changes

  • #299: Add autocorrection for Rails/ReflectionClassName. (@tejasbubane)
  • #34: Allow CreateTableWithTimestamps when using id: false and not include timestamps. (@koic)
  • #694: Mark Rails/FindEach as unsafe. (@koic)
  • #940: Mark Rails/ResponseParsedBody as unsafe. (@koic)

RuboCop Rails 2.18 (a.k.a. Ruby 30th Anniversary Edition)

25 Feb 08:56
Compare
Choose a tag to compare

New features

Bug fixes

  • #824: Fix a false negative for Rails/ActionControllerTestCase when the class is namespaced. (@vlad-pisanov)
  • #909: Fix a false positive for Rails/ActionControllerFlashBeforeRender when using flash before redirect_to in if branch. (@koic)
  • #898: Fix a false positive for Rails/ActiveRecordAliases when arguments of update_attributes is empty. (@koic)
  • #920: Fix an error for Rails/NegateInclude when there is no receiver. (@fatkodima)
  • #931: Fix error in Rails/Presence when ternary operators are used in multiple lines. (@r7kamura)
  • #687: Fix Rails/HasManyOrHasOneDependent to correctly handle association methods with receiver. (@fatkodima)
  • #929: Prevent Rails/SquishedSQLHeredocs applying when single-line comments are present. (@john-h-k)
  • #887: Fix a false positive for Rails/NotNullColumn when adding a :virtual column. (@fatkodima)
  • #918: Fix Rails/FreezeTime running against Rails < 5.2 apps. (@DRBragg)
  • #895: Fix Rails/UnusedIgnoredColumns not recognizing columns added via +=. (@lucthev)

Changes

  • #263: Accept actions defined via alias in Rails/LexicallyScopedActionFilter. (@fatkodima)
  • #902: Ignore redirect method for Style/FormatStringToken by default. (@javierjulio)
  • #935: Make Style/InverseMethods aware of Active Support's present?, blank?, include?, and exclude? methods. (@koic)
  • #914: Make Style/InverseMethods aware of valid? and invalid? methods. (@koic)
  • #826: Mark Rails/Pluck as unsafe. (@fatkodima)
  • #896: Raise severity of Rails/ActiveRecordOverride, Rails/DeprecatedActiveModelErrorsMethods, Rails/DuplicateAssociation, Rails/DuplicateScope, Rails/TopLevelHashWithIndifferentAccess, and Rails/WhereNotWithMultipleConditions cops to warning. (@koic)

RuboCop Rails 2.17.4

25 Dec 06:15
Compare
Choose a tag to compare

Bug fixes

  • #870: Fix an error for Rails/RootPathnameMethods when using Rails.env argument within Dir.glob. (@koic)
  • #881: Fix a false positive for Rails/ActionControllerFlashBeforeRender when using flash in multiline rescue branch before redirect_to. (@gurix)
  • #871: Fix a false positive for Rails/WhereMissing when left_joins(:foo) and where(foos: {id: nil}) separated by or, and. (@ydah)
  • #875: Make Rails/RootPathnameMethods aware of enforced style of Style/StringLiterals. (@koic)
  • #882: Fix false positive for Rails/UniqueValidationWithoutIndex with :conditions option. (@etiennebarrie)
  • #821: Enhance Rails/TimeZone to accept methods with the :in timezone option. (@fatkodima)

Changes

RuboCop Rails 2.17.3

20 Nov 06:34
Compare
Choose a tag to compare

% cat relnotes/v2.17.3.md

Bug fixes

  • #843: Fix a false positive for Rails/ActionControllerFlashBeforeRender when using flash in multiline if branch before redirect_to. (@koic)
  • #841: Fix an error for Rails/ActionOrder when using unconventional order of multiple actions. (@koic)
  • #838: Fix an incorrect autocorrect for Rails/ActionOrder when using unconventional order of actions in conditions. (@koic)
  • #867: Fix autocorrection bug when ::Hash is used on Rails/IndexBy and Rails/IndexWith. (@r7kamura)
  • #848: Fix a false positive for Rails/FreezeTime when using travel_to with an argument of Time.new(...).in_time_zone. (@koic)
  • #869: Fix false-positives that non Rails formats are offended on Rails/ToSWithArgument. (@r7kamura)
  • #866: Fix false-positives when constant is used with receiver on Rails/DurationArithmetic, Rails/IndexBy, Rails/IndexWIth, and Rails/RequireDependency. (@r7kamura)
  • #850: Fix default configuration for Rails/I18nLazyLookup. (@vlad-pisanov)
  • #837: Fix incorrect autocorrection of Rails/ActionOrder about comments. (@r7kamura)
  • #855: Fix Rails/RootPathnameMethods autocorrection for Pathname calls without parens. (@gsamokovarov)
  • #868: Support :: prefixed constants on Rails/ActionControllerFlashBeforeRender, Rails/ActionControllerTestCase, Rails/ApplicationController, Rails/ApplicationJob, Rails/ApplicationMailer, Rails/ApplicationRecord, Rails/DotSeparatedKeys, Rails/DynamicFindBy, Rails/FindEach, Rails/FreezeTime, Rails/HasManyOrHasOneDependent, Rails/HelperInstanceVariable, Rails/MailerName, Rails/MigrationClassName, Rails/Output, Rails/ReversibleMigrationMethodDefinition, Rails/ReversibleMigration, Rails/ShortI18n, Rails/SkipsModelValidations, and Rails/TimeZoneAssignment. (@r7kamura)
  • #865: Support ::Rails and ::File on Rails/FilePath cop. (@r7kamura)

Changes

  • #862: Ignore if number of arguments does not match on Rails/DynamicFindBy. (@r7kamura)