require:
  - rubocop-performance
  - rubocop-rake
  - rubocop-rspec

AllCops:
  TargetRubyVersion: 3.0
  NewCops: enable
  Exclude:
    - !ruby/regexp /lib\/selenium\/devtools\/v\d+/

Gemspec/DevelopmentDependencies:
  EnforcedStyle: gemspec

Layout/LineLength:
  AllowedPatterns:
    - '^\s*#'

Layout/SpaceInsideHashLiteralBraces:
  EnforcedStyle: no_space

Metrics/AbcSize:
  Max: 30
  Exclude:
    - 'lib/selenium/webdriver/common/driver_finder.rb'
    - 'lib/selenium/webdriver/common/options.rb'
    - 'lib/selenium/webdriver/remote/capabilities.rb'
    - 'lib/selenium/webdriver/remote/http/curb.rb'
    - 'lib/selenium/webdriver/support/color.rb'

Metrics/BlockLength:
  Max: 18
  Exclude:
    - 'spec/**/*.rb'
    - 'selenium-*.gemspec'
    - '../Rakefile*'

Metrics/ClassLength:
  CountComments: false
  Max: 160
  Exclude:
    - 'lib/selenium/webdriver/common/driver.rb'
    - 'lib/selenium/webdriver/remote/bridge.rb'
    - 'lib/selenium/webdriver/remote/capabilities.rb'
    - 'spec/integration/selenium/webdriver/spec_support/test_environment.rb'
    - 'spec/**/*.rb'

Metrics/CyclomaticComplexity:
  Max: 9
  Exclude:
    - 'lib/selenium/webdriver/support/color.rb'
    - 'lib/selenium/webdriver/common/logger.rb'

Metrics/MethodLength:
  CountComments: false
  Max: 22
  Exclude:
    - 'lib/selenium/server.rb'
    - 'lib/selenium/webdriver/common/options.rb'
    - 'lib/selenium/webdriver/common/driver.rb'
    - 'lib/selenium/webdriver/common/driver_finder.rb'
    - 'lib/selenium/webdriver/remote/http/default.rb'

Metrics/ModuleLength:
  CountComments: false
  Max: 110
  Exclude:
    - 'lib/selenium/webdriver/common/platform.rb'
    - 'spec/**/*'

Metrics/PerceivedComplexity:
  Max: 9
  Exclude:
    - 'lib/selenium/webdriver/common/options.rb'
    - 'lib/selenium/webdriver/common/local_driver.rb'
    - 'lib/selenium/webdriver/common/logger.rb'

Naming/FileName:
  Exclude:
    - 'lib/selenium-webdriver.rb'
    - 'Rakefile'
    - '../Rakefile'

Naming/MethodParameterName:
  AllowedNames:
    - x
    - y
    - ex
    - by
    - id
    - io

RSpec/AnyInstance:
  Enabled: false

RSpec/BeforeAfterAll:
  Enabled: false

RSpec/ExampleLength:
  Enabled: false

RSpec/InstanceVariable:
  Exclude:
    - 'spec/unit/selenium/webdriver/socket_poller_spec.rb'
    - 'spec/integration/selenium/webdriver/chrome/print_pdf_spec.rb'

RSpec/MultipleExpectations:
  Enabled: false

RSpec/NoExpectationExample:
  Exclude:
    - 'spec/integration/selenium/webdriver/guard_spec.rb'
    - 'spec/integration/selenium/webdriver/takes_screenshot_spec.rb'

RSpec/MultipleMemoizedHelpers:
  Max: 6
  Exclude:
    - 'spec/unit/selenium/webdriver/common/interactions/*_spec.rb'

Style/BlockDelimiters:
  EnforcedStyle: braces_for_chaining

Style/CommentedKeyword:
  Enabled: false

# __dir__ should be avoided when used with Bazel.
Style/Dir:
  Exclude:
    - 'selenium-devtools.gemspec'
    - 'selenium-webdriver.gemspec'

# Consider documenting all top-level classes and modules
Style/Documentation:
  Enabled: false

Style/HashEachMethods:
  Enabled: true

# Port Integers do not need underscores
Style/NumericLiterals:
  Enabled: false

Style/OptionalBooleanParameter:
  Enabled: false

Lint/Debugger:
  Enabled: true
  DebuggerMethods:
    Capybara:
      - save_screenshot: ~
