.rubocop.yml in how_is-24.0.0 vs .rubocop.yml in how_is-25.0.0
- old
+ new
@@ -1,31 +1,32 @@
-inherit_from: .rubocop_todo.yml
-
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
- TargetRubyVersion: 2.3
+ TargetRubyVersion: 2.4
Exclude:
- 'how_is.gemspec'
- 'bin/*'
- '**/*~'
- 'spec/capture_warnings.rb'
- - 'lib/how_is/cli.rb' # FIXME: Make HowIs::CLI.parse not a disaster.
# Exceptions should inherit from StandardError.
# (RuboCop default is to inherit from RuntimeError.)
Lint/InheritException:
EnforcedStyle: standard_error
+Metrics/AbcSize:
+ Max: 17
+
Metrics/BlockLength:
Exclude:
- 'spec/**/*_spec.rb'
-# The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
-#Metrics/ClassLength:
-# Max: 1500
+# Getting this back to the default of 100 would be nice,
+# but the few cases that exceed it don't seem overly concerning.
+Metrics/ClassLength:
+ Max: 130
# Still try for 80, but we'll allow 110 because there's a not-insignificant
# number of cases where we have long lines.
#
# It may be worth revisiting this in the future and refactoring those lines.
@@ -34,11 +35,11 @@
AllowHeredoc: true
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
- Max: 20
+ Max: 25
Style/Alias:
EnforcedStyle: prefer_alias_method
# Most readable form.
@@ -75,10 +76,13 @@
# There's more nuance around this than RuboCop seems capable of.
Style/BracesAroundHashParameters:
Enabled: false
+Style/ConditionalAssignment:
+ Enabled: false
+
# Don't force use of Time or Date; DateTime is okay.
Style/DateTime:
Enabled: false
# Unicode is good, mkay?
@@ -110,14 +114,13 @@
# format('%{greeting}', greeting: 'Hello')
Style/FormatStringToken:
EnforcedStyle: template
# Freeze string literals to future-proof the code.
-# TODO: Enable this always. (Disabled due to not knowing what will happen.)
Style/FrozenStringLiteralComment:
Enabled: true
- #EnforcedStyle: always
+ EnforcedStyle: always
# Mixing hash styles just looks silly.
# http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashSyntax
Style/HashSyntax:
EnforcedStyle: no_mixed_keys
@@ -160,26 +163,48 @@
# a useful return value are rare, assign the return
# value to a local variable for those cases.
Style/MethodCalledOnDoEndBlock:
Enabled: true
+# Indent method calls relative to the receiver, e.g.:
+# foo \
+# .bar \
+# .baz \
+# .asdf
+Layout/MultilineMethodCallIndentation:
+ EnforcedStyle: indented_relative_to_receiver
+
# Indenting the chained dots beneath each other is not supported by this cop,
# see https://github.com/bbatsov/rubocop/issues/1633
Layout/MultilineOperationIndentation:
Enabled: false
# {'foo' => 'bar'} not { 'foo' => 'bar' }
Layout/SpaceInsideHashLiteralBraces:
Enabled: true
EnforcedStyle: no_space
+# I find "foo > 0" more readable than "foo.positive?" personally.
+Style/NumericPredicate:
+ Enabled: false
+
+# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RegexpLiteral
+Style/RegexpLiteral:
+ Enabled: false
+
# Use double quotes everywhere by default.
Style/StringLiterals:
EnforcedStyle: double_quotes
-# TODO: Maybe make it so you have to do [:foo, :bar] not %i[foo bar]?
+# Prefer [:foo, :bar] over %i[foo bar].
Style/SymbolArray:
- Enabled: false
+ Enabled: true
+ EnforcedStyle: brackets
+
+# Prefer ["foo", "bar"] over %w[foo bar].
+Style/WordArray:
+ Enabled: true
+ EnforcedStyle: brackets
# Require parentheses around complex ternary conditions.
Style/TernaryParentheses:
Enabled: true
EnforcedStyle: require_parentheses_when_complex