require: - rubocop-rails - rubocop-rspec - ./custom_cops/nxt_core/rails/use_of_rails_logger.rb - ./custom_cops/nxt_core/rails/missing_logger_include.rb inherit_mode: merge: - Exclude - Include Rails/UseOfRailsLogger: Description: "Custom Getsafe cop to ensure the correct logger is used" Rails/MissingLoggerInclude: Description: "Custom Getsafe cop to find missing `include` statements when using our custom logger" SafeAutoCorrect: false AllCops: Exclude: - bin/guard - bin/rspec - bin/rubocop - bin/setup - config.ru - db/schema.rb - db/migrate/* - vendor/**/* - node_modules/**/* DisabledByDefault: false NewCops: disable # to avoid warnings. TODO: remove this setting and add new cops from the warning. # A bunch of these layout cops are enabled by default, # but for some reason 'DisableByDefault' is set to 'true' above. # Removing this configuration leads to a lot of violations triggered # by other cops that are not auto-correctable. Layout/ArgumentAlignment: EnforcedStyle: with_fixed_indentation Layout/ArrayAlignment: EnforcedStyle: with_fixed_indentation Layout/HashAlignment: EnforcedHashRocketStyle: key Layout/ParameterAlignment: EnforcedStyle: with_fixed_indentation Layout/MultilineArrayLineBreaks: Enabled: true Layout/MultilineBlockLayout: Enabled: true Layout/MultilineHashKeyLineBreaks: Enabled: true Layout/MultilineHashBraceLayout: Enabled: true Layout/FirstMethodArgumentLineBreak: Enabled: true Layout/MultilineMethodCallBraceLayout: EnforcedStyle: new_line Layout/MultilineMethodCallIndentation: EnforcedStyle: indented Layout/MultilineMethodDefinitionBraceLayout: EnforcedStyle: new_line Layout/SpaceAroundOperators: AllowForAlignment: false Layout/SpaceBeforeBrackets: Enabled: true Layout/FirstMethodParameterLineBreak: Enabled: true Layout/EndAlignment: EnforcedStyleAlignWith: start_of_line Layout/BlockAlignment: EnforcedStyleAlignWith: start_of_block Layout/FirstHashElementLineBreak: Enabled: true Layout/FirstArrayElementIndentation: EnforcedStyle: consistent Layout/FirstArrayElementLineBreak: Enabled: true Layout/IndentationWidth: Enabled: true Layout/ClosingParenthesisIndentation: Enabled: true Layout/FirstArgumentIndentation: Enabled: true Layout/ElseAlignment: Enabled: true Layout/FirstHashElementIndentation: Enabled: true Layout/AssignmentIndentation: Enabled: true Layout/CaseIndentation: Enabled: true Layout/MultilineArrayBraceLayout: Enabled: true Layout/BeginEndAlignment: Enabled: true Layout/CommentIndentation: Enabled: true Layout/DotPosition: EnforcedStyle: leading Layout/EmptyLineAfterGuardClause: Enabled: true Layout/IndentationConsistency: Enabled: true Layout/MultilineMethodParameterLineBreaks: Enabled: true Layout/SpaceBeforeBlockBraces: Enabled: true Layout/SpaceInsideBlockBraces: Enabled: true Layout/SpaceInsideHashLiteralBraces: Enabled: true Layout/TrailingEmptyLines: Enabled: true Layout/EmptyLinesAroundClassBody: EnforcedStyle: no_empty_lines Layout/EmptyLinesAroundBlockBody: EnforcedStyle: no_empty_lines Layout/TrailingWhitespace: AllowInHeredoc: false Layout/SpaceBeforeComma: Enabled: true Layout/SpaceAfterComma: Enabled: true Layout/EmptyLines: Enabled: true Layout/EmptyLineAfterMagicComment: Enabled: true Lint: Enabled: true Lint/AmbiguousBlockAssociation: Exclude: - spec/**/* Lint/BinaryOperatorWithIdenticalOperands: Enabled: true Lint/ConstantDefinitionInBlock: Enabled: true Lint/DeprecatedOpenSSLConstant: Enabled: true Lint/DuplicateElsifCondition: Enabled: true Lint/DuplicateRequire: Enabled: true Lint/DuplicateRescueException: Enabled: true Lint/EmptyConditionalBody: Enabled: true Lint/EmptyFile: Enabled: true Lint/FloatComparison: Enabled: true Lint/IdentityComparison: Enabled: true Lint/Loop: Enabled: false Lint/MissingSuper: Enabled: false Lint/MixedRegexpCaptureTypes: Enabled: true Lint/OutOfRangeRegexpRef: Enabled: true Lint/RaiseException: Enabled: true Lint/SelfAssignment: Enabled: true Lint/StructNewOverride: Enabled: true Lint/SymbolConversion: EnforcedStyle: consistent Lint/TopLevelReturnWithArgument: Enabled: true Lint/TrailingCommaInAttributeDeclaration: Enabled: true Lint/UnreachableLoop: Enabled: true Lint/UselessMethodDefinition: Enabled: true Lint/UselessTimes: Enabled: true Style/MutableConstant: Enabled: true Style/StringLiterals: Enabled: true Style/SymbolArray: Enabled: true Style/TrailingCommaInHashLiteral: Enabled: false Style/TrailingCommaInArguments: Enabled: true Style/WordArray: Enabled: true Style/HashSyntax: Enabled: true EnforcedShorthandSyntax: either Security: EnabledByDefault: true Style/Semicolon: Exclude: - spec/**/* Rails/TimeZone: Enabled: true Rails/Date: Enabled: true RSpec: Enabled: false RSpec/Focus: Enabled: true Lint/AmbiguousAssignment: Enabled: true Lint/DeprecatedConstants: Enabled: true Lint/AmbiguousRange: Enabled: true Lint/AmbiguousOperatorPrecedence: Enabled: true Lint/TripleQuotes: Enabled: true Lint/ConstantOverwrittenInRescue: Enabled: true Lint/NonAtomicFileOperation: Enabled: true Lint/UnmodifiedReduceAccumulator: Enabled: true Lint/OrAssignmentToConstant: Enabled: true Lint/RedundantDirGlobSort: Enabled: true Lint/RequireRangeParentheses: Enabled: true # These checks are valid, but better left to programmer's discretion, as the effects of such code are harmless. Lint/DuplicateBranch: Enabled: false Lint/DuplicateRegexpCharacterClassElement: Enabled: false Lint/EmptyBlock: Enabled: false Lint/EmptyClass: Enabled: false Lint/EmptyInPattern: Enabled: false Lint/UnexpectedBlockArity: Enabled: false # These code patterns are rare/nonexistent in our code, so checking for them is a waste of time Lint/IncompatibleIoSelectWithFiberScheduler: Enabled: false Lint/LambdaWithoutLiteralBlock: Enabled: false Lint/NoReturnInBeginEndBlocks: Enabled: false Lint/NumberedParameterAssignment: Enabled: false Lint/RefinementImportMethods: Enabled: false Lint/RequireRelativeSelfPath: Enabled: false Lint/ToEnumArguments: Enabled: false Lint/UselessRuby2Keywords: Enabled: false # Since we don't have all cops enabled by default we have to add every new cop explicitly Lint/DuplicateMagicComment: Enabled: true Lint/UselessRescue: Enabled: false Lint/DuplicateMatchPattern: Enabled: true Lint/MixedCaseRange: Enabled: true Lint/RedundantRegexpQuantifiers: Enabled: true # This is default cops we want to keep disabled: Style/FrozenStringLiteralComment: Enabled: false Layout/LineLength: Enabled: false Style/ArgumentsForwarding: Enabled: false Naming/BlockForwarding: Enabled: false Rails/FreezeTime: Enabled: false Style/Documentation: Enabled: false Metrics/MethodLength: Enabled: false Naming/VariableNumber: Enabled: false Metrics/AbcSize: Enabled: false Metrics/ClassLength: Enabled: false Style/ClassAndModuleChildren: Enabled: false Metrics/BlockLength: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Style/SafeNavigation: Enabled: false Rails/Output: Enabled: false Style/Next: # this one looks dangerous Enabled: false Bundler/OrderedGems: Enabled: false Bundler/DuplicatedGroup: Enabled: false Rails/HttpStatus: Enabled: false Rails/SkipsModelValidations: Enabled: false Style/InfiniteLoop: Enabled: false Style/StderrPuts: Enabled: false Style/NumericPredicate: Enabled: false Metrics/PerceivedComplexity: Enabled: false Style/RegexpLiteral: Enabled: false Rails/Delegate: Enabled: false Style/RaiseArgs: Enabled: false Rails/HasManyOrHasOneDependent: # Nice to have but challenging to fix Enabled: false Rails/InverseOf: Enabled: false Style/MultilineBlockChain: Enabled: false Naming/AccessorMethodName: Enabled: false Naming/PredicateName: Enabled: false Style/FormatStringToken: Enabled: false Style/RedundantSort: # dangerous since autofix breaks the code Enabled: false Style/SymbolProc: Enabled: false Rails/ApplicationController: Enabled: false Rails/ApplicationRecord: Enabled: false Style/ExplicitBlockArgument: Enabled: false Rails/DynamicFindBy: Enabled: false Metrics/ParameterLists: Enabled: false Rails/IndexWith: Enabled: false Style/FormatString: Enabled: false Rails/Blank: Enabled: false Rails/Present: Enabled: false Style/NumericLiterals: Enabled: false Style/Lambda: Enabled: false Style/Proc: Enabled: false Style/ExponentialNotation: Enabled: false Style/PreferredHashMethods: # can be changed via vote Enabled: false Rails/Presence: Enabled: false Metrics/ModuleLength: Enabled: false Style/RedundantConditional: Enabled: false Style/TrailingUnderscoreVariable: Enabled: false Style/ParenthesesAroundCondition: Enabled: false Style/HashEachMethods: Enabled: false Style/RedundantAssignment: Enabled: false Style/CaseLikeIf: Enabled: false Style/RedundantBegin: Enabled: false Rails/FilePath: Enabled: false Style/Alias: Enabled: false Style/SingleArgumentDig: Enabled: false Style/RescueModifier: # because it's heavily used in application service Enabled: false Style/IfUnlessModifier: Enabled: false Naming/BinaryOperatorParameterName: Enabled: false Style/SignalException: Enabled: false Style/TrivialAccessors: Enabled: false Rails/HasAndBelongsToMany: Enabled: false Style/AccessModifierDeclarations: Enabled: false Rails/ReadWriteAttribute: Enabled: false Rails/RedundantReceiverInWithOptions: Enabled: false Style/HashTransformValues: Enabled: false Rails/IndexBy: Enabled: false Rails/Pick: Enabled: false Style/CombinableLoops: # hard to autocorrect properly Enabled: false FactoryBot/CreateList: Enabled: false Rails/ReflectionClassName: Enabled: false Style/RedundantSelf: Enabled: false Style/GuardClause: Enabled: false Style/PercentLiteralDelimiters: Enabled: false Style/StringConcatenation: # heavily used in insurance service Enabled: false Style/InverseMethods: Enabled: false Style/RedundantInterpolation: Enabled: false Style/ZeroLengthPredicate: Enabled: false Style/NegatedIf: # sometimes "if !var" just reads better Enabled: false Style/NilComparison: # we don't have a good reason to enforce this Enabled: false Style/GlobalStdStream: # autocorrection is unsafe because STDOUT and $stdout may point to different objects Enabled: false Style/MultilineTernaryOperator: Enabled: false Style/RedundantReturn: Enabled: false Style/ClassCheck: Enabled: false Style/LineEndConcatenation: Enabled: false Style/RedundantFetchBlock: Enabled: false Style/FloatDivision: Enabled: false Layout/MultilineOperationIndentation: Enabled: false Style/SoleNestedConditional: Enabled: false Rails/FindEach: Enabled: false Style/RedundantParentheses: Enabled: false Style/IfInsideElse: Enabled: false Style/EmptyCaseCondition: Enabled: false Style/TernaryParentheses: EnforcedStyle: require_parentheses_when_complex Style/HashLikeCase: Enabled: false # 🤔 Should we enable these cops or not? They look useful but require alignment within the team Style/OpenStructUse: Enabled: false Style/RedundantConstantBase: # new in 1.40 Enabled: false Naming/MemoizedInstanceVariableName: Enabled: false Style/ConditionalAssignment: Enabled: false Style/BlockDelimiters: Enabled: false Style/TrailingCommaInArrayLiteral: Enabled: false FactoryBot/FactoryClassName: Enabled: false Style/NumericLiteralPrefix: Enabled: false Style/OptionalBooleanParameter: Enabled: false Style/IdenticalConditionalBranches: # Is it safe to auto-fix? Enabled: false Naming/RescuedExceptionsVariableName: # Would be nice to have, but should align on the name first Enabled: false Naming/MethodParameterName: # should enable but we have to manually fix this Enabled: false Rails/UniqueValidationWithoutIndex: # definitely enable!!! Enabled: false Rails/Validation: # discuss with the team Enabled: false Rails/LexicallyScopedActionFilter: # enable and manually disable offences Enabled: false Security/Open: Enabled: false Naming/FileName: Enabled: false Style/EmptyElse: Enabled: false Style/MixinUsage: # Enable and then manually disable offenses? Enabled: false # ✅ Enabled in 2.0 version (activated by "enable all rules by default') # Let's keep commented list here for visibility for a while # #Layout/SpaceInsideParens: # Enabled: false #Layout/SpaceBeforeFirstArg: # Enabled: false #Layout/ExtraSpacing: # Enabled: false #Layout/SpaceAfterColon: # Enabled: false #Rails/PluralizationGrammar: # Enabled: false #Layout/SpaceAroundMethodCallOperator: # Enabled: false #Style/RedundantFreeze: # Enabled: false #Layout/SpaceInLambdaLiteral: # Enabled: false #Layout/LeadingCommentSpace: # Enabled: false #Layout/DefEndAlignment: # Enabled: false #Style/RedundantRegexpEscape: # Enabled: false #Layout/HeredocIndentation: # Enabled: false #Layout/ClosingHeredocIndentation: # Enabled: false #Layout/LeadingEmptyLines: # Enabled: false #Layout/EmptyLinesAroundAccessModifier: # Enabled: false #Style/NegatedIf: # Enabled: false #Style/CommentAnnotation: # Enabled: false #Layout/MultilineOperationIndentation: # Enabled: false #Style/ExpandPathArguments: # Enabled: false #Layout/EmptyLinesAroundMethodBody: # Enabled: false #Style/RedundantReturn: # Enabled: false #Style/GlobalStdStream: # Enabled: false #Style/FloatDivision: # Enabled: false #Style/RescueStandardError: # Enabled: false #Style/NilComparison: # Enabled: false #Style/RedundantFetchBlock: # Enabled: false #Style/Encoding: # Enabled: false #Style/EmptyLiteral: # Enabled: false #Layout/SpaceInsideReferenceBrackets: # Enabled: false #Style/EmptyLambdaParameter: # Enabled: false #Style/TernaryParentheses: # Enabled: false #Naming/MethodName: # Enabled: false #Style/SlicingWithRange: # Enabled: false #Style/EmptyCaseCondition: # Enabled: false #Style/SoleNestedConditional: # Enabled: false #Rails/FindEach: # Enabled: false #Style/RedundantFileExtensionInRequire: # Enabled: false #Layout/SpaceInsideArrayLiteralBrackets: # Enabled: false #Style/HashAsLastArrayItem: # Enabled: false #Lint/RedundantCopDisableDirective: # Enabled: false #Layout/SpaceAroundKeyword: # Enabled: false #Style/KeywordParametersOrder: # Enabled: false #Style/BlockComments: # Enabled: false #Style/AndOr: # Enabled: false #Style/EachWithObject: # Enabled: false #Layout/SpaceAroundBlockParameters: # Enabled: false #Style/MultilineTernaryOperator: # Enabled: false #Style/RedundantParentheses: # Enabled: false #Security/JSONLoad: # Enabled: false #Style/MethodCallWithoutArgsParentheses: # Enabled: false #Style/CommentedKeyword: # Enabled: false #Style/MultilineIfModifier: # Enabled: false #Style/IfInsideElse: # Enabled: false #Style/AccessorGrouping: # Enabled: false #Layout/BlockEndNewline: # Enabled: false #Rails/RedundantForeignKey: # Enabled: false #Style/UnlessElse: # Enabled: false #Layout/EmptyLinesAroundModuleBody: # Enabled: false #Rails/RakeEnvironment: # Enabled: false #Layout/EmptyLinesAroundArguments: # Enabled: false #Style/EachForSimpleLoop: # Enabled: false #Style/ClassCheck: # Enabled: false #Style/NestedParenthesizedCalls: # Enabled: false #Style/LineEndConcatenation: # Enabled: false #Style/ParallelAssignment: # Enabled: false #Layout/EmptyLinesAroundExceptionHandlingKeywords: # Enabled: false #Layout/SpaceAroundEqualsInParameterDefault: # Enabled: false #Style/YodaCondition: # Enabled: false #Layout/SpaceInsideStringInterpolation: # Enabled: false #Style/EmptyMethod: # Enabled: false #Layout/EmptyLineBetweenDefs: # Enabled: false #Naming/ConstantName: # Enabled: false #Rails/RelativeDateConstant: # Enabled: false