Select Git revision
rubocop-for-gem.yml
rubocop-for-gem.yml 5.57 KiB
require:
- rubocop-minitest
- rubocop-packaging
- rubocop-performance
- rubocop-rails
# gem "rubocop", "1.71.0", require: false
# gem "rubocop-minitest", "0.36.0", require: false
# gem "rubocop-performance", "1.23.1", require: false
# gem "rubocop-packaging", "0.5.2", require: false
AllCops:
NewCops: enable # pending cops get enabled by default and must be disabled by hand, if needed
# BEGIN Customizations
# BEGIN Gemspec
# our custom gems are not uploaded to rubygems.org, so this is unnecessary
Gemspec/RequireMFA:
Enabled: false
# END Gemspec
# BEGIN Layout
# only before, enforcing also after adds too many blank lines
Layout/EmptyLinesAroundAccessModifier:
EnforcedStyle: only_before # default: around
# indent first element one level deeper than the 'parent'
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent # default: special_inside_parentheses
# indent first element one level deeper than the 'parent'
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent # default: special_inside_parentheses
# every screen should be able to handle 150 characters
Layout/LineLength:
Max: 150 # default: 120
# indent each method call one level deeper than the 'parent'
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented # default: aligned
# END Layout
# BEGIN Metrics
# too restrictive, this kind of high complexity is needed at times
Metrics/AbcSize:
Enabled: false
# default is too restrictive, however, having some restriction incentivizes to use helper methods
Metrics/BlockLength:
AllowedMethods: ['class_eval', 'module_eval', 'refine'] # default: 'refine'
CountAsOne: &array_hash_heredoc_method_call ['array', 'hash', 'heredoc', 'method_call'] # default: []
Exclude: &test_config_db_gemspec_subconfig ['test/**/*', 'config/**/*', 'db/**/*', '*.gemspec', '**/*/*config.rb']
# default is too restrictive, having some restriction incentivizes to split up overly large classes
Metrics/ClassLength:
CountAsOne: *array_hash_heredoc_method_call # default: []
Max: 300 # default: 100
Exclude: *test_config_db_gemspec_subconfig
# default is too restrictive, allow higher complexity
Metrics/CyclomaticComplexity:
Max: 14 # default: 7
# default is too restrictive, allow longer methods
Metrics/MethodLength:
CountAsOne: *array_hash_heredoc_method_call # default: []
Max: 30 # default: 10
Exclude: *test_config_db_gemspec_subconfig