Update rubocop configuration
This commit is contained in:
42
.rubocop/layout.yml
Normal file
42
.rubocop/layout.yml
Normal file
@ -0,0 +1,42 @@
|
||||
# layout cop settings
|
||||
|
||||
Layout/ArgumentAlignment:
|
||||
EnforcedStyle: with_fixed_indentation
|
||||
|
||||
Layout/CaseIndentation:
|
||||
EnforcedStyle: end
|
||||
SupportedStyles:
|
||||
- case
|
||||
- end
|
||||
IndentOneStep: true
|
||||
|
||||
Layout/FirstArrayElementIndentation:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Layout/FirstHashElementIndentation:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
#
|
||||
# There are good reasons for key as well as table style.
|
||||
#
|
||||
Layout/HashAlignment:
|
||||
Enabled: false
|
||||
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- "api/**/*"
|
||||
- "config/**/*"
|
||||
- "db/**/*"
|
||||
- "spec/**/*"
|
||||
Max: 120
|
||||
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
EnforcedStyle: indented
|
||||
|
||||
Layout/SpaceInsideBlockBraces:
|
||||
EnforcedStyle: space
|
||||
EnforcedStyleForEmptyBraces: no_space
|
||||
SpaceBeforeBlockParameters: false
|
||||
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
EnforcedStyle: no_space
|
20
.rubocop/lint.yml
Normal file
20
.rubocop/lint.yml
Normal file
@ -0,0 +1,20 @@
|
||||
# lint cop settings
|
||||
|
||||
#
|
||||
# False positives:
|
||||
# * expect { something }.to change { something } often triggers this
|
||||
#
|
||||
Lint/AmbiguousBlockAssociation:
|
||||
Exclude:
|
||||
- "spec/**/*_spec.rb"
|
||||
|
||||
#Lint/ShadowingOuterLocalVariable:
|
||||
# Exclude:
|
||||
# - "spec/**/*_spec.rb"
|
||||
#
|
||||
##
|
||||
## Assume we know what we do when resucing exception, as we do it much less often
|
||||
## than we actually should.
|
||||
##
|
||||
#Lint/SuppressedException:
|
||||
# Enabled: false
|
39
.rubocop/metrics.yml
Normal file
39
.rubocop/metrics.yml
Normal file
@ -0,0 +1,39 @@
|
||||
# metric cop settings
|
||||
|
||||
#
|
||||
# Method calls add to this metric, but they are everywhere in Ruby, so this
|
||||
# metric caused lots of what we would consider false positives.
|
||||
#
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
||||
Metrics/BlockLength:
|
||||
Exclude:
|
||||
# Common files with e.g. block based DSLs
|
||||
- "db/**/*"
|
||||
- "spec/**/*"
|
||||
- "config/**/*"
|
||||
- "**/*.rake"
|
||||
- "api/**/*"
|
||||
- "Rakefile"
|
||||
- "Guardfile"
|
||||
- "**/*/Rakefile"
|
||||
Max: 50
|
||||
|
||||
Metrics/ClassLength:
|
||||
Max: 200
|
||||
|
||||
#
|
||||
# Often used as a proxy for complexity in a method, but causes many false
|
||||
# positives, e.g. when generating large, but simple, hashes.
|
||||
# We want to rely on CyclomaticComplexity instead.
|
||||
#
|
||||
Metrics/MethodLength:
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# This seems to be the cop that is closest to what we're interested in, which
|
||||
# is the kind of complexity that usually surfaces in deep nesting.
|
||||
#
|
||||
Metrics/CyclomaticComplexity:
|
||||
Enabled: true
|
7
.rubocop/performance.yml
Normal file
7
.rubocop/performance.yml
Normal file
@ -0,0 +1,7 @@
|
||||
# performance cop settings
|
||||
|
||||
# The policy specs should be easy to read
|
||||
#
|
||||
Performance/CollectionLiteralInLoop:
|
||||
Exclude:
|
||||
- 'spec/policies/**'
|
19
.rubocop/rails.yml
Normal file
19
.rubocop/rails.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# rails cop settings
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
|
||||
#
|
||||
# False positives:
|
||||
# * On embedded models in migrations.
|
||||
#
|
||||
Rails/ApplicationRecord:
|
||||
Exclude:
|
||||
- "db/**/*"
|
||||
|
||||
Rails/UnknownEnv:
|
||||
Environments:
|
||||
- development
|
||||
- staging
|
||||
- production
|
||||
- test
|
42
.rubocop/rspec.yml
Normal file
42
.rubocop/rspec.yml
Normal file
@ -0,0 +1,42 @@
|
||||
# rspec cop settings
|
||||
|
||||
RSpec:
|
||||
Include:
|
||||
- "spec/**/*_spec.rb"
|
||||
- "spec/spec_helper.rb"
|
||||
- "spec/rails_helper.rb"
|
||||
|
||||
#
|
||||
# Too stupid. There are also views, templates, request specs etc.
|
||||
#
|
||||
RSpec/DescribeClass:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- "spec/views/**/*_spec.rb"
|
||||
|
||||
RSpec/ExampleLength:
|
||||
Enabled: false
|
||||
|
||||
RSpec/MessageSpies:
|
||||
Enabled: false
|
||||
|
||||
RSpec/MultipleExpectations:
|
||||
Enabled: false
|
||||
|
||||
RSpec/NestedGroups:
|
||||
Max: 7
|
||||
|
||||
# Some of the small example helpers are not recognized correctly
|
||||
#
|
||||
RSpec/EmptyExampleGroup:
|
||||
Enabled: false
|
||||
|
||||
# The Policies need to repeat examples and descriptions and might not be performant
|
||||
#
|
||||
RSpec/RepeatedExample:
|
||||
Exclude:
|
||||
- 'spec/policies/**'
|
||||
|
||||
RSpec/RepeatedDescription:
|
||||
Exclude:
|
||||
- 'spec/policies/**'
|
133
.rubocop/style.yml
Normal file
133
.rubocop/style.yml
Normal file
@ -0,0 +1,133 @@
|
||||
# style cop settings
|
||||
|
||||
#
|
||||
# Nein. Period. Try to keep it English, but there *will* references using
|
||||
# unicode characters.
|
||||
#
|
||||
Style/AsciiComments:
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# Both styles or mixtures are reasonable
|
||||
#
|
||||
Style/ClassAndModuleChildren:
|
||||
EnforcedStyle: compact
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# Maybe a bit uncommon for new devs and often results in heavily indented code
|
||||
# blocks.
|
||||
#
|
||||
Style/ConditionalAssignment:
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# Would be better but unlikely...
|
||||
#
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# Okay for conditions, but false positive in return statements (e.g. APIs)
|
||||
#
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# Our default string token has the '%{value}' format
|
||||
#
|
||||
Style/FormatStringToken:
|
||||
EnforcedStyle: template
|
||||
|
||||
#
|
||||
# Far to often easy to read without.
|
||||
#
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
|
||||
#
|
||||
# IfUnlessModifier has no own line length but we do not want it to force 120
|
||||
# chars long modifiers just because we allow a few long lines.
|
||||
#
|
||||
Style/IfUnlessModifier:
|
||||
Enabled: false
|
||||
|
||||
##
|
||||
## Scripts might include on top-level
|
||||
##
|
||||
#Style/MixinUsage:
|
||||
# Exclude:
|
||||
# - "scripts/**/*"
|
||||
# - "services/*/scripts/**/*"
|
||||
|
||||
#
|
||||
# Well, we do this. To often to disable them. Studid.
|
||||
#
|
||||
Style/MultilineBlockChain:
|
||||
Enabled: false
|
||||
|
||||
#Style/NumericPredicate:
|
||||
# Enabled: false
|
||||
|
||||
Style/RaiseArgs:
|
||||
EnforcedStyle: compact
|
||||
|
||||
##
|
||||
## Quick single line rescues in specs
|
||||
##
|
||||
#Style/RescueModifier:
|
||||
# Exclude:
|
||||
# - "spec/**/*_spec.rb"
|
||||
#
|
||||
##
|
||||
## Quick single line rescues in specs
|
||||
##
|
||||
#Style/RescueStandardError:
|
||||
# Enabled: false
|
||||
|
||||
##
|
||||
## Often used pattern in chaining subjects in specs
|
||||
##
|
||||
#Style/Semicolon:
|
||||
# Exclude:
|
||||
# - "services/*/spec/**/*_spec.rb"
|
||||
# - "spec/**/*_spec.rb"
|
||||
|
||||
Style/SignalException:
|
||||
EnforcedStyle: only_raise
|
||||
|
||||
#
|
||||
# Rails callbacks and all methods action on the arity of the given block will
|
||||
# behave differently if passed a symbol proc.
|
||||
#
|
||||
# See here for more details:
|
||||
# https://github.com/rubocop-hq/rubocop/issues/3071#issuecomment-214550737
|
||||
#
|
||||
# Ignore all known Rails callback methods.
|
||||
#
|
||||
Style/SymbolProc:
|
||||
IgnoredMethods:
|
||||
- after_commit
|
||||
- after_create
|
||||
- after_destroy
|
||||
- after_rollback
|
||||
- after_save
|
||||
- after_update
|
||||
- after_validation
|
||||
- around_create
|
||||
- around_destroy
|
||||
- around_save
|
||||
- around_update
|
||||
- before_create
|
||||
- before_destroy
|
||||
- before_save
|
||||
- before_update
|
||||
- before_validation
|
||||
# Migrations look better with blocks
|
||||
- create_table
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
Reference in New Issue
Block a user