config/default.yml in rubocop-0.24.1 vs config/default.yml in rubocop-0.25.0
- old
+ new
@@ -8,11 +8,20 @@
# Common configuration.
AllCops:
# Include gemspec and Rakefile
Include:
- '**/*.gemspec'
+ - '**/*.podspec'
+ - '**/*.jbuilder'
+ - '**/*.rake'
+ - '**/Gemfile'
- '**/Rakefile'
+ - '**/Capfile'
+ - '**/Guardfile'
+ - '**/Podfile'
+ - '**/Thorfile'
+ - '**/Vagrantfile'
Exclude:
- 'vendor/**/*'
# By default, the rails cops are not run. Override in project or home
# directory .rubocop.yml files, or by giving the -R/--rails option.
RunRailsCops: false
@@ -105,13 +114,26 @@
EnforcedStyle: with_first_parameter
SupportedStyles:
- with_first_parameter
- with_fixed_indentation
-Style/BlockNesting:
- Max: 3
+Style/AndOr:
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
+ # or completely (always).
+ EnforcedStyle: always
+ SupportedStyles:
+ - always
+ - conditionals
+
+# Checks if usage of %() or %Q() matches configuration.
+Style/BarePercentLiterals:
+ EnforcedStyle: bare_percent
+ SupportedStyles:
+ - percent_q
+ - bare_percent
+
Style/BracesAroundHashParameters:
EnforcedStyle: no_braces
SupportedStyles:
- braces
- no_braces
@@ -148,14 +170,10 @@
Style/ClassCheck:
EnforcedStyle: is_a?
SupportedStyles:
- is_a?
- kind_of?
-
-Style/ClassLength:
- CountComments: false # count full line comments?
- Max: 100
# Align with the style guide.
Style/CollectionMethods:
# Mapping from undesired method to desired_method
# e.g. to use `detect` over `find`:
@@ -177,14 +195,10 @@
- FIXME
- OPTIMIZE
- HACK
- REVIEW
-# Avoid complex methods.
-Style/CyclomaticComplexity:
- Max: 6
-
# Multi-line method chaining should be done with leading dots.
Style/DotPosition:
EnforcedStyle: leading
SupportedStyles:
- leading
@@ -206,10 +220,13 @@
Style/FileName:
Exclude:
- '**/Rakefile'
- '**/Gemfile'
- '**/Capfile'
+ - '**/Vagrantfile'
+ - '**/Podfile'
+ - '**/Thorfile'
# Checks use of for or each in multiline loops.
Style/For:
EnforcedStyle: each
SupportedStyles:
@@ -260,19 +277,18 @@
EnforcedStyle: call
SupportedStyles:
- call
- braces
-Style/LineLength:
- Max: 80
- AllowURI: true
-
Style/Next:
# With `always` all conditions at the end of an iteration needs to be
- # replace by next - with `skip_modifier_ifs` the modifier if like this one
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
EnforcedStyle: skip_modifier_ifs
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
+ # needs to have to trigger this cop
+ MinBodyLength: 3
SupportedStyles:
- skip_modifier_ifs
- always
Style/NonNilCheck:
@@ -288,27 +304,19 @@
EnforcedStyle: require_parentheses
SupportedStyles:
- require_parentheses
- require_no_parentheses
-Style/MethodLength:
- CountComments: false # count full line comments?
- Max: 10
-
Style/MethodName:
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
Style/NumericLiterals:
MinDigits: 5
-Style/ParameterLists:
- Max: 5
- CountKeywordArgs: true
-
# Allow safe assignment in conditions.
Style/ParenthesesAroundCondition:
AllowSafeAssignment: true
Style/PercentLiteralDelimiters:
@@ -321,10 +329,16 @@
'%s': ()
'%w': ()
'%W': ()
'%x': ()
+Style/PercentQLiterals:
+ EnforcedStyle: lower_case_q
+ SupportedStyles:
+ - lower_case_q # Use %q when possible, %Q when necessary
+ - upper_case_q # Always use %Q
+
Style/PredicateName:
NamePrefixBlacklist:
- is_
- has_
- have_
@@ -333,11 +347,10 @@
EnforcedStyle: exploded
SupportedStyles:
- compact # raise Exception.new(msg)
- exploded # raise Exception, msg
-
Style/RedundantReturn:
# When true allows code like `return x, y`.
AllowMultipleReturnValues: false
Style/RegexpLiteral:
@@ -354,11 +367,10 @@
SupportedStyles:
- only_raise
- only_fail
- semantic
-
Style/SingleLineBlockParams:
Methods:
- reduce:
- a
- e
@@ -461,10 +473,38 @@
MaxLineLength: 80
Style/WordArray:
MinSize: 0
+##################### Metrics ##################################
+
+Metrics/BlockNesting:
+ Max: 3
+
+Metrics/ClassLength:
+ CountComments: false # count full line comments?
+ Max: 100
+
+# Avoid complex methods.
+Metrics/CyclomaticComplexity:
+ Max: 6
+
+Metrics/LineLength:
+ Max: 80
+ AllowURI: true
+
+Metrics/MethodLength:
+ CountComments: false # count full line comments?
+ Max: 10
+
+Metrics/ParameterLists:
+ Max: 5
+ CountKeywordArgs: true
+
+Metrics/PerceivedComplexity:
+ Max: 7
+
##################### Lint ##################################
# Allow safe assignment in conditions.
Lint/AssignmentInCondition:
AllowSafeAssignment: true
@@ -507,9 +547,16 @@
Rails/HasAndBelongsToMany:
Include:
- app/models/**/*.rb
+Rails/Output:
+ Include:
+ - app/**/*.rb
+ - config/**/*.rb
+ - db/**/*.rb
+ - lib/**/*.rb
+
Rails/ReadWriteAttribute:
Include:
- app/models/**/*.rb
Rails/ScopeArgs: