require: - 'rubocop-performance' AllCops: Exclude: - bin/**/* # Let gems do their stuff - vendor/bundle/**/* # Let gems do their stuff - .pryrc # Do what you want here - tmp/**/* # Do what you want here - doc/**/* - node_modules/**/* NewCops: enable ### # Disable or configure cops with reasons: Layout/LineLength: Enabled: false # Disabled as it would require heavy refactoring in most codebases. Feel free to enable it for your project! # Alignment-cops. Settings aim to avoid deep indentations and diff noise. Layout/FirstArgumentIndentation: EnforcedStyle: consistent Layout/FirstArrayElementIndentation: EnforcedStyle: consistent Layout/FirstHashElementIndentation: EnforcedStyle: consistent Layout/MultilineMethodCallIndentation: EnforcedStyle: indented Layout/ArgumentAlignment: EnforcedStyle: with_fixed_indentation Layout/CaseIndentation: EnforcedStyle: end Layout/EndAlignment: EnforcedStyleAlignWith: start_of_line Layout/EmptyLineAfterGuardClause: Enabled: false # Methods should be short anyway, so that a guard clause will be visible enough without an empty line Style/ClassAndModuleChildren: # Each version has its own benefits depending on the situation Enabled: false Style/Documentation: # We currently do not enforce documentation. Do it where you feel it is useful! Enabled: false Style/EmptyMethod: # Do not allow `def foo; end` for empty methods as semicolons are discouraged in ruby EnforcedStyle: expanded Style/FrozenStringLiteralComment: # Might be enabled in the future Enabled: false Style/Lambda: # Always use `->` instead of `lambda`, as the latter does not work with `do ... end` and we do not want to use `{ ... }` for multiline-blocks (see https://github.com/rubocop-hq/rubocop/issues/1520) EnforcedStyle: literal Style/NumericPredicate: # Sometimes "== 0" is easier to read than .zero? Enabled: false Style/StringLiterals: EnforcedStyle: double_quotes # Avoids having to change quotes when adding interpolation to a string. Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes Style/TrailingCommaInArguments: EnforcedStyleForMultiline: consistent_comma # Makes it easier to swap lines and avoids noise in diffs Style/TrailingCommaInArrayLiteral: EnforcedStyleForMultiline: consistent_comma # Makes it easier to swap lines and avoids noise in diffs Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: consistent_comma # Makes it easier to swap lines and avoids noise in diffs ### # Tune metrics cops # Background: metrics cops, although they are sometimes annoying, give you a stimulus to think about the complexity of the code. # So, while it is true that good code style is best ensured by peer review, pair programming or ensemble (mob) programming, it's # good that the metrics cops have your back and act as a last line of defense while you are wrapping your head around other # aspects. Therefore we soften the default limits, so that the cops are not too whiny and annoy the developers, but we keep them # enabled. # Recommendation: if you offend a metrics cop for good reason, disable that specific cop in the offending file only (see # https://docs.rubocop.org/rubocop/configuration.html#disabling-cops-within-source-code). See also the README next to this file. # Length metrics Metrics/ClassLength: Max: 200 # 2 times of the default value of 100, above this you should really think about splitting up the class Metrics/ModuleLength: Max: 200 # 2 times of the default value of 100, above this you should really think about splitting up the module Metrics/MethodLength: Max: 30 # 3 times of the default value of 10, above this you should really think about splitting up the method CountAsOne: ['array', 'heredoc', 'hash'] # Do not incentivise against multi-line and in-method constants and declarative programming Exclude: - db/migrate/**/* # let migrations do what they need Metrics/BlockLength: # the default value of 25 is good Exclude: - config/**/* # There is no reason to artificially break up config blocks - lib/tasks/**/*.rake - spec/**/* # describe or context blocks may be large - '*.gemspec' # Method signature complexity metrics Metrics/ParameterLists: Max: 3 # more than 3 positional parameters get confusing, use keyword args or group input parameters in value objects instead CountKeywordArgs: false # keyword args are OK, they are way more readable than positional args # Code complexity metrics Metrics/AbcSize: Max: 43 # ~2.5 times of the default value of 17, above this your method is most likely too complex Metrics/CyclomaticComplexity: Max: 14 # 2 times of the default value of 7, above this your method is most likely too complex Metrics/PerceivedComplexity: Max: 12 # 1.5 times of the default value of 8, above this your method is most likely too complex ###