.rubocop.yml

Summary

Maintainability
Test Coverage
AllCops:
  TargetRubyVersion: 2.5
  TargetRailsVersion: 5.2

  DisplayCopNames: true
  DisplayStyleGuide: false

  Exclude:
    # Files that are out of our control and that are not excluded in the
    # default config of rubocop.
    - db/schema.rb
    - db/schema.mysql.rb
    - db/schema.postgresql.rb
    - db/migrate/*
    - vendor/**/*

#
# Layout
#

# This is a remnant of old SUSE-style alignment for hashes, The table format
# looks more human readable.
Layout/AlignHash:
  EnforcedHashRocketStyle: table
  EnforcedColonStyle: table

#
# Metrics
#

# The default is just too small.
Metrics/AbcSize:
  Max: 30

# We will skip it for tests, the Grape API and Rake tasks.
Metrics/BlockLength:
  Exclude:
    - spec/**/*
    - lib/api/**/*
    - lib/tasks/**/*

# Some classes (e.g. API) are either too difficult to modularize in a reasonable
# (readable) manner, or are intentionally fat (e.g. some models). Let's leave
# out these kinds of classes from this cop.
Metrics/ClassLength:
  Exclude:
    - app/models/**/*
    - lib/api/**/*

# The default is just too small. A limit of 100 looks reasonable and many other
# projects (including inside of SUSE) are also using this value.
Metrics/LineLength:
  Max: 100

# NOTE: this could be further trimmed down but some refactorings will have to be
# done.
Metrics/MethodLength:
  Max: 20

#
# Rails
#

Rails:
  Enabled: true

Rails/SkipsModelValidations:
  Enabled: false

#
# Style
#

# It's not needed to add documentation for obvious modules or classes. The main
# idea is that documentation will be asked during the review process if needed.
Style/Documentation:
  Enabled: false

# This forces us to create a new object for no real reason.
Style/MultipleComparison:
  Enabled: false

# This is a common SUSE configuration value: the performance difference between
# single and double quotes is no longer there, and so it's better to be
# consistent and force only double quotes.
Style/StringLiterals:
  EnforcedStyle: double_quotes

# Same as Style/StringLiterals.
Style/StringLiteralsInInterpolation:
  EnforcedStyle: double_quotes

# There are some false positives (e.g. "module ::Module", in which we want to
# make sure there are no clashes or misunderstandings). Therefore, we just
# disable this cop.
Style/ClassAndModuleChildren:
  Enabled: false

#
# Naming
#

# The default minimum length is 3, which is too long for good names like
# "js". Variables with only one letter are usually disallowed, but there are
# some names which are easy to understand (e.g. convention).
Naming/UncommunicativeMethodParamName:
  MinNameLength: 2
  AllowedNames: [_, n]