config/upstream.yml in cookstyle-6.21.1 vs config/upstream.yml in cookstyle-7.0.0

- old
+ new

@@ -311,11 +311,11 @@ # But it can be overridden by setting this parameter IndentationWidth: ~ Layout/BeginEndAlignment: Description: 'Align ends corresponding to begins correctly.' - Enabled: pending + Enabled: true VersionAdded: '0.91' # The value `start_of_line` means that `end` should be aligned the start of the line # where the `begin` keyword is. # The value `begin` means that `end` should be aligned with the `begin` keyword. EnforcedStyleAlignWith: start_of_line @@ -494,11 +494,11 @@ VersionAdded: '0.52' Layout/EmptyLinesAroundAttributeAccessor: Description: "Keep blank lines around attribute accessors." StyleGuide: '#empty-lines-around-attribute-accessor' - Enabled: pending + Enabled: true VersionAdded: '0.83' VersionChanged: '0.84' AllowAliasSyntax: true AllowedMethods: - alias_method @@ -1143,11 +1143,11 @@ Enabled: true VersionAdded: '0.49' Layout/SpaceAroundMethodCallOperator: Description: 'Checks method call operators to not have spaces around them.' - Enabled: pending + Enabled: true VersionAdded: '0.82' Layout/SpaceAroundOperators: Description: 'Use a single space around operators.' StyleGuide: '#spaces-operators' @@ -1332,12 +1332,12 @@ Layout/TrailingWhitespace: Description: 'Avoid trailing whitespace.' StyleGuide: '#no-trailing-whitespace' Enabled: true VersionAdded: '0.49' - VersionChanged: '0.83' - AllowInHeredoc: true + VersionChanged: '1.0' + AllowInHeredoc: false #################### Lint ################################## ### Warnings Lint/AmbiguousBlockAssociation: @@ -1377,11 +1377,11 @@ Enabled: true VersionAdded: '0.53' Lint/BinaryOperatorWithIdenticalOperands: Description: 'This cop checks for places where binary operator has identical operands.' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.89' Lint/BooleanSymbol: Description: 'Check for `:true` and `:false` symbols.' @@ -1396,11 +1396,11 @@ VersionAdded: '0.33' Lint/ConstantDefinitionInBlock: Description: 'Do not define constants within a block.' StyleGuide: '#no-constant-definition-in-block' - Enabled: pending + Enabled: true VersionAdded: '0.91' Lint/ConstantResolution: Description: 'Check that constants are fully qualified with `::`.' Enabled: false @@ -1421,11 +1421,11 @@ Enabled: true VersionAdded: '0.19' Lint/DeprecatedOpenSSLConstant: Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`." - Enabled: pending + Enabled: true VersionAdded: '0.84' Lint/DisjunctiveAssignmentInConstructor: Description: 'In constructor, plain assignment is preferred over disjunctive.' Enabled: true @@ -1438,11 +1438,11 @@ Enabled: true VersionAdded: '0.45' Lint/DuplicateElsifCondition: Description: 'Do not repeat conditions used in if `elsif`.' - Enabled: 'pending' + Enabled: true VersionAdded: '0.88' Lint/DuplicateHashKey: Description: 'Check for duplicate keys in hash literals.' Enabled: true @@ -1452,18 +1452,23 @@ Lint/DuplicateMethods: Description: 'Check for duplicate method definitions.' Enabled: true VersionAdded: '0.29' +Lint/DuplicateRegexpCharacterClassElement: + Description: 'Checks for duplicate elements in Regexp character classes.' + Enabled: pending + VersionAdded: '1.1' + Lint/DuplicateRequire: Description: 'Check for duplicate `require`s and `require_relative`s.' - Enabled: pending + Enabled: true VersionAdded: '0.90' Lint/DuplicateRescueException: Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.' - Enabled: pending + Enabled: true VersionAdded: '0.89' Lint/EachWithObjectArgument: Description: 'Check for immutable argument given to each_with_object.' Enabled: true @@ -1472,13 +1477,19 @@ Lint/ElseLayout: Description: 'Check for odd code arrangement in an else block.' Enabled: true VersionAdded: '0.17' +Lint/EmptyBlock: + Description: 'This cop checks for blocks without a body.' + Enabled: pending + VersionAdded: '1.1' + AllowComments: true + Lint/EmptyConditionalBody: Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.' - Enabled: 'pending' + Enabled: true AllowComments: true VersionAdded: '0.89' Lint/EmptyEnsure: Description: 'Checks for empty ensure block.' @@ -1491,11 +1502,11 @@ Enabled: true VersionAdded: '0.45' Lint/EmptyFile: Description: 'Enforces that Ruby source files are not empty.' - Enabled: pending + Enabled: true AllowComments: true VersionAdded: '0.90' Lint/EmptyInterpolation: Description: 'Checks for empty string interpolation.' @@ -1529,11 +1540,11 @@ VersionAdded: '0.16' Lint/FloatComparison: Description: 'Checks for the presence of precise comparison of floating point numbers.' StyleGuide: '#float-comparison' - Enabled: pending + Enabled: true VersionAdded: '0.89' Lint/FloatOutOfRange: Description: >- Catches floating-point literals too large or small for Ruby to @@ -1547,11 +1558,11 @@ VersionAdded: '0.33' Lint/HashCompareByIdentity: Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.' StyleGuide: '#identity-comparison' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.93' Lint/HeredocMethodCallPosition: Description: >- @@ -1561,11 +1572,11 @@ StyleGuide: '#heredoc-method-calls' VersionAdded: '0.68' Lint/IdentityComparison: Description: 'Prefer `equal?` over `==` when comparing `object_id`.' - Enabled: pending + Enabled: true StyleGuide: '#identity-comparison' VersionAdded: '0.91' Lint/ImplicitStringConcatenation: Description: >- @@ -1633,23 +1644,24 @@ Lint/MissingSuper: Description: >- This cop checks for the presence of constructors and lifecycle callbacks without calls to `super`'. - Enabled: pending + Enabled: true VersionAdded: '0.89' Lint/MixedRegexpCaptureTypes: Description: 'Do not mix named captures and numbered captures in a Regexp literal.' - Enabled: pending + Enabled: true VersionAdded: '0.85' Lint/MultipleComparison: Description: "Use `&&` operator to compare multiple values." Enabled: true VersionAdded: '0.47' - VersionChanged: '0.77' + VersionChanged: '1.1' + AllowMethodComparison: true Lint/NestedMethodDefinition: Description: 'Do not use nested method definitions.' StyleGuide: '#no-nested-methods' Enabled: true @@ -1680,21 +1692,25 @@ Lint/NumberConversion: Description: 'Checks unsafe usage of number conversion methods.' Enabled: false VersionAdded: '0.53' - VersionChanged: '0.70' + VersionChanged: '1.1' SafeAutoCorrect: false + IgnoredMethods: [] + IgnoredClasses: + - Time + - DateTime Lint/OrderedMagicComments: Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.' Enabled: true VersionAdded: '0.53' Lint/OutOfRangeRegexpRef: Description: 'Checks for out of range reference for Regexp because it always returns nil.' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.89' Lint/ParenthesesAsGroupedExpression: Description: >- @@ -1719,11 +1735,11 @@ VersionAdded: '0.41' Lint/RaiseException: Description: Checks for `raise` or `fail` statements which are raising `Exception` class. StyleGuide: '#raise-exception' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.81' VersionChanged: '0.86' AllowedImplicitNamespaces: - 'Gem' @@ -1753,11 +1769,11 @@ Enabled: true VersionAdded: '0.76' Lint/RedundantSafeNavigation: Description: 'Checks for redundant safe navigation calls.' - Enabled: pending + Enabled: true VersionAdded: '0.93' AllowedMethods: - instance_of? - kind_of? - is_a? @@ -1860,11 +1876,11 @@ VersionAdded: '0.49' VersionChanged: '0.50' Lint/SelfAssignment: Description: 'Checks for self-assignments.' - Enabled: pending + Enabled: true VersionAdded: '0.89' Lint/SendWithMixinArgument: Description: 'Checks for `send` method when using mixin.' Enabled: true @@ -1891,11 +1907,11 @@ Enabled: true VersionAdded: '0.9' Lint/StructNewOverride: Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.' - Enabled: pending + Enabled: true VersionAdded: '0.81' Lint/SuppressedException: Description: "Don't suppress exceptions." StyleGuide: '#dont-hide-exceptions' @@ -1908,23 +1924,28 @@ Description: 'Checks syntax error.' Enabled: true VersionAdded: '0.9' +Lint/ToEnumArguments: + Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.' + Enabled: pending + VersionAdded: '1.1' + Lint/ToJSON: Description: 'Ensure #to_json includes an optional argument.' Enabled: true VersionAdded: '0.66' Lint/TopLevelReturnWithArgument: Description: 'This cop detects top level return statements with argument.' - Enabled: 'pending' + Enabled: true VersionAdded: '0.89' Lint/TrailingCommaInAttributeDeclaration: Description: 'This cop checks for trailing commas in attribute declarations.' - Enabled: pending + Enabled: true VersionAdded: '0.90' Lint/UnderscorePrefixedVariableName: Description: 'Do not use prefix `_` for a variable that is used.' Enabled: true @@ -1934,18 +1955,23 @@ Lint/UnifiedInteger: Description: 'Use Integer instead of Fixnum or Bignum.' Enabled: true VersionAdded: '0.43' +Lint/UnmodifiedReduceAccumulator: + Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration. + Enabled: pending + VersionAdded: '1.1' + Lint/UnreachableCode: Description: 'Unreachable code.' Enabled: true VersionAdded: '0.9' Lint/UnreachableLoop: Description: 'This cop checks for loops that will have at most one iteration.' - Enabled: pending + Enabled: true VersionAdded: '0.89' Lint/UnusedBlockArgument: Description: 'Checks for unused block arguments.' StyleGuide: '#underscore-unused-vars' @@ -2000,11 +2026,11 @@ Enabled: true VersionAdded: '0.17' Lint/UselessMethodDefinition: Description: 'Checks for useless method definitions.' - Enabled: pending + Enabled: true VersionAdded: '0.90' Safe: false AllowComments: true Lint/UselessSetterCall: @@ -2014,11 +2040,11 @@ VersionChanged: '0.80' Safe: false Lint/UselessTimes: Description: 'Checks for useless `Integer#times` calls.' - Enabled: pending + Enabled: true VersionAdded: '0.91' Safe: false Lint/Void: Description: 'Possible use of operator/literal/variable in void context.' @@ -2413,13 +2439,14 @@ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations' Enabled: true VersionAdded: '0.47' Security/Open: - Description: 'The use of Kernel#open represents a serious security risk.' + Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.' Enabled: true VersionAdded: '0.53' + VersionChanged: '1.0' Safe: false Security/YAMLLoad: Description: >- Prefer usage of `YAML.safe_load` over `YAML.load` due to potential @@ -2442,11 +2469,11 @@ - group AllowModifiersOnSymbols: true Style/AccessorGrouping: Description: 'Checks for grouping of accessors in `class` and `module` bodies.' - Enabled: 'pending' + Enabled: true VersionAdded: '0.87' EnforcedStyle: grouped SupportedStyles: # separated: each accessor goes in a separate statement. # grouped: accessors are grouped into a single statement. @@ -2475,10 +2502,17 @@ EnforcedStyle: conditionals SupportedStyles: - always - conditionals +Style/ArgumentsForwarding: + Description: 'Use arguments forwarding.' + StyleGuide: '#arguments-forwarding' + Enabled: pending + AllowOnlyRestArgument: true + VersionAdded: '1.1' + Style/ArrayCoercion: Description: >- Use Array() instead of explicit Array check or [*var], when dealing with a variable you want to treat as an Array, but you're not certain it's an array. StyleGuide: '#array-coercion' @@ -2531,11 +2565,11 @@ Style/BisectedAttrAccessor: Description: >- Checks for places where `attr_reader` and `attr_writer` for the same method can be combined into single `attr_accessor`. - Enabled: 'pending' + Enabled: true VersionAdded: '0.87' Style/BlockComments: Description: 'Do not use block comments.' StyleGuide: '#no-block-comments' @@ -2670,11 +2704,11 @@ AllowOnConstant: false Style/CaseLikeIf: Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.' StyleGuide: '#case-vs-if-else' - Enabled: 'pending' + Enabled: true Safe: false VersionAdded: '0.88' Style/CharacterLiteral: Description: 'Checks for uses of character literals.' @@ -2723,11 +2757,11 @@ - kind_of? Style/ClassEqualityComparison: Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.' StyleGuide: '#instance-of-vs-class-comparison' - Enabled: pending + Enabled: true VersionAdded: '0.93' IgnoredMethods: - == - equal? - eql? @@ -2791,11 +2825,11 @@ Style/CombinableLoops: Description: >- Checks for places where multiple consecutive loops over the same data can be combined into a single loop. - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.90' Style/CommandLiteral: Description: 'Use `` or %x around command literals.' @@ -2915,10 +2949,18 @@ Description: >- Forbids disabling/enabling cops within source code. Enabled: false VersionAdded: '0.82' +Style/DocumentDynamicEvalDefinition: + Description: >- + When using `class_eval` (or other `eval`) with string interpolation, + add a comment block showing its appearance if interpolated. + StyleGuide: '#eval-comment-docs' + Enabled: pending + VersionAdded: '1.1' + Style/Documentation: Description: 'Document classes and non-namespace modules.' Enabled: true VersionAdded: '0.9' Exclude: @@ -3044,19 +3086,19 @@ Style/ExplicitBlockArgument: Description: >- Consider using explicit block argument to avoid writing block literal that just passes its arguments to another block. StyleGuide: '#block-argument' - Enabled: pending + Enabled: true # May change the yielding arity. Safe: false VersionAdded: '0.89' Style/ExponentialNotation: Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).' StyleGuide: '#exponential-notation' - Enabled: pending + Enabled: true VersionAdded: '0.82' EnforcedStyle: scientific SupportedStyles: - scientific - engineering @@ -3107,12 +3149,16 @@ # `%<name>s`, `%<age>d`, `%<score>f` - annotated # Prefer simple looking "template" style tokens like `%{name}`, `%{age}` - template - unannotated + # `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated` + # style token in a format string to be allowed when enforced style is not + # `unannotated`. + MaxUnannotatedPlaceholdersAllowed: 1 VersionAdded: '0.49' - VersionChanged: '0.75' + VersionChanged: '1.0' Style/FrozenStringLiteralComment: Description: >- Add the frozen_string_literal comment to the top of files to help transition to frozen string literals by default. @@ -3135,11 +3181,11 @@ SafeAutoCorrect: false Style/GlobalStdStream: Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.' StyleGuide: '#global-stdout' - Enabled: pending + Enabled: true VersionAdded: '0.89' SafeAutoCorrect: false Style/GlobalVars: Description: 'Do not introduce global variables.' @@ -3163,29 +3209,29 @@ Style/HashAsLastArrayItem: Description: >- Checks for presence or absence of braces around hash literal as a last array item depending on configuration. StyleGuide: '#hash-literal-as-last-array-item' - Enabled: 'pending' + Enabled: true VersionAdded: '0.88' EnforcedStyle: braces SupportedStyles: - braces - no_braces Style/HashEachMethods: Description: 'Use Hash#each_key and Hash#each_value.' StyleGuide: '#hash-each' - Enabled: pending + Enabled: true VersionAdded: '0.80' Safe: false Style/HashLikeCase: Description: >- Checks for places where `case-when` represents a simple 1:1 mapping and can be replaced with a hash lookup. - Enabled: 'pending' + Enabled: true VersionAdded: '0.88' # `MinBranchesCount` defines the number of branches `case` needs to have # to trigger this cop MinBranchesCount: 3 @@ -3212,18 +3258,18 @@ # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style PreferHashRocketsForNonAlnumEndingSymbols: false Style/HashTransformKeys: Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.' - Enabled: 'pending' + Enabled: true VersionAdded: '0.80' VersionChanged: '0.90' Safe: false Style/HashTransformValues: Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.' - Enabled: 'pending' + Enabled: true VersionAdded: '0.80' VersionChanged: '0.90' Safe: false Style/IdenticalConditionalBranches: @@ -3326,11 +3372,11 @@ - '**/*.gemspec' Style/KeywordParametersOrder: Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.' StyleGuide: '#keyword-parameters-order' - Enabled: pending + Enabled: true VersionAdded: '0.90' Style/Lambda: Description: 'Use the new lambda literal syntax for single-line blocks.' StyleGuide: '#lambda-multi-line' @@ -3528,10 +3574,11 @@ Description: >- Avoid comparing a variable with multiple items in a conditional, use Array#include? instead. Enabled: true VersionAdded: '0.49' + VersionChanged: '1.1' Style/MutableConstant: Description: 'Do not assign mutable objects to constants.' Enabled: true VersionAdded: '0.34' @@ -3751,11 +3798,11 @@ VersionChanged: '0.83' Style/OptionalBooleanParameter: Description: 'Use keyword arguments when defining method with boolean argument.' StyleGuide: '#boolean-keyword-arguments' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.89' AllowedMethods: - respond_to_missing? @@ -3855,11 +3902,11 @@ Enabled: true VersionAdded: '0.52' Style/RedundantAssignment: Description: 'Checks for redundant assignment before returning.' - Enabled: 'pending' + Enabled: true VersionAdded: '0.87' Style/RedundantBegin: Description: "Don't use begin blocks when they are not needed." StyleGuide: '#begin-implicit' @@ -3892,11 +3939,11 @@ Style/RedundantFetchBlock: Description: >- Use `fetch(key, value)` instead of `fetch(key) { value }` when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant. Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code' - Enabled: 'pending' + Enabled: true Safe: false # If enabled, this cop will autocorrect usages of # `fetch` being called with block returning a constant. # This can be dangerous since constants will not be defined at that moment. SafeForConstants: false @@ -3905,11 +3952,11 @@ Style/RedundantFileExtensionInRequire: Description: >- Checks for the presence of superfluous `.rb` extension in the filename provided to `require` and `require_relative`. StyleGuide: '#no-explicit-rb-to-require' - Enabled: 'pending' + Enabled: true VersionAdded: '0.88' Style/RedundantFreeze: Description: "Checks usages of Object#freeze on immutable objects." Enabled: true @@ -3932,16 +3979,16 @@ Enabled: true VersionAdded: '0.76' Style/RedundantRegexpCharacterClass: Description: 'Checks for unnecessary single-element Regexp character classes.' - Enabled: pending + Enabled: true VersionAdded: '0.85' Style/RedundantRegexpEscape: Description: 'Checks for redundant escapes in Regexps.' - Enabled: pending + Enabled: true VersionAdded: '0.85' Style/RedundantReturn: Description: "Don't use return where it's not required." StyleGuide: '#no-explicit-return' @@ -3958,11 +4005,11 @@ VersionAdded: '0.10' VersionChanged: '0.13' Style/RedundantSelfAssignment: Description: 'Checks for places where redundant assignments are made for in place modification methods.' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.90' Style/RedundantSort: Description: >- @@ -4086,11 +4133,11 @@ - only_fail - semantic Style/SingleArgumentDig: Description: 'Avoid using single argument dig method.' - Enabled: pending + Enabled: true VersionAdded: '0.89' Safe: false Style/SingleLineBlockParams: Description: 'Enforces the names of some block params.' @@ -4113,19 +4160,19 @@ VersionChanged: '0.19' AllowIfMethodIsEmpty: true Style/SlicingWithRange: Description: 'Checks array slicing is done with endless ranges when suitable.' - Enabled: pending + Enabled: true VersionAdded: '0.83' Safe: false Style/SoleNestedConditional: Description: >- Finds sole nested conditional nodes which can be merged into outer conditional node. - Enabled: pending + Enabled: true VersionAdded: '0.89' AllowModifier: false Style/SpecialGlobalVars: Description: 'Avoid Perl-style global variables.' @@ -4156,11 +4203,11 @@ VersionAdded: '0.51' Style/StringConcatenation: Description: 'Checks for places where string concatenation can be replaced with string interpolation.' StyleGuide: '#string-interpolation' - Enabled: pending + Enabled: true Safe: false VersionAdded: '0.89' Style/StringHashKeys: Description: 'Prefer symbols instead of strings as hash keys.' @@ -4218,9 +4265,16 @@ Description: 'Checks for inheritance from Struct.new.' StyleGuide: '#no-extend-struct-new' Enabled: true VersionAdded: '0.29' VersionChanged: '0.86' + +Style/SwapValues: + Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.' + StyleGuide: '#values-swapping' + Enabled: pending + VersionAdded: '1.1' + SafeAutoCorrect: false Style/SymbolArray: Description: 'Use %i or %I for arrays of symbols.' StyleGuide: '#percent-i' Enabled: true