Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubocop 0.79 #437

Merged
merged 56 commits into from Feb 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c8bfd14
Update rubocop version and the config files.
hainesr Sep 14, 2019
a3245ac
Add Rubocop tasks to the Rakefile.
hainesr Sep 15, 2019
aa40035
Fix Gemspec/OrderedDependencies cop.
hainesr Feb 8, 2020
73e405a
Fix Security/Open cop errors.
hainesr Sep 14, 2019
f1154c2
Fix Style/OrAssignment cop.
hainesr Feb 9, 2020
3a3ac6f
Fix Style/Semicolon cop.
hainesr Sep 14, 2019
e7275da
Fix Style/BlockDelimiters cop errors.
hainesr Sep 14, 2019
98c6969
Fix Layout/SpaceAroundOperators cop.
hainesr Feb 9, 2020
20743a5
Fix Lint/AmbiguousBlockAssociation cop.
hainesr Feb 9, 2020
b528cae
Fix Lint/LiteralAsCondition cop.
hainesr Feb 9, 2020
cd065d0
Fix Lint/UnusedBlockArgument cop.
hainesr Feb 9, 2020
e361a47
Configure Lint/UselessComparison cop.
hainesr Feb 9, 2020
23ba1af
Fix Lint/RescueException cop.
hainesr Feb 9, 2020
0d49421
Fix Lint/UselessAccessModifier cop.
hainesr Feb 9, 2020
fff2c41
Configure Lint/SuppressedException cop.
hainesr Feb 9, 2020
cfe4972
Fix Layout/EmptyLineAfterGuardClause cop.
hainesr Feb 9, 2020
61c83b2
Configure Layout/HashAlignment cop.
hainesr Feb 9, 2020
68259ed
Fix Style/Encoding cop.
hainesr Feb 9, 2020
70d036b
Fix Style/ExpandPathArguments cop.
hainesr Sep 15, 2019
6544563
Configure Style/ZeroLengthPredicate so it doesn't misfire.
hainesr Feb 9, 2020
19aa7e8
Fix Style/RescueStandardError cop.
hainesr Sep 15, 2019
5a1baf4
Fix Style/RedundantReturn cop.
hainesr Sep 15, 2019
b3c4c37
Fix Style/NonNilCheck cop.
hainesr Sep 15, 2019
b3f2413
Fix Style/CommentedKeyword cop.
hainesr Feb 9, 2020
468a80c
Fix Style/IfInsideElse cop.
hainesr Sep 21, 2019
3121ad0
Fix Style/Alias cop.
hainesr Feb 9, 2020
1b8f1a6
Fix Naming/RescuedExceptionsVariableName cop.
hainesr Sep 21, 2019
bce8416
Fix Style/MixinUsage cop.
hainesr Sep 21, 2019
45f4c2d
Fix Style/GuardClause cop.
hainesr Feb 9, 2020
2e11a88
Fix Style/StringLiterals cop.
hainesr Feb 9, 2020
cc0e372
Configure Style/SymbolArray cop.
hainesr Feb 9, 2020
4e1b679
Fix Style/TrailingCommaInArrayLiteral cop.
hainesr Sep 22, 2019
2dfe092
Fix Style/UnpackFirst cop.
hainesr Sep 22, 2019
41f2359
Configure Style/RegexpLiteral cop.
hainesr Feb 9, 2020
5e32204
Configure Style/MultilineBlockChain cop.
hainesr Feb 9, 2020
172ab4b
Fix Style/FloatDivision cop.
hainesr Sep 22, 2019
d42c66c
Fix Style/MultilineWhenThen cop.
hainesr Sep 22, 2019
2dc9b49
Fix Style/EvalWithLocation cop.
hainesr Sep 22, 2019
835843d
Fix Naming/HeredocDelimiterCase cop.
hainesr Sep 22, 2019
7978abb
Configure Naming/MemoizedInstanceVariableName cop.
hainesr Sep 22, 2019
2f99322
Fix Style/Next cop.
hainesr Sep 25, 2019
2cbdbf1
Fix Style/SignalException cop.
hainesr Sep 26, 2019
bb3b447
Fix Style/SpecialGlobalVars cop.
hainesr Sep 26, 2019
0df6cb3
Fix Style/SymbolProc cop.
hainesr Sep 26, 2019
6cab592
Configure and fix Metrics/LineLength cop.
hainesr Sep 26, 2019
0e25e63
Turn off Metrics/BlockLength for the tests.
hainesr Sep 29, 2019
c97d560
Configure Metrics/AbcSize and turn off for the tests.
hainesr Sep 29, 2019
5ce4e13
Configure and fix Style/ClassCheck cop.
hainesr Sep 30, 2019
a9adfa2
Configure Metrics/ClassLength and turn off for the tests.
hainesr Feb 9, 2020
a187ec0
Configure Metrics/MethodLength and turn off for the tests.
hainesr Feb 9, 2020
4b8f740
Fix Layout/EmptyLinesAroundClassBody cop.
hainesr Feb 9, 2020
fae95e3
Fix Style/NumericLiteralPrefix cop.
hainesr Feb 9, 2020
d07b36b
Fix Style/TernaryParentheses cop.
hainesr Feb 9, 2020
989a565
Fix Style/TrailingCommaInHashLiteral cop.
hainesr Feb 9, 2020
c31ab81
Fix Style/NumericLiterals cop.
hainesr Feb 9, 2020
87a63e0
Set TargetRubyVersion to match that in the gemspec.
hainesr Feb 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
88 changes: 83 additions & 5 deletions .rubocop.yml
@@ -1,6 +1,84 @@
inherit_from:
- .rubocop_rubyzip.yml
inherit_from: .rubocop_todo.yml

# Set this to the minimum supported ruby in the gemspec. Otherwise
# we get errors if our ruby version doesn't match.
AllCops:
TargetRubyVersion: 1.9
hainesr marked this conversation as resolved.
Show resolved Hide resolved
Style/MutableConstant:
Enabled: false # Because some existent code relies on mutable constant
TargetRubyVersion: 2.4

Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table

# Set a workable line length, given the current state of the code,
# and turn off for the tests.
Layout/LineLength:
Max: 135
Exclude:
- 'test/**/*.rb'

# 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'

# Allow this "useless" test, as we are testing <=> here.
Lint/UselessComparison:
Exclude:
- 'test/entry_test.rb'

# 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'

# Turn block length metrics off for the tests.
Metrics/BlockLength:
Exclude:
- 'test/**/*.rb'

# Turn class length metrics off for the tests.
Metrics/ClassLength:
Exclude:
- 'test/**/*.rb'

# Turn method length metrics off for the tests.
Metrics/MethodLength:
Exclude:
- 'test/**/*.rb'

# Rubocop confuses these as instances of "memoization".
Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/zip/extra_field/old_unix.rb'
- 'lib/zip/extra_field/unix.rb'

# Set a consistent way of checking types.
Style/ClassCheck:
EnforcedStyle: kind_of?

# Allow this multi-line block chain as it actually reads better
# than the alternatives.
Style/MultilineBlockChain:
Exclude:
- 'lib/zip/crypto/traditional_encryption.rb'

# 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'

Style/SymbolArray:
EnforcedStyle: brackets

# 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'
137 changes: 0 additions & 137 deletions .rubocop_rubyzip.yml

This file was deleted.

164 changes: 164 additions & 0 deletions .rubocop_todo.yml
@@ -0,0 +1,164 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-02-08 14:58:51 +0000 using RuboCop version 0.79.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 15
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 580

# Offense count: 26
Metrics/CyclomaticComplexity:
Max: 14

# Offense count: 120
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 30

# Offense count: 2
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 10

# Offense count: 21
Metrics/PerceivedComplexity:
Max: 15

# Offense count: 9
Naming/AccessorMethodName:
Exclude:
- 'lib/zip/entry.rb'
- 'lib/zip/filesystem.rb'
- 'lib/zip/input_stream.rb'
- 'lib/zip/streamable_stream.rb'
- 'test/file_permissions_test.rb'

# Offense count: 18
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
Naming/BlockParameterName:
Exclude:
- 'lib/zip/file.rb'
- 'lib/zip/filesystem.rb'
- 'samples/zipfind.rb'
- 'test/central_directory_test.rb'
- 'test/file_extract_directory_test.rb'
- 'test/file_extract_test.rb'
- 'test/output_stream_test.rb'
- 'test/test_helper.rb'

# Offense count: 140
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os
Naming/MethodParameterName:
Enabled: false

# Offense count: 721
# Configuration parameters: EnforcedStyle.
# SupportedStyles: snake_case, camelCase
Naming/VariableName:
Enabled: false

# Offense count: 7
# Configuration parameters: EnforcedStyle.
# SupportedStyles: inline, group
Style/AccessModifierDeclarations:
Exclude:
- 'lib/zip/central_directory.rb'
- 'lib/zip/extra_field/zip64.rb'
- 'lib/zip/filesystem.rb'

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'lib/zip/extra_field/generic.rb'
- 'lib/zip/extra_field/ntfs.rb'
- 'lib/zip/extra_field/old_unix.rb'
- 'lib/zip/extra_field/universal_time.rb'
- 'lib/zip/extra_field/unix.rb'
- 'lib/zip/extra_field/zip64.rb'
- 'lib/zip/extra_field/zip64_placeholder.rb'

# Offense count: 26
Style/Documentation:
Enabled: false

# Offense count: 3
# Configuration parameters: .
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: unannotated

# Offense count: 95
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 17
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'lib/zip/entry.rb'
- 'lib/zip/extra_field/generic.rb'
- 'lib/zip/file.rb'
- 'lib/zip/filesystem.rb'
- 'lib/zip/input_stream.rb'
- 'lib/zip/pass_thru_decompressor.rb'
- 'lib/zip/streamable_stream.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, Autocorrect.
# SupportedStyles: module_function, extend_self
Style/ModuleFunction:
Exclude:
- 'lib/zip.rb'

# Offense count: 56
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Style/MutableConstant:
Enabled: false

# Offense count: 23
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/zip/entry.rb'
- 'lib/zip/extra_field/old_unix.rb'
- 'lib/zip/extra_field/universal_time.rb'
- 'lib/zip/extra_field/unix.rb'
- 'lib/zip/file.rb'
- 'lib/zip/filesystem.rb'
- 'lib/zip/input_stream.rb'
- 'lib/zip/ioextras.rb'
- 'lib/zip/ioextras/abstract_input_stream.rb'
- 'test/file_split_test.rb'
- 'test/test_helper.rb'

# Offense count: 17
# Cop supports --auto-correct.
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Exclude:
- 'lib/zip/entry.rb'
- 'lib/zip/input_stream.rb'
- 'lib/zip/output_stream.rb'
- 'test/file_extract_test.rb'
- 'test/filesystem/file_nonmutating_test.rb'
- 'test/filesystem/file_stat_test.rb'
- 'test/test_helper.rb'