A RuboCop extension focused on enforcing Rails best practices and coding conventions.
MIT License
Bot releases are visible (Hide)
Published by koic over 3 years ago
Rails/ReflectionClassName
when using class_name: to_s
. (@skryukov)Rails/FindBy
when calling #first
or #take
on a Range
object. (@johnsyweb)Rails/FindBy
when calling take
after block. (@koic)Rails/FindBy
when receiver is not an Active Record. (@nvasilevski)Published by koic over 3 years ago
Rails/ExpandedDateRange
cop. (@koic)Rails/UnusedIgnoredColumns
cop. (@pocke)Rails/HttpStatus
aware of head
method. (@koic)Rails/EagerEvaluationLogMessage
cop. (@aesthetikx)Rails/I18nLocaleAssignment
cop. (@koic)Rails/AddColumnIndex
cop. (@dvandersluis)Rails/RelativeDateConstant
when assigning (hashes/arrays/etc)-containing procs to a constant. (@jdelStrother)Rails/UniqueValidationWithoutIndex
when using a unique index and check_constraint
that has nil
first argument. (@koic)Rails/TimeZone
when setting EnforcedStyle: strict
and using Time.current
. (@koic)Rails/ReversibleMigrationMethodDefinition
when using cbase migration class. (@koic)Rails/DynamicFindBy
when using dynamic finder with hash argument. (@koic)Published by koic over 3 years ago
Published by koic over 3 years ago
Rails/ReversibleMigrationMethodDefinition
cop. (@leonp1991)Rails/RequireDependency
cop. (@tubaxenor)Rails/TimeZoneAssignment
cop. (@olivierbuffon)Rails/EnvironmentVariableAccess
cop. (@drenmi)Rails/LinkToBlank
when using target: '_blank'
with hash brackets for the option. (@koic)Rails/ContentTag
when the first argument is a splat argument. (@koic)Rails/BelongsTo
when using belongs_to
lambda block with required
option. (@koic)Rails/RelativeDateConstant
when a method is chained after a relative date method. (@koic)Rails/ContentTag
with nested content tags. (@tejasbubane)Rails/FindEach
when not inheriting ActiveRecord::Base
and using all.each
. (@koic)Rails/DynamicFindBy
when not inheriting ApplicationRecord
and without no receiver. (@koic)Rails/HasManyOrHasOneDependent
when specifying default dependent: nil
strategy. (@koic)Rails/HasManyOrHasOneDependent
aware of readonly?
is true
. (@koic)Rails/SafeNavigation
when using try!
without receiver. (@koic)Rails/SafeNavigation
with Style/RedndantSelf
. (@koic)Rails/ReversibleMigration
when using drop_table
with symbol proc. (@koic)Rails/WhereNot
. (@mobilutz)Rails/HasManyOrHasOneDependent
accept combination of association extension and with_options
. (@ohbarye)Rails/TimeZone
cop. (@koic)Rails/TimeZone
aware of timezone specifier. (@koic)IgnoredMethods
list for Lint/NumberConversion
to allow Rails' duration methods. (@dvandersluis)Rails/Blank
as unsafe auto-correction. (@koic)Rails/RelativeDateConstant
aware of yesterday
and tomorrow
methods. (@koic)Rails/WhereExists
as unsafe auto-correction. (@koic)Rails/WhereEquals
as unsafe auto-correction. (@koic)Rails/DynamicFindBy
as unsafe. (@koic)Rails/ReflectionClassName
as unsafe. (@koic)Rails/ReflectionClassName
aware of the use of string with to_s
. (@koic)Published by koic almost 4 years ago
Rails/FindEach
where config was ignored. (@ghiculescu)Rails/WhereEquals
using only named placeholder template without replacement argument. (@koic)Published by koic almost 4 years ago
Rails/WhereEquals
cop. (@eugeneius)Rails/AttributeDefaultBlockValue
cop. (@cilim)Rails/ArelStar
cop which checks for quoted literal asterisks in arel_table
calls. (@flanger001)IgnoredMethods
config option for Rails/FindEach
cop. (@tejasbubane)Rails/ActiveRecordCallbacksOrder
when callbacks have inline comments. (@fatkodima)Rails/UniqueValidationWithoutIndex
doesn't work in classes defined with compact style. (@sinsoku)Rails/NegateInclude
. (@koic)Rails/RedundantAllowNil
when using both allow_nil and allow_blank on different helpers of the same validator`. (@ngouy)Rails/SquishedSQLHeredocs
unsafe for autocorrection. (@tejasbubane)Published by koic about 4 years ago
Rails/AfterCommitOverride
on after_commit
with a lambda. (@pocke)Rails/UniqueValidationWithoutIndex
. (@Tietew)Rails/IndexBy
and Rails/IndexWith
when the each_with_object
hash is used in the transformed key or value. (@eugeneius)<>
operator to Rails/WhereNot
cop. (@Tietew)Rails/DynamicFindBy
when any of the arguments are splat argument. (@koic)Rails/ReversibleMigration
when keyword arguments of change_column_default
are in the order of to
, from
. (@koic)Published by koic about 4 years ago
Rails/SquishedSQLHeredocs
cop. (@mobilutz)Rails/AfterCommitOverride
cop. (@fatkodima)Rails/OrderById
cop. (@fatkodima)Rails/WhereNot
cop. (@fatkodima)Rails/HelperInstanceVariable
aware of memoization. (@koic)Rails/ReflectionClassName
cop false negative when relation had a scope parameter. (@bubaflub)Rails/UniqueValidationWithoutIndex
. (@krim)Rails/ActiveRecordCallbacksOrder
to preserve the original callback execution order. (@eugeneius)Rails/Inquiry
when #inquiry
's receiver is a variable. (@koic)Rails/ContentTag
autocorrect to handle html5 tag names with hyphens. (@jaredmoody)Rails/MailerName
as unsafe for auto-correct. (@eugeneius)Rails/ReversibleMigration
to register offenses for remove_columns
and remove_index
. (@philcoggins)EnforcedStyle
to Rails/PluckInWhere
. By default, it does not register an offense if pluck
method's receiver is a variable. (@koic)Rails/UniqBeforePluck
as unsafe auto-correction. (@kunitoo)Rails/IndexBy
and Rails/IndexWith
aware of to_h
with block. (@eugeneius)Rails/WhereExists
configurable to allow where(...).exists?
to be the preferred style. (@dvandersluis)Published by koic about 4 years ago
Rails/UnknownEnv
cop. (@taylorthurlow)Rails/RenderInline
error on variable key in render options. (@tejasbubane)Rails/MatchRoute
cop when via
option is a variable. (@tejasbubane)Published by koic about 4 years ago
Rails/FindById
cop. (@fatkodima)Rails/ActiveRecordCallbacksOrder
cop. (@fatkodima)Rails/RenderPlainText
cop. (@fatkodima)Rails/DefaultScope
cop. (@fatkodima)Rails/MatchRoute
cop. (@fatkodima)Rails/WhereExists
cop. (@fatkodima)Rails/RenderInline
cop. (@fatkodima)Rails/MailerName
cop. (@fatkodima)Rails/ShortI18n
cop. (@fatkodima)Rails/Inquiry
cop. (@fatkodima)Rails/PluckInWhere
cop. (@fatkodima)Rails/NegateInclude
cop. (@fatkodima)Rails/Pluck
cop. (@eugeneius)Rails/PluckId
cop. (@fatkodima)Rails/ContentTag
when content_tag
is called with options hash and block. (@fatkodima)Published by koic over 4 years ago
Rails/DynamicFindBy
. (@tejasbubane)Rails/RakeEnvironment
cop. (@tejasbubane)Rails/ContentTag
cop. (@tabuchi0919)Rails/Pick
cop. (@eugeneius)Rails/RedundantForeignKey
cop. (@eugeneius)Rails/SkipsModelValidations
when passing a boolean literal to touch
. (@eugeneius)Rails/IndexBy
when the .to_h
invocation is separated in multiple lines. (@diogoosorio)Rails/SaveBang
when update
is called on ENV
. (@eugeneius)Rails/FilePath
when the result of Rails.root.join
is interpolated at the end of a string. (@eugeneius)Rails/UniqBeforePluck
to not recommend using uniq
in ActiveRecord::Relation
s anymore since it was deprecated in Rails 5.0. (@santib, @ghiculescu)Published by koic over 4 years ago
Published by koic over 4 years ago
Rails/UniqueValidationWithoutIndex
when using conditions. (@sunny)Rails/UniqueValidationWithoutIndex
when using Expression Indexes. (@koic)Rails/UniqueValidationWithoutIndex
when a table has no column definition. (@koic)Rails/UniqueValidationWithoutIndex
aware of add_index
in db/schema.rb. (@koic)Rails/ApplicationController
, Rails/ApplicationJob
, Rails/ApplicationMailer
, and Rails/ApplicationRecord
as unsafe autocorrect. (@hoshinotsuyoshi)Published by koic over 4 years ago
Rails/UniqueValidationWithoutIndex
cop. (@pocke)Rails/IndexBy
and Rails/IndexWith
cops. (@djudd, @eugeneius)EnforcedStyle: refute
for Rails/RefuteMethods
cop. (@koic)HttpPositionalArguments
when using get
method with :to
option. (@koic)Rails/EnvironmentComparison
aware of Rails.env
is used in RHS or when !=
is used for comparison. (@koic)Rails/ReversibleMigration
aware of :to_table
option of remove_foreign_key
. (@joshpencheon)Rails/RakeEnvironment
when using Capistrano. (@sinsoku)Published by koic over 4 years ago
Published by koic almost 5 years ago
Published by koic almost 5 years ago
Rails/ApplicationController
and Rails/ApplicationMailer
cops. (@eugeneius)Rails/RakeEnvironment
cop. (@pocke)Rails/SafeNavigationWithBlank
cop. (@gyfis)Rails/SaveBang
when the save is in the body of a conditional. (@jas14)Rails/Presence
when using []
method. (@forresty)Rails/EnumHash
when using nested constants. (@koic)Rails/ReversibleMigration
when using change_default
with :from
and :to
options. (@sinsoku)Rails/ReversibleMigration
when using change_table_comment
or change_column_comment
with a :from
and :to
hash. (@DNA)Published by koic about 5 years ago
Published by koic about 5 years ago
Published by koic about 5 years ago
Rails/EnumHash
cop. (@fedeagripa, @brunvez, @santib)Rails/SaveBang
when implicitly return using finder method and creation method connected by ||
. (@koic)Rails/EnumUniqueness
. 1. When enum
name is not a literal. 2. When enum
has multiple definitions. (@santib)Rails/ActiveRecordAliases
as SafeAutoCorrect
false and disable autocorrect by default. (@prathamesh-sonpatki)Rails/SaveBang
as SafeAutoCorrect
false and disable autocorrect by default. (@prathamesh-sonpatki)create_or_find_by
in Rails/SaveBang
cop. (@MaximeLaurenty)