Skip to content
代码片段 群组 项目
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
.rubocop.yml 28.06 KiB
inherit_gem:
  gitlab-styles:
    - rubocop-default.yml

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

inherit_from:
  <% unless ENV['REVEAL_RUBOCOP_TODO'] == '1' %>
    <% Dir.glob('.rubocop_todo/**/*.yml').each do |rubocop_todo_yaml| %>
  - '<%= rubocop_todo_yaml %>'
    <% end %>
  - '.rubocop_todo.yml'
  <% end %>
  - ./rubocop/rubocop-migrations.yml
  - ./rubocop/rubocop-usage-data.yml
  - ./rubocop/rubocop-code_reuse.yml
  <% Dir.glob('jh/rubocop/**/*.yml').each do |jh_rubocop_yaml| %>
  - '<%= jh_rubocop_yaml %>'
  <% end %>

inherit_mode:
  merge:
    - Include
    - Exclude
    - AllowedPatterns

AllCops:
  # The oldest supported Ruby version.
  TargetRubyVersion: 3.1
  TargetRailsVersion: 7.0
  Exclude:
    - 'gems/**/*'
    - 'qa/gems/**/*'
    - 'vendor/**/*'
    - 'node_modules/**/*'
    - 'db/fixtures/**/*'
    - 'db/schema.rb'
    - 'tmp/**/*'
    - 'bin/**/*'
    - 'generator_templates/**/*'
    - 'builds/**/*'
    - 'plugins/**/*'
    - 'file_hooks/**/*'
    - 'workhorse/**/*'
    - 'shared/packages/**/*'
    - 'spec/support/*.git/**/*'  # e.g. spec/support/gitlab-git-test.git
    - 'db/ci_migrate/*.rb'      # since the `db/ci_migrate` is a symlinked to `db/migrate`
    # projects_controller.rb is used for testing LLM response and is very sensitive to whitespaces.
    - 'ee/spec/fixtures/llm/projects_controller.rb'
    # Adding this specifically for a large revert: !118368
    <% File.readlines('.rubocop_revert_ignores.txt').map(&:chomp).each do |f| %>
    - '<%= f %>'
    <% end %>
  # Use absolute path to avoid orphan directories with changed workspace root.
  CacheRootDirectory: <%= Dir.getwd %>/tmp
  MaxFilesInCache: 1_000_000
  NewCops: disable
  SuggestExtensions: false

Rails:
  Exclude:
    # User defined excludes on top (department) level don't cancel default
    # includes set by child cops. Directories below are not affected (tested
    # manually). Watch https://github.com/rubocop/rubocop/issues/11148 to
    # know when this comment can be removed.
    - 'danger/**/*'
    - 'tooling/danger/**/*'
    - 'rubocop/**/*'