2021-05-25 03:58:54 +08:00
|
|
|
require:
|
2021-05-25 04:15:19 +08:00
|
|
|
- rubocop-performance
|
2021-05-25 03:58:54 +08:00
|
|
|
- rubocop-rake
|
|
|
|
|
2019-09-14 22:38:27 +08:00
|
|
|
inherit_from: .rubocop_todo.yml
|
2020-02-09 19:12:16 +08:00
|
|
|
|
2020-02-16 00:12:57 +08:00
|
|
|
# Set this to the minimum supported ruby in the gemspec. Otherwise
|
|
|
|
# we get errors if our ruby version doesn't match.
|
|
|
|
AllCops:
|
2022-11-07 01:59:13 +08:00
|
|
|
SuggestExtensions: false
|
2024-03-02 06:14:48 +08:00
|
|
|
TargetRubyVersion: 3.0
|
2021-05-24 00:44:36 +08:00
|
|
|
NewCops: enable
|
2020-02-16 00:12:57 +08:00
|
|
|
|
2021-05-24 00:58:18 +08:00
|
|
|
# Allow this in this file because adding the extra lines is pointless.
|
|
|
|
Layout/EmptyLineBetweenDefs:
|
|
|
|
Exclude:
|
|
|
|
- 'lib/zip/errors.rb'
|
|
|
|
|
2020-02-09 21:25:04 +08:00
|
|
|
Layout/HashAlignment:
|
|
|
|
EnforcedHashRocketStyle: table
|
|
|
|
EnforcedColonStyle: table
|
|
|
|
|
2019-09-27 05:00:46 +08:00
|
|
|
# Set a workable line length, given the current state of the code,
|
|
|
|
# and turn off for the tests.
|
|
|
|
Layout/LineLength:
|
2021-06-26 05:31:34 +08:00
|
|
|
Max: 100
|
2019-09-27 05:00:46 +08:00
|
|
|
Exclude:
|
|
|
|
- 'test/**/*.rb'
|
|
|
|
|
2021-05-24 04:28:33 +08:00
|
|
|
Lint/EmptyClass:
|
|
|
|
Enabled: false
|
|
|
|
|
2020-02-09 19:27:11 +08:00
|
|
|
# In some cases we just need to catch an exception, rather than
|
|
|
|
# actually handle it. Allow the tests to make use of this shortcut.
|
|
|
|
Lint/SuppressedException:
|
|
|
|
AllowComments: true
|
|
|
|
Exclude:
|
|
|
|
- 'test/**/*.rb'
|
|
|
|
|
2020-02-09 19:12:16 +08:00
|
|
|
# Allow this "useless" test, as we are testing <=> here.
|
2021-05-24 00:44:36 +08:00
|
|
|
Lint/BinaryOperatorWithIdenticalOperands:
|
2020-02-09 19:12:16 +08:00
|
|
|
Exclude:
|
|
|
|
- 'test/entry_test.rb'
|
2020-02-09 23:08:24 +08:00
|
|
|
|
2019-09-30 03:00:07 +08:00
|
|
|
# Turn off ABC metrics for the tests and set a workable max given
|
|
|
|
# the current state of the code.
|
|
|
|
Metrics/AbcSize:
|
|
|
|
Max: 37
|
|
|
|
Exclude:
|
|
|
|
- 'test/**/*.rb'
|
|
|
|
|
2021-06-27 18:18:24 +08:00
|
|
|
# Turn block length metrics off for the tests and gemspec.
|
2019-09-30 02:49:16 +08:00
|
|
|
Metrics/BlockLength:
|
|
|
|
Exclude:
|
2021-06-27 18:18:24 +08:00
|
|
|
- 'rubyzip.gemspec'
|
2019-09-30 02:49:16 +08:00
|
|
|
- 'test/**/*.rb'
|
|
|
|
|
2020-02-10 04:08:53 +08:00
|
|
|
# Turn class length metrics off for the tests.
|
|
|
|
Metrics/ClassLength:
|
|
|
|
Exclude:
|
|
|
|
- 'test/**/*.rb'
|
|
|
|
|
2020-02-10 05:54:10 +08:00
|
|
|
# Turn method length metrics off for the tests.
|
|
|
|
Metrics/MethodLength:
|
|
|
|
Exclude:
|
|
|
|
- 'test/**/*.rb'
|
|
|
|
|
2021-05-24 04:59:18 +08:00
|
|
|
# These tests are just better with snake_case numbers.
|
|
|
|
Naming/VariableNumber:
|
|
|
|
Exclude:
|
|
|
|
- 'test/file_permissions_test.rb'
|
|
|
|
|
2021-05-24 05:03:33 +08:00
|
|
|
# Need to allow accessors in Entry to be separated for doc purposes.
|
|
|
|
Style/AccessorGrouping:
|
|
|
|
Exclude:
|
|
|
|
- 'lib/zip/entry.rb'
|
|
|
|
|
2019-10-01 02:32:25 +08:00
|
|
|
# Set a consistent way of checking types.
|
|
|
|
Style/ClassCheck:
|
|
|
|
EnforcedStyle: kind_of?
|
|
|
|
|
2020-02-20 23:26:18 +08:00
|
|
|
Style/HashEachMethods:
|
|
|
|
Enabled: true
|
|
|
|
|
|
|
|
Style/HashTransformValues:
|
|
|
|
Enabled: true
|
|
|
|
|
2021-05-24 21:24:01 +08:00
|
|
|
# Allow non-default behaviour for Zip.
|
|
|
|
Style/ModuleFunction:
|
|
|
|
Exclude:
|
|
|
|
- 'lib/zip.rb'
|
|
|
|
|
2020-02-10 00:11:01 +08:00
|
|
|
# Allow this multi-line block chain as it actually reads better
|
|
|
|
# than the alternatives.
|
|
|
|
Style/MultilineBlockChain:
|
|
|
|
Exclude:
|
|
|
|
- 'lib/zip/crypto/traditional_encryption.rb'
|
|
|
|
|
2020-02-10 00:07:46 +08:00
|
|
|
# Allow inner slashes when using // for regex literals. Allow the
|
|
|
|
# Guardfile to use a syntax that is more consistent with its own style.
|
|
|
|
Style/RegexpLiteral:
|
|
|
|
AllowInnerSlashes: true
|
|
|
|
Exclude:
|
|
|
|
- 'Guardfile'
|
|
|
|
|
2020-02-10 00:00:05 +08:00
|
|
|
Style/SymbolArray:
|
|
|
|
EnforcedStyle: brackets
|
|
|
|
|
2020-02-09 23:08:24 +08:00
|
|
|
# Turn this cop off for these files as it fires for objects without
|
|
|
|
# an empty? method.
|
|
|
|
Style/ZeroLengthPredicate:
|
|
|
|
Exclude:
|
|
|
|
- 'lib/zip/file.rb'
|
|
|
|
- 'lib/zip/input_stream.rb'
|