From cee2f0d4569d48e5fcab842d56cd325685a16772 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 22 Feb 2017 13:01:31 -0600 Subject: [PATCH] Add explanations to cops --- .rubocop.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 77c4d2c3ea1..2a8c30eff3f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -24,6 +24,7 @@ AllCops: - 'bin/**/*' - 'generator_templates/**/*' +# Gems in consecutive lines should be alphabetically sorted Bundler/OrderedGems: Enabled: false @@ -50,6 +51,8 @@ Style/AlignArray: Style/AlignHash: Enabled: true +# Here we check if the parameters on a multi-line method call or +# definition are aligned. Style/AlignParameters: Enabled: false @@ -74,6 +77,7 @@ Style/AsciiIdentifiers: Style/Attr: Enabled: true +# This cop checks if usage of %() or %Q() matches configuration. Style/BarePercentLiterals: Enabled: true @@ -94,9 +98,12 @@ Style/BlockDelimiters: Style/BlockEndNewline: Enabled: true + # This cop checks for braces around the last parameter in a method call +# if the last parameter is a hash. Style/BracesAroundHashParameters: Enabled: false +# This cop checks for uses of the case equality operator(===). Style/CaseEquality: Enabled: false @@ -128,9 +135,13 @@ Style/ClassMethods: Style/ClassVars: Enabled: true +# This cop checks for methods invoked via the :: operator instead +# of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir). Style/ColonMethodCall: Enabled: true +# This cop checks that comment annotation keywords are written according +# to guidelines. Style/CommentAnnotation: Enabled: false @@ -138,6 +149,9 @@ Style/CommentAnnotation: Style/CommentIndentation: Enabled: true +# Check for `if` and `case` statements where each branch is used for +# assignment to the same variable when using the return of the +# condition can be used instead. Style/ConditionalAssignment: Enabled: true @@ -153,10 +167,14 @@ Style/DefWithParentheses: Style/Documentation: Enabled: false +# This cop checks the . position in multi-line method calls. Style/DotPosition: Enabled: true EnforcedStyle: leading +# This cop checks for uses of double negation (!!) to convert something +# to a boolean value. As this is both cryptic and usually redundant, it +# should be avoided. Style/DoubleNegation: Enabled: false @@ -332,6 +350,8 @@ Style/MultilineOperationIndentation: Style/MultilineTernaryOperator: Enabled: true +# This cop checks whether some constant value isn't a +# mutable literal (e.g. array or hash). Style/MutableConstant: Enabled: true @@ -437,6 +457,7 @@ Style/SpaceBeforeComment: Style/SpaceBeforeSemicolon: Enabled: true +# Checks for spaces inside square brackets. Style/SpaceInsideBrackets: Enabled: true @@ -476,6 +497,7 @@ Style/Tab: Style/TrailingBlankLines: Enabled: true +# This cop checks for trailing comma in array and hash literals. Style/TrailingCommaInLiteral: Enabled: false @@ -524,6 +546,7 @@ Metrics/AbcSize: Enabled: true Max: 60 +# This cop checks if the length of a block exceeds some maximum value. Metrics/BlockLength: Enabled: false @@ -571,9 +594,13 @@ Metrics/PerceivedComplexity: Lint/AmbiguousOperator: Enabled: true +# This cop checks for ambiguous regexp literals in the first argument of +# a method invocation without parentheses. Lint/AmbiguousRegexpLiteral: Enabled: false +# This cop checks for assignments in the conditions of +# if/while/until. Lint/AssignmentInCondition: Enabled: false @@ -638,6 +665,7 @@ Lint/FloatOutOfRange: Lint/FormatParameterMismatch: Enabled: true +# This cop checks for *rescue* blocks with no body. Lint/HandleExceptions: Enabled: false @@ -664,6 +692,7 @@ Lint/LiteralInCondition: Lint/LiteralInInterpolation: Enabled: true +# This cop checks for uses of *begin...end while/until something*. Lint/Loop: Enabled: false @@ -696,6 +725,8 @@ Lint/RescueException: Lint/ShadowedException: Enabled: false +# This cop looks for use of the same name as outer local variables +# for block arguments or block local variables. Lint/ShadowingOuterLocalVariable: Enabled: false @@ -707,6 +738,7 @@ Lint/StringConversionInInterpolation: Lint/UnderscorePrefixedVariableName: Enabled: true +# This cop checks for using Fixnum or Bignum constant Lint/UnifiedInteger: Enabled: true @@ -716,6 +748,7 @@ Lint/UnifiedInteger: Lint/UnneededDisable: Enabled: false +# This cop checks for unneeded usages of splat expansion Lint/UnneededSplatExpansion: Enabled: false @@ -723,9 +756,11 @@ Lint/UnneededSplatExpansion: Lint/UnreachableCode: Enabled: true +# This cop checks for unused block arguments. Lint/UnusedBlockArgument: Enabled: false +# This cop checks for unused method arguments. Lint/UnusedMethodArgument: Enabled: false @@ -772,12 +807,18 @@ Performance/LstripRstrip: Performance/RangeInclude: Enabled: true +# This cop identifies the use of a `&block` parameter and `block.call` +# where `yield` would do just as well. Performance/RedundantBlockCall: Enabled: true +# This cop identifies use of `Regexp#match` or `String#match in a context +# where the integral return value of `=~` would do just as well. Performance/RedundantMatch: Enabled: true +# This cop identifies places where `Hash#merge!` can be replaced by +# `Hash#[]=`. Performance/RedundantMerge: Enabled: true MaxKeyValuePairs: 1 @@ -803,6 +844,8 @@ Performance/TimesMap: # Security #################################################################### +# This cop checks for the use of JSON class methods which have potential +# security issues. Security/JSONLoad: Enabled: true @@ -830,9 +873,11 @@ Rails/Date: Rails/Delegate: Enabled: true +# This cop checks dynamic `find_by_*` methods. Rails/DynamicFindBy: Enabled: false +# This cop enforces that 'exit' calls are not used within a rails app. Rails/Exit: Enabled: true Exclude: @@ -851,6 +896,9 @@ Rails/FindEach: Rails/HasAndBelongsToMany: Enabled: true +# This cop is used to identify usages of http methods like `get`, `post`, +# `put`, `patch` without the usage of keyword arguments in your tests and +# change them to use keyword args. Rails/HttpPositionalArguments: Enabled: false @@ -863,6 +911,8 @@ Rails/Output: - 'lib/backup/**/*' - 'lib/tasks/**/*' +# This cop checks for the use of output safety calls like html_safe and +# raw. Rails/OutputSafety: Enabled: false @@ -878,9 +928,11 @@ Rails/ReadWriteAttribute: Rails/ScopeArgs: Enabled: true +# This cop checks for the use of Time methods without zone. Rails/TimeZone: Enabled: false +# This cop checks for the use of old-style attribute validation macros. Rails/Validation: Enabled: true @@ -941,15 +993,19 @@ RSpec/Focus: RSpec/InstanceVariable: Enabled: false +# Checks for `subject` definitions that come after `let` definitions. RSpec/LeadingSubject: Enabled: false +# Checks unreferenced `let!` calls being used for test setup. RSpec/LetSetup: Enabled: false +# Check that chains of messages are not being stubbed. RSpec/MessageChain: Enabled: false +# Checks that message expectations are set using spies. RSpec/MessageSpies: Enabled: false @@ -957,12 +1013,15 @@ RSpec/MessageSpies: RSpec/MultipleDescribes: Enabled: false +# Checks if examples contain too many `expect` calls. RSpec/MultipleExpectations: Enabled: false +# Checks for explicitly referenced test subjects. RSpec/NamedSubject: Enabled: false +# Checks for nested example groups. RSpec/NestedGroups: Enabled: false @@ -971,9 +1030,11 @@ RSpec/NotToNot: EnforcedStyle: not_to Enabled: true +# Check for repeated description strings in example groups. RSpec/RepeatedDescription: Enabled: false +# Checks for stubbed test subjects. RSpec/SubjectStub: Enabled: false