aboutsummaryrefslogtreecommitdiffstats
path: root/.rubocop.yml
diff options
context:
space:
mode:
Diffstat (limited to '.rubocop.yml')
-rw-r--r--.rubocop.yml108
1 files changed, 96 insertions, 12 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index eb410376fe..3dbd4a27a6 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,7 +1,5 @@
-require: './ci/custom_cops/lib/custom_cops'
-
AllCops:
- TargetRubyVersion: 2.4
+ TargetRubyVersion: 2.5
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
@@ -9,11 +7,27 @@ AllCops:
- '**/templates/**/*'
- '**/vendor/**/*'
- 'actionpack/lib/action_dispatch/journey/parser.rb'
+ - 'railties/test/fixtures/tmp/**/*'
+ - 'actionmailbox/test/dummy/**/*'
+ - 'actiontext/test/dummy/**/*'
+ - '**/node_modules/**/*'
+
+Performance:
+ Exclude:
+ - '**/test/**/*'
+
+Rails:
+ Enabled: true
+
+# Prefer assert_not over assert !
+Rails/AssertNot:
+ Include:
+ - '**/test/**/*'
# Prefer assert_not_x over refute_x
-CustomCops/RefuteNot:
+Rails/RefuteMethods:
Include:
- - '**/*_test.rb'
+ - '**/test/**/*'
# Prefer &&/|| over and/or.
Style/AndOr:
@@ -36,9 +50,19 @@ Layout/CommentIndentation:
Layout/ElseAlignment:
Enabled: true
+# Align `end` with the matching keyword or starting expression except for
+# assignments, where it should be aligned with the LHS.
+Layout/EndAlignment:
+ Enabled: true
+ EnforcedStyleAlignWith: variable
+ AutoCorrect: true
+
Layout/EmptyLineAfterMagicComment:
Enabled: true
+Layout/EmptyLinesAroundBlockBody:
+ Enabled: true
+
# In a regular class definition, no empty lines around the body.
Layout/EmptyLinesAroundClassBody:
Enabled: true
@@ -77,6 +101,9 @@ Layout/SpaceAfterColon:
Layout/SpaceAfterComma:
Enabled: true
+Layout/SpaceAfterSemicolon:
+ Enabled: true
+
Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true
@@ -87,10 +114,13 @@ Layout/SpaceAroundOperators:
Enabled: true
Layout/SpaceBeforeComma:
- Enabled: true
+ Enabled: true
+
+Layout/SpaceBeforeComment:
+ Enabled: true
Layout/SpaceBeforeFirstArg:
- Enabled: true
+ Enabled: true
Style/DefWithParentheses:
Enabled: true
@@ -108,6 +138,12 @@ Style/FrozenStringLiteralComment:
- 'actionpack/test/**/*.builder'
- 'actionpack/test/**/*.ruby'
- 'activestorage/db/migrate/**/*.rb'
+ - 'activestorage/db/update_migrate/**/*.rb'
+ - 'actionmailbox/db/migrate/**/*.rb'
+ - 'actiontext/db/migrate/**/*.rb'
+
+Style/RedundantFreeze:
+ Enabled: true
# Use `foo {}` not `foo{}`.
Layout/SpaceBeforeBlockBraces:
@@ -116,6 +152,7 @@ Layout/SpaceBeforeBlockBraces:
# Use `foo { bar }` not `foo {bar}`.
Layout/SpaceInsideBlockBraces:
Enabled: true
+ EnforcedStyleForEmptyBraces: space
# Use `{ a: 1 }` not `{a:1}`.
Layout/SpaceInsideHashLiteralBraces:
@@ -145,17 +182,40 @@ Layout/TrailingWhitespace:
Style/UnneededPercentQ:
Enabled: true
-# Align `end` with the matching keyword or starting expression except for
-# assignments, where it should be aligned with the LHS.
-Lint/EndAlignment:
+Lint/AmbiguousOperator:
+ Enabled: true
+
+Lint/AmbiguousRegexpLiteral:
+ Enabled: true
+
+Lint/ErbNewArguments:
Enabled: true
- EnforcedStyleAlignWith: variable
- AutoCorrect: true
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
Lint/RequireParentheses:
Enabled: true
+Lint/ShadowingOuterLocalVariable:
+ Enabled: true
+
+Lint/StringConversionInInterpolation:
+ Enabled: true
+
+Lint/UriEscapeUnescape:
+ Enabled: true
+
+Lint/UselessAssignment:
+ Enabled: true
+
+Lint/DeprecatedClassMethods:
+ Enabled: true
+
+Style/ParenthesesAroundCondition:
+ Enabled: true
+
+Style/RedundantBegin:
+ Enabled: true
+
Style/RedundantReturn:
Enabled: true
AllowMultipleReturnValues: true
@@ -167,3 +227,27 @@ Style/Semicolon:
# Prefer Foo.method over Foo::method
Style/ColonMethodCall:
Enabled: true
+
+Style/TrivialAccessors:
+ Enabled: true
+
+Performance/FlatMap:
+ Enabled: true
+
+Performance/RedundantMerge:
+ Enabled: true
+
+Performance/StartWith:
+ Enabled: true
+
+Performance/EndWith:
+ Enabled: true
+
+Performance/RegexpMatch:
+ Enabled: true
+
+Performance/ReverseEach:
+ Enabled: true
+
+Performance/UnfreezeString:
+ Enabled: true