Skip to content

Instantly share code, notes, and snippets.

@noelrappin
Created May 4, 2017 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noelrappin/309d257e085d5c480591d21d1fad4a82 to your computer and use it in GitHub Desktop.
Save noelrappin/309d257e085d5c480591d21d1fad4a82 to your computer and use it in GitHub Desktop.
# Rubocop file I use for book code
# Note, this is code I work on by myself, so some. things that I don't do I may not have covered
AllCops:
Exclude:
- "db/schema.rb"
- ".bundle/**/*"
- "bin/**/*"
- "vendor/**/*"
TargetRubyVersion: 2.4
Rails:
Enabled: true
# I turn off all the size things, normally I don't have a problem with them and they are just annoying
Metrics/AbcSize:
Enabled: false
# But for a book the lines do need to be below a certain width to fit. In normal project code I'd
# usually have this higher
Metrics/LineLength:
Max: 80
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Rails/FilePath:
Enabled: false
# I'm trying to get Rubocop to enforce a 4-space continuation indent, which it sort of does, but not really
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
IndentationWidth: 4
Style/CaseEquality:
Enabled: false
Style/ClassAndModuleChildren:
Exclude:
- "app/controllers/**/*"
- "app/helpers/**/*"
Style/EmptyLinesAroundBlockBody:
Exclude:
- "spec/**/*"
- "lib/tasks/*.rake"
Style/EmptyLinesAroundClassBody:
EnforcedStyle: empty_lines
Style/EmptyLinesAroundModuleBody:
EnforcedStyle: empty_lines
Style/FirstParameterIndentation:
IndentationWidth: 4
Style/FrozenStringLiteralComment:
Enabled: false
Style/IndentArray:
IndentationWidth: 4
Style/IndentAssignment:
IndentationWidth: 4
Style/IndentHash:
IndentationWidth: 4
Style/MultilineMethodCallBraceLayout:
EnforcedStyle: same_line
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
IndentationWidth: 4
Style/MultilineHashBraceLayout:
EnforcedStyle: same_line
Style/MultilineOperationIndentation:
EnforcedStyle: indented
IndentationWidth: 4
Style/SignalException:
EnforcedStyle: only_raise
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/TrivialAccessors:
ExactNameMatch: true
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: no_comma
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: no_comma
# space for blocks, no space for hashes, to tell them apart easily
Style/SpaceInsideBlockBraces:
EnforcedStyle: space
EnforcedStyleForEmptyBraces: no_space
SpaceBeforeBlockParameters: true
Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
EnforcedStyleForEmptyBraces: no_space
Style/Documentation:
Enabled: false
Style/BlockDelimiters:
Exclude:
- "spec/**/*" # because let statements use braces for multiline blocks
Style/BlockEndNewline:
Exclude:
- "spec/**/*" # because let statements use braces for multiline blocks
Style/MultilineBlockLayout:
Exclude:
- "spec/**/*" # because let statements use braces for multiline blocks
Style/Semicolon:
AllowAsExpressionSeparator: true
Exclude:
- "spec/**/*" # because sometimes we use this in expect or then blocks
Style/RaiseArgs:
Enabled: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment