Defining methods inside RSpec.configure blocks still defines them on Object. Use config.include with a module to define these only in the specs and not globally. For matcher methods, define them in RSpec::Matchers::DSL::Matcher. Change rubocop config to allow this inside of the RSpec.configure blocks (technically, any constant inside any block). Add an Object.method_added hook that raises an exception if defining a method on object, other than Nokogiri, which is defined by the nokogiri gem. This will result in the specs raising an error without executing anything if you attempt to define a method on Object.
105 lines
1.6 KiB
YAML
105 lines
1.6 KiB
YAML
# Modified from https://www.fastruby.io/blog/ruby/code-quality/how-we-use-rubocop-and-standardrb.html
|
|
require:
|
|
- rubocop-capybara
|
|
- standard
|
|
|
|
plugins:
|
|
- rubocop-erb
|
|
- rubocop-performance
|
|
- rubocop-rake
|
|
- rubocop-rspec
|
|
- rubocop-sequel
|
|
|
|
inherit_gem:
|
|
standard: config/base.yml
|
|
|
|
AllCops:
|
|
TargetRubyVersion: 3.4
|
|
NewCops: enable
|
|
Exclude:
|
|
- public/**/*
|
|
- vendor/**/*
|
|
- node_modules/**/*
|
|
- coverage/views/*
|
|
|
|
RSpec:
|
|
Enabled: true
|
|
|
|
Performance:
|
|
Enabled: true
|
|
|
|
Rake:
|
|
Enabled: true
|
|
|
|
Sequel:
|
|
Enabled: true
|
|
|
|
# Seems to be buggy and flags non-redundant line continuations as redundant
|
|
Style/RedundantLineContinuation:
|
|
Enabled: false
|
|
|
|
RSpec/DescribeMethod:
|
|
Enabled: false
|
|
|
|
Style/FrozenStringLiteralComment:
|
|
Enabled: true
|
|
|
|
Style/BlockComments:
|
|
Enabled: false
|
|
|
|
Layout/HeredocIndentation:
|
|
Enabled: false
|
|
|
|
Layout/SpaceInsideHashLiteralBraces:
|
|
Exclude:
|
|
- 'views/**/*.erb'
|
|
|
|
Layout/EmptyLinesAroundMethodBody:
|
|
Enabled: false
|
|
|
|
Lint/UnderscorePrefixedVariableName:
|
|
Enabled: false
|
|
|
|
RSpec/AnyInstance:
|
|
Enabled: false
|
|
|
|
RSpec/ExampleLength:
|
|
Enabled: false
|
|
|
|
RSpec/MultipleExpectations:
|
|
Enabled: false
|
|
|
|
RSpec/StubbedMock:
|
|
Enabled: false
|
|
|
|
RSpec/MessageSpies:
|
|
Enabled: false
|
|
|
|
RSpec/SubjectStub:
|
|
Enabled: false
|
|
|
|
RSpec/ExpectInHook:
|
|
Enabled: false
|
|
|
|
RSpec/InstanceVariable:
|
|
Enabled: false
|
|
|
|
RSpec/SpecFilePathFormat:
|
|
Exclude:
|
|
- 'spec/routes/**/*.rb'
|
|
|
|
RSpec/MultipleMemoizedHelpers:
|
|
Enabled: false
|
|
|
|
Sequel/IrreversibleMigration:
|
|
Enabled: false
|
|
|
|
Capybara/ClickLinkOrButtonStyle:
|
|
EnforcedStyle: strict
|
|
|
|
Lint/UselessTimes:
|
|
Enabled: false
|
|
|
|
Lint/ConstantDefinitionInBlock:
|
|
Enabled: false
|