Skip to content

Instantly share code, notes, and snippets.

@raskhadafi
Created January 27, 2021 06:10
Show Gist options
  • Save raskhadafi/09c78fde9857a3668b5cd71c1f06103b to your computer and use it in GitHub Desktop.
Save raskhadafi/09c78fde9857a3668b5cd71c1f06103b to your computer and use it in GitHub Desktop.
Rubocop configuration for rails projects
AllCops:
Exclude:
- 'vendor/**/*'
- 'node_modules/**/*'
- 'db/fixtures/**/*'
- 'db/schema.rb'
- 'tmp/**/*'
- 'bin/**/*'
- 'generator_templates/**/*'
- 'builds/**/*'
- 'plugins/**/*'
CacheRootDirectory: tmp
# Layout section
Layout/EmptyLinesAroundClassBody:
EnforcedStyle: empty_lines_special
Exclude:
- 'db/**/*'
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
Layout/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space
Layout/IndentationConsistency:
EnforcedStyle: indented_internal_methods
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Layout/LineLength:
Max: 140
# Metrics section
Metrics/BlockLength:
Exclude:
- 'config/**/*'
- '*.gemspec'
# Naming section
Naming/FileName:
ExpectMatchingDefinition: true
Exclude:
- 'db/**/*'
- 'spec/**/*'
- 'config/**/*'
IgnoreExecutableScripts: true
Naming/RescuedExceptionsVariableName:
PreferredName: exception
# Style section
Style/ClassAndModuleChildren:
Exclude:
- 'app/controllers/**/*'
- 'app/helpers/**/*'
- 'app/models/**/*'
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/MutableConstant:
Enabled: true
Exclude:
- 'db/migrate/**/*'
- 'db/post_migrate/**/*'
Style/SafeNavigation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: true
Exclude:
- 'config.ru'
- 'Gemfile'
- 'Rakefile'
- 'app/views/**/*'
- 'config/**/*'
- 'db/**/*'
- 'lib/tasks/**/*'
- 'scripts/**/*'
- 'spec/**/*'
Style/ReturnNil:
Enabled: true
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: consistent_comma
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/BlockDelimiters:
EnforcedStyle: semantic
Style/Documentation:
Exclude:
- 'db/**/*'
Style/LambdaCall: # Disabled cause of trailblazer
Enabled: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment