A RuboCop extension focused on enforcing Rails best practices and coding conventions.
MIT License
Bot releases are visible (Hide)
Published by koic almost 2 years ago
Rails/HttpStatus
cop to check routes.rb
" introduced in 2.17.0. (@jdufresne)Rails/Pluck
when using block argument in []
. (@koic)Published by koic almost 2 years ago
Rails/ActionOrder
cop. (@mollerhoj)Rails/IgnoredColumnsAssignment
cop. (@fsateler, @kkitadate)Style/HashExcept
aware of TargetRubyVersion: 2.x because Rails has Hash#except
. (@koic)Rails/ActionControllerTestCase
when extending ActionController::TestCase
and having a method definition. (@koic)Rails/RedundantPresenceValidationOnBelongsTo
when belongs_to at least one block and one hash like belongs_to :company, -> { where(foo: true) }, inverse_of: :employee
. (@PedroAugustoRamalhoDuarte)Rails/DynamicFindBy
aware of find_by_token_for
. (@koic)Rails/FreezeTime
when using travel_to
without argument. (@koic)Rails/RedundantReceiverInWithOptions
when calling a method with a receiver in with_options
without block arguments. (@koic)Rails/EagerEvaluationLogMessage
when using Style/MethodCallWithArgsParentheses
's autocorrection together. (@koic)Rails/Presence
when using arithmetic operation in else
branch. (@koic)tag
is investigated by Rails/ContentTag
. (@r7kamura)Rails/ActionControllerFlashBeforeRender
when render
call precedes flash
call. (@americodls)Rails/DynamicFindBy
when using page.find_by_id
as a Capybara testing API. (@koic)Rails/Presence
when a right-hand side of the relational operator. (@ydah)mail
to AllowedMethods
of Style/SymbolProc
. (@koic)Exclude
to prevent slow investigation. (@koic)Rails/HttpStatus
cop to check routes.rb
. (@anthony-robin)Rails/Pluck
aware of all keys. (@koic)Rails/TimeZone
aware of timezone UTF offset. (@inkstak)Published by koic about 2 years ago
Rails/FreezeTime
when using travel_to
with an argument of DateTime.new
with arguments. (@koic)Rails/TopLevelHashWithIndifferentAccess
when using HashWithIndifferentAccess
under namespace module. (@koic)Rails/FreezeTime
when using travel_to
with an argument of current
method without receiver. (@koic)Rails/FreezeTime
when using travel_to
with an argument of the current time and proc argument. (@koic)Rails/RootPathnameMethods
as unsafe and fix an incorrect autocorrect when using Dir.glob
. (@koic)Published by koic about 2 years ago
Rails/FreezeTime
cop. (@ydah)Rails/WhereMissing
cop. (@ydah)Rails/RootPathnameMethods
cop. (@leoarnold)Rails/TopLevelHashWithIndifferentAccess
cop. (@r7kamura)Rails/ActionControllerFlashBeforeRender
cop. (@americodls)Rails/ActiveSupportOnLoad
cop. (@bdewater)Rails/ToSWithArgument
cop. (@r7kamura)ActiveSupportExtensionsEnabled
option by default. (@koic)Rails/ReflectionClassName
when using Ruby 3.1's hash shorthand syntax. (@koic)errors.details[:name] << value
in Rails/DeprecatedActiveModelErrorsMethods. (@BrianHawley)values
, to_h
, and to_xml
methods. (@BrianHawley)errors.keys
in a model in Rails/DeprecatedActiveModelErrorsMethods. (@BrianHawley)Rails/CompactBlank
bug when offense is found in block. (@r7kamura)rubocop --show-docs-url
. (@r7kamura)Rails/RedundantReceiverInWithOptions
and Rails/ReversibleMigration
cops aware of numbered block parameter. (@koic)Published by koic over 2 years ago
Rails/Delegate
when preceding nested class declares private or protected methods. (@Darhazer)Rails/DeprecatedActiveModelErrorsMethods
when using keys
method with Rails 6.0. (@koic)Rails/ExpandedDateRange
aware beginning_of_week
with an argument. (@koic)Rails/StripHeredoc
. (@kazarin)Published by koic over 2 years ago
Rails/AttributeDefaultBlockValue
. (@kkitadate)Rails/DeprecatedActiveModelErrorsMethods
when root receiver is a variable. (@koic)Rails/FormattedS
when using safe navigation operator. (@koic)Rails/DotSeparatedKeys
when a key starts with dot. (@koic)Published by koic over 2 years ago
Rails/DotSeparatedKeys
cop. (@fatkodima)Rails/StripHeredoc
cop. (@koic)Rails/ToFormattedS
cop. (@koic)Rails/RootPublicPath
cop. (@leoarnold)keys
method aware of Rails/DeprecatedActiveModelErrorsMethods
cop. (@koic)Rails/DeprecatedActiveModelErrorsMethods
. (@koic)Rails/TransactionExitStatement
when return
is used in rescue
. (@koic)Rails/FilePath
when a list of paths separated by colon including Rails.root. (@tk0miya)Rails/ReversibleMigrationMethodDefinition
when using an inner class. (@koic)Rails/UnusedIgnoredColumns
when using no tables db/schema.rb. (@koic)in_rescue?
check would bypass situations where the return was inside a transaction but outside of a rescue. (@dorkrawk)Rails/DuplicateAssociation
. (@ydah)TargetRubyVersion: 2.2
. (@koic)Published by koic over 2 years ago
Rails/MigrationClassName
when defining another class. (@koic)Rails/MigrationClassName
when ActiveSupport::Inflector
is applied to the class name and the case is different. (@koic)Rails/TransactionExitStatement
when break
is used in loop
in transactions. (@koic)Rails/TransactionExitStatement
when transaction block is empty. (@koic)Rails/TransactionExitStatement
when return
or throw
is used in a block in transactions. (@Tietew)Rails/TransactionExitStatement
when return
is used in rescue
. (@koic)Published by koic over 2 years ago
Published by koic over 2 years ago
Rails/I18nLocaleTexts
cop. (@fatkodima)Rails/I18nLazyLookup
cop. (@fatkodima)Rails/MigrationClassName
cop. (@johnny-miyake)Rails/DuplicateAssociation
cop. (@natematykiewicz)Rails/DuplicateScope
cop. (@natematykiewicz)Rails/TransactionExitStatement
to disallow return
, break
and throw
in transactions. (@teckwan)Rails/DeprecatedActiveModelErrorsMethods
cop. (@lulalala)Rails/ActionControllerTestCase
cop. (@gmcgibbon)Rails/TableNameAssignment
cop. (@MaximeDucheneS)Rails/ContentTag
when using tag
method in config/puma.rb. (@koic)t.remove
with multiple columns in Rails/BulkChangeTable
. (@eugeneius)Published by koic almost 3 years ago
IgnoreScopes
config option for Rails/InverseOf
cop. (@composerinteralia)Rails/RedundantPresenceValidationOnBelongsTo
using presence with a message. (@koic)Rails/CompactBlank
when using the receiver of blank?
is not a block variable. (@koic)month(s)
and year(s)
to Rails/DurationArithmetic
cop. (@agrobbin)Rails/ReadWriteAttribute
cop. (@nvasilevski)Rails/RedundantPresenceValidationOnBelongsTo
to SafeAutoCorrect: false
. (@TonyArra)ReversibleMigration
and ReversibleMigrationMethodDefinition
cops. (@fatkodima)Published by koic almost 3 years ago
Rails/UnusedIgnoredColumns
cop. (@tachyons)Rails/RedundantPresenceValidationOnBelongsTo
cop. (@pirj)Rails/RedundantPresenceValidationOnBelongsTo
cop. (@pirj)Published by koic almost 3 years ago
Rails/RootJoinChain
cop. (@leoarnold)Rails/DurationArithmetic
cop. (@pirj)Rails/RedundantPresenceValidationOnBelongsTo
cop. (@pirj)Rails/SchemaComment
cop. (@vitormd)change_column
check to Rails/ReversibleMigration
. (@mattmccormick)remove_reference
check to Rails/ReversibleMigration
. (@mattmccormick)Rails/TimeZone
as unsafe auto-correction from unsafe. (@koic)AutoCorrect: false
from Rails/RelativeDateConstant
. (@koic)AutoCorrect: false
from Rails/UniqBeforePluck
. (@koic)Published by koic about 3 years ago
Published by koic about 3 years ago
Rails/ContentTag
when using using the tag
method with 3 or more arguments. (@koic)Rails/FindEach
when using model.errors.where
in Rails 6.1. (@koic)Rails/ContentTag
when tag
is not a top-level method. (@koic)Rails/RelativeDateConstant
when using multiple assignment. (@koic)Rails/ReversibleMigration
when using t.remove
with type
option in Rails 6.1. (@koic)app/models
by default for Rails/ContentTag
. (@koic)Rails/CreateTableWithTimestamps
respect active_storage_variant_records
table of db/migrate/*_create_active_storage_tables.active_storage.rb
auto-generated by bin/rails active_storage:install
even if created_at
is not specified. (@koic)Published by koic about 3 years ago
Published by koic about 3 years ago
Published by koic about 3 years ago
Rails/Output
. (@koic)Rails/ScopeArgs
. (@koic)Rails/RedundantTravelBack
cop. (@koic)Rails/HasManyOrHasOneDependent
when specifying :dependent
strategy with double splat. (@koic)Rails/LexicallyScopedActionFilter
when action method is aliased by alias_method
. (@koic)Rails/HttpPositionalArguments
when defining get
in Rails.application.routes.draw
block. (@koic)Rails/ContentTag
from content_tag
method to tag
method. (@tabuchi0919)Published by koic over 3 years ago
Rails/UniqueValidationWithoutIndex
when validating uniqueness with a polymorphic scope. (@theunraveler)Published by koic over 3 years ago