Skip to content
Snippets Groups Projects
Select Git revision
  • 121d1abd74cfec4a98e2d68a276e05b36cfaad2a
  • main default protected
2 results

rubocop-base.yml

Blame
  • rubocop-base.yml 3.73 KiB
    require:
      - rubocop-performance
    
    # gem 'rubocop', '1.71.0', require: false
    # gem 'rubocop-performance', '1.23.1', require: false
    AllCops:
      NewCops: enable # pending cops get enabled by default and must be disabled by hand, if needed
    
    
    # BEGIN Customizations
    # 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 ['test/**/*', 'config/**/*', 'db/**/*']
    
    # 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
    
    # 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
    
    # default is too restrictive, allow longer modules
    Metrics/ModuleLength:
      CountAsOne: *array_hash_heredoc_method_call # default: []
      Max: 300 # default: 100
      Exclude: *test_config_db
    
    # long parameter lists add too much complexity, keyword args are named and thus more obvious what is expected, ignore them
    Metrics/ParameterLists:
      CountKeywordArgs: false # default: true