diff --git a/config/disable_all.yml b/config/disable_all.yml index 191967acf..dd4e59f5f 100644 --- a/config/disable_all.yml +++ b/config/disable_all.yml @@ -307,6 +307,8 @@ Lint/NestedPercentLiteral: Enabled: false Lint/NextWithoutAccumulator: Enabled: false +Lint/NoReturnInBeginEndBlocks: + Enabled: false Lint/NonDeterministicRequireOrder: Enabled: false Lint/NonLocalExitFromIterator: @@ -515,6 +517,8 @@ Style/ClassMethodsDefinitions: Enabled: false Style/ClassVars: Enabled: false +Style/CollectionCompact: + Enabled: false Style/CollectionMethods: Enabled: false Style/ColonMethodCall: @@ -689,6 +693,8 @@ Style/MutableConstant: Enabled: false Style/NegatedIf: Enabled: false +Style/NegatedIfElseCondition: + Enabled: false Style/NegatedUnless: Enabled: false Style/NegatedWhile: diff --git a/config/upstream.yml b/config/upstream.yml index cb8e3c162..c539d3149 100644 --- a/config/upstream.yml +++ b/config/upstream.yml @@ -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.' @@ -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 @@ -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: @@ -2181,6 +2188,7 @@ Naming/BinaryOperatorParameterName: StyleGuide: '#other-arg' Enabled: true VersionAdded: '0.50' + VersionChanged: '1.2' Naming/BlockParameterName: Description: >- @@ -2287,6 +2295,7 @@ Naming/HeredocDelimiterCase: StyleGuide: '#heredoc-delimiters' Enabled: true VersionAdded: '0.50' + VersionChanged: '1.2' EnforcedStyle: uppercase SupportedStyles: - lowercase @@ -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 @@ -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 ############################## @@ -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.' @@ -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: @@ -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' @@ -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: >- diff --git a/lib/cookstyle/version.rb b/lib/cookstyle/version.rb index b5dffd1da..52ff5e4f3 100644 --- a/lib/cookstyle/version.rb +++ b/lib/cookstyle/version.rb @@ -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