AllCops: Exclude: # Exclude .gemspec files because they are generally auto-generated - '*.gemspec' # Generally, the keyword style uses a lot of space. This is particularly true when # you use case/if statements, in combination with a long-name variable. # # invoice_error_message = case error # when 1 == 1 # do_something # else # do_else # end # Lint/EndAlignment: AlignWith: variable # [codesmell] Metrics/AbcSize: Enabled: false Exclude: - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' # For the same reason of EndAlignment, aligning with the case may have a bad impact # on a case after a very long variable. # # invoice_error_message = case error # when 1 == 1 # do_something # else # do_else # end # Style/CaseIndentation: IndentWhenRelativeTo: end # [codesmell] Metrics/ClassLength: Enabled: false Exclude: - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' # [codesmell] Metrics/MethodLength: Enabled: false Exclude: - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' Max: 10 # [codesmell] Metrics/ModuleLength: Enabled: false Exclude: - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' # [codesmell] Metrics/LineLength: Enabled: false Exclude: - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' Max: 100 # [codesmell] # I don't really get the point of this cop. Performance/RedundantMerge: Enabled: false # Do not use "and" or "or" in conditionals, but for readability we can use it # to chain executions. Just beware of operator order. Style/AndOr: EnforcedStyle: conditionals # No specific reason, except that %q() is easier to grep than %() Style/BarePercentLiterals: EnforcedStyle: percent_q # braces_for_chaining seems a good fit of what we've been doing so far. Style/BlockDelimiters: EnforcedStyle: braces_for_chaining IgnoredMethods: - expect # I'd rather use context_dependent, even if I'm not even sure we should enforce a style. Style/BracesAroundHashParameters: EnforcedStyle: context_dependent # I was a big fan of leading, but trailing seems to be more commonly adopted. # At least at the time being. Style/DotPosition: EnforcedStyle: trailing # Warn on empty else. Style/EmptyElse: EnforcedStyle: empty # Double empty lines are useful to separate conceptually different methods # in the same class or module. Style/EmptyLines: Enabled: false Style/EmptyLinesAroundBlockBody: Exclude: # RSpec is all made of blocks. Disable this config in RSpec # to be consistent with EmptyLinesAroundClassBody and EmptyLinesAroundModuleBody - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' # In most cases, a space is nice. Sometimes, it's not. # Just be consistent with the rest of the surrounding code. Style/EmptyLinesAroundClassBody: Enabled: false # In most cases, a space is nice. Sometimes, it's not. # Just be consistent with the rest of the surrounding code. Style/EmptyLinesAroundModuleBody: Enabled: false # I personally don't care about the format style. # In most cases I like to use %, but not at the point I want to enforce it # as a convention in the entire code. Style/FormatString: Enabled: false # Multi-line differs from standard indentation, they are indented twice. Style/FirstParameterIndentation: IndentationWidth: 4 # Prefer the latest Hash syntax Style/HashSyntax: Exclude: # But Rakefiles generally have some definition like # :default => :test # that looks nicer with the old rocket syntax. - 'Rakefile' # We want to be able to decide when to use one-line if/unless modifiers. Style/IfUnlessModifier: Enabled: false # Array indentation should be considered like MultilineMethodCallIndentation indentation # and use 4 spaces instead of 2. Style/IndentArray: IndentationWidth: 4 # Hash indentation should be considered like MultilineMethodCallIndentation indentation # and use 4 spaces instead of 2. Style/IndentHash: IndentationWidth: 4 # [codesmell] # It's not always that bad. Style/IfInsideElse: Enabled: false # Multi-line differs from standard indentation, they are indented twice. Style/MultilineMethodCallIndentation: EnforcedStyle: indented IndentationWidth: 4 # Multi-line differs from standard indentation, they are indented twice. Style/MultilineOperationIndentation: EnforcedStyle: indented IndentationWidth: 4 # unless is not always cool. Style/NegatedIf: Enabled: false # Magic numbers are not welcomed Style/NumericLiterals: Exclude: # however tests can use numeric literals for method calls, # without the need to define a variable just for that. - 'spec/**/*_spec.rb' - 'test/**/*_test.rb' # Do we care? Style/RegexpLiteral: Enabled: false # There are cases were the inline rescue is ok. We can either downgrade the severity, # or rely on the developer judgement on a case-by-case basis. Style/RescueModifier: Enabled: false # We don't have a preference. Style/SpecialGlobalVars: Enabled: false EnforcedStyle: use_perl_names # We generally use double quotes, sometimes single quotes. # Should we enforce it at code level? Style/StringLiterals: Enabled: false EnforcedStyle: double_quotes # It's nice to be consistent. The trailing comma also allows easy reordering, # and doesn't cause a diff in Git when you add a line to the bottom. Style/TrailingCommaInLiteral: EnforcedStyleForMultiline: consistent_comma Style/TrivialAccessors: # IgnoreClassMethods because I want to be able to define class-level accessors # that sets an instance variable on the metaclass, such as: # # def self.default=(value) # @default = value # end # IgnoreClassMethods: true