Update Rubocop configuration to target Ruby 2.6 and use safe autocorrect (#1713) [ci skip]

This commit is contained in:
rhymes 2019-02-06 23:16:02 +01:00 committed by Mac Siri
parent a34051a7d6
commit f23ead7a94
4 changed files with 73 additions and 78 deletions

View file

@ -2,7 +2,7 @@ version: "2"
plugins:
rubocop:
enabled: true
channel: rubocop-0-60
channel: rubocop-0-63
brakeman:
enabled: true
eslint:

View file

@ -7,7 +7,7 @@ require: rubocop-rspec
RSpec/MultipleExpectations:
# Max: 1
Exclude:
- "spec/features/**/*"
- 'spec/features/**/*'
RSpec/DescribeClass:
Exclude:
@ -34,7 +34,7 @@ AllCops:
- node_modules/**/*
DisplayStyleGuide: true
ExtraDetails: true
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
@ -113,29 +113,29 @@ Style/ColonMethodCall:
Style/CommentAnnotation:
Description: >-
Checks formatting of special comments
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Checks formatting of special comments
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
Enabled: false
Metrics/AbcSize:
Description: >-
A calculated magnitude based on number of assignments,
branches, and conditions.
A calculated magnitude based on number of assignments,
branches, and conditions.
Enabled: false
# TODO: Uncomment it after fix rubocop-todo Metrics/BlockLength
Metrics/BlockLength:
CountComments: false # count full line comments?
# Max: 25
CountComments: false # count full line comments?
# Max: 25
ExcludedMethods: []
Exclude:
- "spec/**/*"
- 'spec/**/*'
Metrics/CyclomaticComplexity:
Description: >-
A complexity metric that is strongly correlated to the number
of test cases needed to validate a method.
A complexity metric that is strongly correlated to the number
of test cases needed to validate a method.
Enabled: false
Rails/Delegate:
@ -205,8 +205,8 @@ Style/GuardClause:
Style/IfUnlessModifier:
Description: >-
Favor modifier if/unless usage when you have a
single-line body.
Favor modifier if/unless usage when you have a
single-line body.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
Enabled: false
@ -231,8 +231,8 @@ Style/LambdaCall:
Style/LineEndConcatenation:
Description: >-
Use \ instead of + or << to concatenate two string literals at
line end.
Use \ instead of + or << to concatenate two string literals at
line end.
Enabled: false
Metrics/MethodLength:
@ -252,8 +252,8 @@ Style/MultilineBlockChain:
Style/NegatedIf:
Description: >-
Favor unless over if for negative conditions
(or control flow or).
Favor unless over if for negative conditions
(or control flow or).
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
Enabled: false
@ -279,15 +279,15 @@ Style/Not:
Style/NumericLiterals:
Description: >-
Add underscores to large numeric literals to improve their
readability.
Add underscores to large numeric literals to improve their
readability.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
Enabled: false
Style/OneLineConditional:
Description: >-
Favor the ternary operator(?:) over
if/then/else/end constructs.
Favor the ternary operator(?:) over
if/then/else/end constructs.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
Enabled: false
@ -336,8 +336,8 @@ Style/RegexpLiteral:
Style/SelfAssignment:
Description: >-
Checks for places where self-assignment shorthand should have
been used.
Checks for places where self-assignment shorthand should have
been used.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
Enabled: false
@ -392,8 +392,8 @@ Style/TrivialAccessors:
Style/VariableInterpolation:
Description: >-
Don't interpolate global, instance and class variables
directly in strings.
Don't interpolate global, instance and class variables
directly in strings.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
Enabled: false
@ -404,8 +404,8 @@ Style/WhenThen:
Style/WhileUntilModifier:
Description: >-
Favor modifier while/until usage when you have a
single-line body.
Favor modifier while/until usage when you have a
single-line body.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
Enabled: false
@ -423,8 +423,8 @@ Layout/AlignParameters:
Layout/ConditionPosition:
Description: >-
Checks for condition placed in a confusing position relative to
the keyword.
Checks for condition placed in a confusing position relative to
the keyword.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
Enabled: false
@ -439,15 +439,15 @@ Layout/ExtraSpacing:
Layout/MultilineOperationIndentation:
Description: >-
Checks indentation of binary operations that span more than
one line.
Checks indentation of binary operations that span more than
one line.
Enabled: true
EnforcedStyle: indented
Layout/MultilineMethodCallIndentation:
Description: >-
Checks indentation of method calls with the dot operator
that span more than one line.
Checks indentation of method calls with the dot operator
that span more than one line.
Enabled: true
EnforcedStyle: indented
@ -460,15 +460,15 @@ Layout/InitialIndentation:
Lint/AmbiguousOperator:
Description: >-
Checks for ambiguous operators in the first argument of a
method invocation without parentheses.
Checks for ambiguous operators in the first argument of a
method invocation without parentheses.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
Enabled: false
Lint/AmbiguousRegexpLiteral:
Description: >-
Checks for ambiguous regexp literals in the first argument of
a method invocation without parenthesis.
Checks for ambiguous regexp literals in the first argument of
a method invocation without parenthesis.
Enabled: false
Lint/AssignmentInCondition:
@ -515,8 +515,8 @@ Lint/LiteralInInterpolation:
Lint/Loop:
Description: >-
Use Kernel#loop with break rather than begin/end/until or
begin/end/while for post-loop tests.
Use Kernel#loop with break rather than begin/end/until or
begin/end/while for post-loop tests.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
Enabled: false
@ -531,15 +531,15 @@ Lint/NonLocalExitFromIterator:
Lint/ParenthesesAsGroupedExpression:
Description: >-
Checks for method calls with a space before the opening
parenthesis.
Checks for method calls with a space before the opening
parenthesis.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
Enabled: false
Lint/RequireParentheses:
Description: >-
Use parentheses in the method call to avoid confusion
about precedence.
Use parentheses in the method call to avoid confusion
about precedence.
Enabled: false
Lint/UnderscorePrefixedVariableName:
@ -548,9 +548,9 @@ Lint/UnderscorePrefixedVariableName:
Lint/UnneededCopDisableDirective:
Description: >-
Checks for rubocop:disable comments that can be removed.
Note: this cop is not disabled when disabling all cops.
It must be explicitly disabled.
Checks for rubocop:disable comments that can be removed.
Note: this cop is not disabled when disabling all cops.
It must be explicitly disabled.
Enabled: false
Lint/Void:
@ -561,29 +561,29 @@ Lint/Void:
Performance/CaseWhenSplat:
Description: >-
Place `when` conditions that use splat at the end
of the list of `when` branches.
Place `when` conditions that use splat at the end
of the list of `when` branches.
Enabled: false
Performance/Count:
Description: >-
Use `count` instead of `select...size`, `reject...size`,
`select...count`, `reject...count`, `select...length`,
and `reject...length`.
Use `count` instead of `select...size`, `reject...size`,
`select...count`, `reject...count`, `select...length`,
and `reject...length`.
Enabled: false
Performance/Detect:
Description: >-
Use `detect` instead of `select.first`, `find_all.first`,
`select.last`, and `find_all.last`.
Use `detect` instead of `select.first`, `find_all.first`,
`select.last`, and `find_all.last`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
Enabled: false
Performance/FlatMap:
Description: >-
Use `Enumerable#flat_map`
instead of `Enumerable#map...Array#flatten(1)`
or `Enumberable#collect..Array#flatten(1)`
Use `Enumerable#flat_map`
instead of `Enumerable#map...Array#flatten(1)`
or `Enumberable#collect..Array#flatten(1)`
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
Enabled: false
@ -594,23 +594,23 @@ Performance/ReverseEach:
Performance/Sample:
Description: >-
Use `sample` instead of `shuffle.first`,
`shuffle.last`, and `shuffle[Fixnum]`.
Use `sample` instead of `shuffle.first`,
`shuffle.last`, and `shuffle[Fixnum]`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
Enabled: false
Performance/Size:
Description: >-
Use `size` instead of `count` for counting
the number of elements in `Array` and `Hash`.
Use `size` instead of `count` for counting
the number of elements in `Array` and `Hash`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
Enabled: false
Performance/StringReplacement:
Description: >-
Use `tr` instead of `gsub` when you are replacing the same
number of characters. Use `delete` instead of `gsub` when
you are deleting characters.
Use `tr` instead of `gsub` when you are replacing the same
number of characters. Use `delete` instead of `gsub` when
you are deleting characters.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
Enabled: false
@ -622,8 +622,8 @@ Rails/ActionFilter:
Rails/Date:
Description: >-
Checks the correct usage of date aware methods,
such as Date.today, Date.current etc.
Checks the correct usage of date aware methods,
such as Date.today, Date.current etc.
Enabled: true
Rails/FindBy:
@ -644,8 +644,8 @@ Rails/Output:
Rails/ReadWriteAttribute:
Description: >-
Checks for read_attribute(:attr) and
write_attribute(:attr, val).
Checks for read_attribute(:attr) and
write_attribute(:attr, val).
Enabled: false
Rails/ScopeArgs:

View file

@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-01-02 20:59:45 +0100 using RuboCop version 0.59.2.
# on 2019-02-02 16:50:41 +0100 using RuboCop version 0.63.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@ -12,7 +12,7 @@
Metrics/BlockLength:
Max: 69
# Offense count: 17
# Offense count: 18
Metrics/PerceivedComplexity:
Max: 15
@ -22,7 +22,7 @@ RSpec/FilePath:
Exclude:
- 'spec/liquid_tags/raw_tag_spec.rb'
# Offense count: 15
# Offense count: 20
# Configuration parameters: AggregateFailuresByDefault.
RSpec/MultipleExpectations:
Max: 6
@ -49,12 +49,7 @@ Style/ClassAndModuleChildren:
- 'app/controllers/notifications/counts_controller.rb'
- 'app/controllers/notifications/reads_controller.rb'
# Offense count: 1
Style/EvalWithLocation:
Exclude:
- 'app/controllers/omniauth_callbacks_controller.rb'
# Offense count: 1181
# Offense count: 1283
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:

View file

@ -26,7 +26,7 @@
"git add"
],
"{app,spec}/**/*.rb": [
"bin/rubocop --require rubocop-rspec --auto-correct",
"bin/rubocop --require rubocop-rspec --safe-auto-correct",
"git add"
],
"app/**/*.html.erb": [