Created
September 3, 2018 00:30
-
-
Save klenwell/fe97d0457763c89d37af657327de1f80 to your computer and use it in GitHub Desktop.
Rubocop Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based off: https://gist.github.com/jhass/a5ae80d87f18e53e7b56 | |
AllCops: | |
Exclude: | |
- 'bin/**/*' | |
- 'db/**/*' | |
- 'config/**/*' | |
- 'script/**/*' | |
- 'Guardfile' | |
- !ruby/regexp /old_and_unused\.rb$/ | |
TargetRubyVersion: 2.5 | |
Rails: | |
Enabled: true | |
# Rails 5 Only | |
Rails/HttpPositionalArguments: | |
Enabled: false | |
# Commonly used screens these days easily fit more than 80 characters. | |
Metrics/LineLength: | |
Max: 100 | |
# Too short methods lead to extraction of single-use methods, which can make | |
# the code easier to read (by naming things), but can also clutter the class | |
Metrics/MethodLength: | |
Max: 20 | |
# The guiding principle of classes is SRP, SRP can't be accurately measured by LoC | |
Metrics/ClassLength: | |
Max: 1500 | |
# No space makes the method definition shorter and differentiates | |
# from a regular assignment. | |
Layout/SpaceAroundEqualsInParameterDefault: | |
EnforcedStyle: no_space | |
# Do not enforce string literals. | |
Style/StringLiterals: | |
Enabled: false | |
# We do not need to support Ruby 1.9, so this is good to use. | |
Style/SymbolArray: | |
Enabled: true | |
# Most readable form. | |
#Style/AlignHash: | |
# EnforcedHashRocketStyle: table | |
# EnforcedColonStyle: table | |
# Mixing the styles looks just silly. | |
Style/HashSyntax: | |
EnforcedStyle: ruby19_no_mixed_keys | |
# This cop no longer recognized. | |
# has_key? and has_value? are far more readable than key? and value? | |
#Style/DeprecatedHashMethods: | |
# Enabled: false | |
# Options: format, sprintf, percent | |
#Style/FormatString: | |
# EnforcedStyle: false | |
Style/CollectionMethods: | |
Enabled: true | |
PreferredMethods: | |
# inject seems more common in the community. | |
reduce: "inject" | |
# Either allow this style or don't. Marking it as safe with parenthesis | |
# is silly. Let's try to live without them for now. | |
Style/ParenthesesAroundCondition: | |
AllowSafeAssignment: false | |
Lint/AssignmentInCondition: | |
AllowSafeAssignment: false | |
# A specialized exception class will take one or more arguments and construct the message from it. | |
# So both variants make sense. | |
Style/RaiseArgs: | |
Enabled: false | |
# Indenting the chained dots beneath each other is not supported by this cop, | |
# see https://github.com/bbatsov/rubocop/issues/1633 | |
Layout/MultilineOperationIndentation: | |
Enabled: false | |
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain. | |
# The argument that fail should be used to abort the program is wrong too, | |
# there's Kernel#abort for that. | |
Style/SignalException: | |
EnforcedStyle: only_raise | |
# Suppressing exceptions can be perfectly fine, and be it to avoid to | |
# explicitly type nil into the rescue since that's what you want to return, | |
# or suppressing LoadError for optional dependencies | |
Lint/HandleExceptions: | |
Enabled: false | |
#Style/SpaceInsideBlockBraces: | |
# The space here provides no real gain in readability while consuming | |
# horizontal space that could be used for a better parameter name. | |
# Also {| differentiates better from a hash than { | does. | |
# SpaceBeforeBlockParameters: false | |
# { ... } for multi-line blocks is okay, follow Weirichs rule instead: | |
# https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc | |
Style/BlockDelimiters: | |
Enabled: false | |
# do / end blocks should be used for side effects, | |
# methods that run a block for side effects and have | |
# a useful return value are rare, assign the return | |
# value to a local variable for those cases. | |
Style/MethodCalledOnDoEndBlock: | |
Enabled: true | |
# Enforcing the names of variables? To single letter ones? Just no. | |
Style/SingleLineBlockParams: | |
Enabled: false | |
# Shadowing outer local variables with block parameters is often useful | |
# to not reinvent a new name for the same thing, it highlights the relation | |
# between the outer variable and the parameter. The cases where it's actually | |
# confusing are rare, and usually bad for other reasons already, for example | |
# because the method is too long. | |
Lint/ShadowingOuterLocalVariable: | |
Enabled: false | |
# Check with yard instead. | |
Style/Documentation: | |
Enabled: false | |
# There are valid cases, for example debugging Cucumber steps, | |
# also they'll fail CI anyway | |
Lint/Debugger: | |
Enabled: false | |
# Style preference | |
Style/MethodDefParentheses: | |
Enabled: false | |
# Ignore missing magic comments. | |
# For more information see: | |
# https://stackoverflow.com/a/37799399/6763239 | |
# https://github.com/bbatsov/rubocop/issues/3284#issuecomment-230407753 | |
Style/FrozenStringLiteralComment: | |
Enabled: false | |
# Rubcop prefers: Use (entry % 5).zero? instead of entry % 5 == 0 | |
# We don't. | |
Style/NumericPredicate: | |
Enabled: false | |
# Don't require word arrays. | |
Style/WordArray: | |
Enabled: false | |
# Allow compact style module/class definitions: e.g. class ActiveSupport::TestCase | |
Style/ClassAndModuleChildren: | |
Enabled: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment