Skip to content

Commit

Permalink
Merge pull request #791 from chef/rubocop_1.2
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 authored Nov 5, 2020
2 parents a9ea8f9 + 8d85e93 commit 0a42aa6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
6 changes: 6 additions & 0 deletions config/disable_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ Lint/NestedPercentLiteral:
Enabled: false
Lint/NextWithoutAccumulator:
Enabled: false
Lint/NoReturnInBeginEndBlocks:
Enabled: false
Lint/NonDeterministicRequireOrder:
Enabled: false
Lint/NonLocalExitFromIterator:
Expand Down Expand Up @@ -515,6 +517,8 @@ Style/ClassMethodsDefinitions:
Enabled: false
Style/ClassVars:
Enabled: false
Style/CollectionCompact:
Enabled: false
Style/CollectionMethods:
Enabled: false
Style/ColonMethodCall:
Expand Down Expand Up @@ -689,6 +693,8 @@ Style/MutableConstant:
Enabled: false
Style/NegatedIf:
Enabled: false
Style/NegatedIfElseCondition:
Enabled: false
Style/NegatedUnless:
Enabled: false
Style/NegatedWhile:
Expand Down
36 changes: 31 additions & 5 deletions config/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,7 @@ Lint/ElseLayout:
Description: 'Check for odd code arrangement in an else block.'
Enabled: true
VersionAdded: '0.17'
VersionChanged: '1.2'

Lint/EmptyBlock:
Description: 'This cop checks for blocks without a body.'
Expand Down Expand Up @@ -1679,6 +1680,11 @@ Lint/NextWithoutAccumulator:
Enabled: true
VersionAdded: '0.36'

Lint/NoReturnInBeginEndBlocks:
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
Enabled: pending
VersionAdded: '1.2'

Lint/NonDeterministicRequireOrder:
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
Enabled: true
Expand Down Expand Up @@ -2036,8 +2042,9 @@ Lint/UselessMethodDefinition:
Lint/UselessSetterCall:
Description: 'Checks for useless setter call to a local variable.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.13'
VersionChanged: '0.80'
VersionChanged: '1.2'
Safe: false

Lint/UselessTimes:
Expand Down Expand Up @@ -2181,6 +2188,7 @@ Naming/BinaryOperatorParameterName:
StyleGuide: '#other-arg'
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.2'

Naming/BlockParameterName:
Description: >-
Expand Down Expand Up @@ -2287,6 +2295,7 @@ Naming/HeredocDelimiterCase:
StyleGuide: '#heredoc-delimiters'
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.2'
EnforcedStyle: uppercase
SupportedStyles:
- lowercase
Expand All @@ -2305,7 +2314,7 @@ Naming/MemoizedInstanceVariableName:
Memoized method name should match memo instance variable name.
Enabled: true
VersionAdded: '0.53'
VersionChanged: '0.58'
VersionChanged: '1.2'
EnforcedStyleForLeadingUnderscores: disallowed
SupportedStylesForLeadingUnderscores:
- disallowed
Expand Down Expand Up @@ -2403,14 +2412,18 @@ Naming/VariableName:
- camelCase

Naming/VariableNumber:
Description: 'Use the configured style when numbering variables.'
Description: 'Use the configured style when numbering symbols, methods and variables.'
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.2'
EnforcedStyle: normalcase
SupportedStyles:
- snake_case
- normalcase
- non_integer
CheckMethodNames: true
CheckSymbols: true

#################### Security ##############################

Expand Down Expand Up @@ -2789,6 +2802,11 @@ Style/ClassVars:
Enabled: true
VersionAdded: '0.13'

Style/CollectionCompact:
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
Enabled: pending
VersionAdded: '1.2'

# Align with the style guide.
Style/CollectionMethods:
Description: 'Preferred collection methods.'
Expand Down Expand Up @@ -2986,7 +3004,7 @@ Style/DoubleNegation:
StyleGuide: '#no-bang-bang'
Enabled: true
VersionAdded: '0.19'
VersionChanged: '0.84'
VersionChanged: '1.2'
EnforcedStyle: allowed_in_returns
SafeAutoCorrect: false
SupportedStyles:
Expand Down Expand Up @@ -3611,6 +3629,13 @@ Style/NegatedIf:
- prefix
- postfix

Style/NegatedIfElseCondition:
Description: >-
This cop checks for uses of `if-else` and ternary operators with a negated condition
which can be simplified by inverting condition and swapping branches.
Enabled: pending
VersionAdded: '1.2'

Style/NegatedUnless:
Description: 'Favor if over unless for negative conditions.'
StyleGuide: '#if-for-negatives'
Expand Down Expand Up @@ -3888,11 +3913,12 @@ Style/RaiseArgs:
StyleGuide: '#exception-class-messages'
Enabled: true
VersionAdded: '0.14'
VersionChanged: '0.40'
VersionChanged: '1.2'
EnforcedStyle: exploded
SupportedStyles:
- compact # raise Exception.new(msg)
- exploded # raise Exception, msg
AllowedCompactTypes: []

Style/RandomWithOffset:
Description: >-
Expand Down
2 changes: 1 addition & 1 deletion lib/cookstyle/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Cookstyle
VERSION = "7.0.3" # rubocop: disable Style/StringLiterals
RUBOCOP_VERSION = '1.1.0'
RUBOCOP_VERSION = '1.2.0'
end

0 comments on commit 0a42aa6

Please sign in to comment.