require: rubocop-rails Rails/ActionControllerFlashBeforeRender: Enabled: true Rails/ActionControllerTestCase: Enabled: true Include: - '**/test/**/*.rb' Rails/ActionFilter: Enabled: true EnforcedStyle: action SupportedStyles: - action - filter Include: - app/controllers/**/*.rb - app/mailers/**/*.rb Rails/ActionOrder: Enabled: false ExpectedOrder: - index - show - new - edit - create - update - destroy Include: - app/controllers/**/*.rb Rails/ActiveRecordAliases: Enabled: true Rails/ActiveRecordCallbacksOrder: Enabled: true Include: - app/models/**/*.rb Rails/ActiveRecordOverride: Enabled: true Include: - app/models/**/*.rb Rails/ActiveSupportAliases: Enabled: true Rails/ActiveSupportOnLoad: Enabled: true Rails/AddColumnIndex: Enabled: true Include: - db/migrate/*.rb Rails/AfterCommitOverride: Enabled: true Rails/ApplicationController: Enabled: true Rails/ApplicationJob: Enabled: true Rails/ApplicationMailer: Enabled: true Rails/ApplicationRecord: Enabled: true Rails/ArelStar: Enabled: true Rails/AssertNot: Enabled: true Include: - '**/test/**/*' Rails/AttributeDefaultBlockValue: Enabled: true Include: - 'app/models/**/*' Rails/BelongsTo: Enabled: true Rails/Blank: Enabled: true # Convert usages of `nil? || empty?` to `blank?` NilOrEmpty: true # Convert usages of `!present?` to `blank?` NotPresent: true # Convert usages of `unless present?` to `if blank?` UnlessPresent: true Rails/BulkChangeTable: Enabled: true Database: null SupportedDatabases: - mysql - postgresql Include: - db/migrate/*.rb Rails/CompactBlank: Enabled: true Rails/ContentTag: Enabled: true # This `Exclude` config prevents false positives for `tag` calls to `has_one: tag` and Puma configuration: # https://puma.io/puma/Puma/DSL.html#tag-instance_method # No helpers are used in normal models and configs. Exclude: - app/models/**/*.rb - config/**/*.rb Rails/CreateTableWithTimestamps: Enabled: true Include: - db/migrate/*.rb Exclude: # Respect the `active_storage_variant_records` table of `*_create_active_storage_tables.active_storage.rb` # auto-generated by `bin/rails active_storage:install` even if `created_at` is not specified. - db/migrate/*_create_active_storage_tables.active_storage.rb Rails/DangerousColumnNames: Enabled: true Rails/Date: Enabled: true # The value `strict` disallows usage of `Date.today`, `Date.current`, # `Date#to_time` etc. # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc # (but not `Date.today`) which are overridden by ActiveSupport to handle current # time zone. EnforcedStyle: strict SupportedStyles: - strict - flexible AllowToTime: false Rails/DefaultScope: Enabled: true Rails/Delegate: Enabled: true # When set to true, using the target object as a prefix of the # method name without using the `delegate` method will be a # violation. When set to false, this case is legal. EnforceForPrefixed: true Rails/DelegateAllowBlank: Enabled: true Rails/DeprecatedActiveModelErrorsMethods: Enabled: true Rails/DotSeparatedKeys: Enabled: true Rails/DuplicateAssociation: Enabled: true Rails/DuplicateScope: Enabled: true Rails/DurationArithmetic: Enabled: true Rails/DynamicFindBy: Enabled: true # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead. Whitelist: - find_by_sql - find_by_token_for AllowedMethods: - find_by_sql - find_by_token_for AllowedReceivers: - Gem::Specification - page # Prevents a warning for `page.find_by_id`. See: https://github.com/rubocop/rubocop-rails/issues/778 Rails/EagerEvaluationLogMessage: Enabled: true Rails/EnumHash: Enabled: true Include: - app/models/**/*.rb Rails/EnumUniqueness: Enabled: true Include: - app/models/**/*.rb Rails/EnvLocal: Enabled: true Rails/EnvironmentComparison: Enabled: true Rails/EnvironmentVariableAccess: Enabled: true Include: - app/**/*.rb - lib/**/*.rb Exclude: - lib/**/*.rake AllowReads: false AllowWrites: false Rails/Exit: Enabled: true Include: - app/**/*.rb - config/**/*.rb - lib/**/*.rb Exclude: - lib/**/*.rake Rails/ExpandedDateRange: Enabled: true Rails/FilePath: Enabled: true EnforcedStyle: arguments SupportedStyles: - slashes - arguments Rails/FindBy: Enabled: true IgnoreWhereFirst: false Include: - app/models/**/*.rb - app/controllers/**/*.rb - app/helpers/**/*.rb Rails/FindById: Enabled: true Rails/FindEach: Enabled: true Include: [ ] AllowedMethods: # Methods that don't work well with `find_each`. - order - limit - select - lock AllowedPatterns: [ ] Rails/FreezeTime: Enabled: false Rails/HasAndBelongsToMany: Enabled: true Include: - app/models/**/*.rb Rails/HasManyOrHasOneDependent: Enabled: true Include: - app/models/**/*.rb Rails/HelperInstanceVariable: Enabled: true Include: - app/helpers/**/*.rb Exclude: - app/helpers/sessions_helper.rb Rails/HttpPositionalArguments: Enabled: true Include: - 'spec/**/*' - 'test/**/*' Rails/HttpStatus: Enabled: true EnforcedStyle: symbolic SupportedStyles: - numeric - symbolic Rails/I18nLazyLookup: Enabled: false Include: - 'app/controllers/**/*.rb' Rails/I18nLocaleAssignment: Enabled: true Include: - spec/**/*.rb - test/**/*.rb Rails/I18nLocaleTexts: Enabled: false Rails/IgnoredColumnsAssignment: Enabled: true Rails/IgnoredSkipActionFilterOption: Enabled: true Include: - app/controllers/**/*.rb - app/mailers/**/*.rb Rails/IndexBy: Enabled: true Rails/IndexWith: Enabled: true Rails/Inquiry: Enabled: true Rails/InverseOf: Enabled: true IgnoreScopes: false Include: - app/models/**/*.rb Rails/LexicallyScopedActionFilter: Enabled: true Include: - app/controllers/**/*.rb - app/mailers/**/*.rb Rails/LinkToBlank: Enabled: false Rails/MailerName: Enabled: true Include: - app/mailers/**/*.rb Rails/MatchRoute: Enabled: true Include: - config/routes.rb - config/routes/**/*.rb Rails/MigrationClassName: Enabled: true Include: - db/migrate/*.rb Rails/NegateInclude: Enabled: true Rails/NotNullColumn: Enabled: false Include: - db/migrate/*.rb Rails/OrderById: Enabled: false Rails/Output: Enabled: true Include: - app/**/*.rb - config/**/*.rb - lib/**/*.rb Exclude: - lib/generators/**/*.rb Rails/OutputSafety: Enabled: true Severity: info # Or warning Rails/Pick: Enabled: true Rails/Pluck: Enabled: true Rails/PluckId: Enabled: true Rails/PluckInWhere: Enabled: true EnforcedStyle: conservative SupportedStyles: - conservative - aggressive Rails/PluralizationGrammar: Enabled: true Rails/Presence: Enabled: true Rails/Present: Enabled: true # Convert usages of `!nil? && !empty?` to `present?` NotNilAndNotEmpty: true # Convert usages of `!blank?` to `present?` NotBlank: true # Convert usages of `unless blank?` to `if present?` UnlessBlank: true Rails/RakeEnvironment: Enabled: true Include: - '**/Rakefile' - '**/*.rake' Exclude: - 'lib/capistrano/tasks/**/*.rake' Rails/ReadWriteAttribute: Enabled: true Include: - app/models/**/*.rb Rails/RedundantActiveRecordAllMethod: Enabled: true Rails/RedundantAllowNil: Enabled: true Include: - app/models/**/*.rb Rails/RedundantForeignKey: Enabled: true Rails/RedundantPresenceValidationOnBelongsTo: Enabled: true Rails/RedundantReceiverInWithOptions: Enabled: true Rails/RedundantTravelBack: Enabled: true Include: - spec/**/*.rb - test/**/*.rb Rails/ReflectionClassName: Enabled: true Rails/RefuteMethods: Enabled: true EnforcedStyle: assert_not SupportedStyles: - assert_not - refute Include: - '**/test/**/*' Rails/RelativeDateConstant: Enabled: true Rails/RenderInline: Enabled: true Rails/RenderPlainText: Enabled: true # Convert only when `content_type` is explicitly set to `text/plain`. ContentTypeCompatibility: true Rails/RequestReferer: Enabled: true EnforcedStyle: referer SupportedStyles: - referer - referrer Rails/RequireDependency: Enabled: false Rails/ResponseParsedBody: Enabled: true Include: - spec/controllers/**/*.rb - spec/requests/**/*.rb - test/controllers/**/*.rb - test/integration/**/*.rb Rails/ReversibleMigration: Enabled: true Include: - db/**/*.rb Rails/ReversibleMigrationMethodDefinition: Enabled: true Include: - db/**/*.rb Rails/RootJoinChain: Enabled: true Rails/RootPathnameMethods: Enabled: true Rails/RootPublicPath: Enabled: true Rails/SafeNavigation: Enabled: true # This will convert usages of `try` to use safe navigation as well as `try!`. # `try` and `try!` work slightly differently. `try!` and safe navigation will # both raise a `NoMethodError` if the receiver of the method call does not # implement the intended method. `try` will not raise an exception for this. ConvertTry: true Rails/SafeNavigationWithBlank: Enabled: true # While the safe navigation operator is generally a good idea, when # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually # do the opposite of what the author intends. # # foo&.blank? #=> nil # foo.blank? #=> true Rails/SaveBang: Enabled: true AllowImplicitReturn: true AllowedReceivers: [ ]# Project specific Rails/SchemaComment: Enabled: false Rails/ScopeArgs: Enabled: true Include: - app/models/**/*.rb Rails/ShortI18n: Enabled: true EnforcedStyle: conservative SupportedStyles: - conservative - aggressive Rails/SelectMap: Enabled: true Rails/SkipsModelValidations: Enabled: true ForbiddenMethods: - decrement! - decrement_counter - increment! - increment_counter - insert - insert! - insert_all - insert_all! - toggle! - update_all - update_attribute - update_column - update_columns - update_counters - upsert - upsert_all AllowedMethods: - touch - touch_all Rails/SquishedSQLHeredocs: Enabled: false # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines # to be preserved in order to work, thus autocorrection is not safe. Rails/StripHeredoc: Enabled: true Rails/TableNameAssignment: Enabled: true Include: - app/models/**/*.rb Rails/TimeZone: Enabled: true # The value `strict` means that `Time` should be used with `zone`. # The value `flexible` allows usage of `in_time_zone` instead of `zone`. EnforcedStyle: flexible SupportedStyles: - strict - flexible Exclude: - '**/*.gemspec' Rails/TimeZoneAssignment: Enabled: true Include: - spec/**/*.rb - test/**/*.rb Rails/ThreeStateBooleanColumn: Enabled: true Include: - db/**/*.rb Rails/ToFormattedS: Enabled: true EnforcedStyle: to_fs SupportedStyles: - to_fs - to_formatted_s Rails/ToSWithArgument: Enabled: true Rails/TopLevelHashWithIndifferentAccess: Enabled: true Rails/TransactionExitStatement: Enabled: true Rails/UniqBeforePluck: Enabled: true EnforcedStyle: aggressive SupportedStyles: - conservative - aggressive Rails/UniqueValidationWithoutIndex: Enabled: true Include: - app/models/**/*.rb Rails/UnknownEnv: Enabled: true Environments: - development - test - staging - production Rails/UnusedIgnoredColumns: Enabled: true Include: - app/models/**/*.rb Rails/UnusedRenderContent: Enabled: true Rails/Validation: Enabled: true Include: - app/models/**/*.rb Rails/WhereEquals: Enabled: true Rails/WhereExists: Enabled: true EnforcedStyle: exists SupportedStyles: - exists - where Rails/WhereMissing: Enabled: true Rails/WhereNot: Enabled: true Rails/WhereNotWithMultipleConditions: Enabled: true