Skip to content
Snippets Groups Projects
.rubocop.yml 3.3 KiB
Newer Older
inherit_gem:
  gitlab-styles:
    - rubocop-default.yml

inherit_from: .rubocop_todo.yml

require:
  - ./lib/rubocop/rubocop
  - rubocop-rspec

AllCops:
  TargetRubyVersion: 2.7
  # Cop names are displayed in offense messages by default. Change behavior
  # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
  # option.
  DisplayCopNames: true
  # Style guide URLs are not displayed in offense messages by default. Change
  # behavior by overriding DisplayStyleGuide, or by giving the
  # -S/--display-style-guide option.
  DisplayStyleGuide: false
  # New cops introduced between major versions are set to a special pending status
  # and are not enabled by default with warning message.
  # Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
  # When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
  # the `--enable-pending-cops` command-line option.
  # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
  # the `--disable-pending-cops` command-line option.
  NewCops: disable
  # Determines if a notification for extension libraries should be shown when
  # rubocop is run. Keys are the name of the extension, and values are an array
  # of gems in the Gemfile that the extension is suggested for, if not already
  # included.
  SuggestExtensions: false
  # Exclude some GitLab files
    - 'gems/**/*'
    - '.bundle/**/*'
    - 'cache/**/*'
    - 'node_modules/**/*'
    - 'vendor/bundle/**/*'
    - 'files/gitlab-cookbooks/runit/**/*'
    - 'danger/changelog/Dangerfile'
    - 'scripts/security-harness'
# No rails in omnibus
Rails:
  Enabled: false

# TODO re-enable and start updating rspec tests
RSpec:
  Enabled: false

# We use git repos in our gemfile, but only our own repos
# TODO: Update the cop to allow us to enable it and whitelist our groups
Cop/GemFetcher:
  Enabled: false

# We are not concerned with the security of using public in omnibus but we want to ensure
# Any webserver script we might ship in the future is tested for it
GitlabSecurity/PublicSend:
  Enabled: true
  Exclude:
    - 'files/gitlab-cookbooks/package/**/*'
    - 'files/gitlab-ctl-commands/**/*'
    - 'files/gitlab-ctl-commands-ee/**/*'
    - 'spec/**/*'
DJ Mountney's avatar
DJ Mountney committed
# This is only useful for our build scripts, used in CI
# Exlude most other locations
Cop/AvoidUsingEnv:
  Enabled: true
  Exclude:
    - omnibus.rb
    - files/**/*
    - docker/**/*
    - lib/gitlab/util.rb
    - spec/lib/gitlab/util_spec.rb
Cop/SpecifyDefaultVersion:
  Enabled: true
  Include:
    - config/software/*.rb
  Exclude:
    # These files either use `path` source and doesn't need a default_version
    # or is just a wrapper around other definitions
    - config/software/gitlab-config-template.rb
    - config/software/gitlab-cookbooks.rb
    - config/software/gitlab-ctl-ee.rb
    - config/software/gitlab-ctl.rb
    - config/software/gitlab-scripts.rb
    - config/software/gitlab-selinux.rb
    - config/software/openssl.rb

Style/MultilineIfModifier:
  Enabled: false

Lint/HashCompareByIdentity: # (new in 0.93)
  Enabled: true
Lint/RedundantSafeNavigation: # (new in 0.93)
  Enabled: true
Style/ClassEqualityComparison: # (new in 0.93)
  Enabled: true

Style/RedundantFileExtensionInRequire:
  Enabled: true
  Exclude:
    - files/**/*