diff --git a/.rubocop.yml b/.rubocop.yml index ef285c5..ba47414 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,7 @@ inherit_from: .rubocop_todo.yml # we get errors if our ruby version doesn't match. AllCops: TargetRubyVersion: 2.4 + NewCops: enable Layout/HashAlignment: EnforcedHashRocketStyle: table @@ -24,7 +25,7 @@ Lint/SuppressedException: - 'test/**/*.rb' # Allow this "useless" test, as we are testing <=> here. -Lint/UselessComparison: +Lint/BinaryOperatorWithIdenticalOperands: Exclude: - 'test/entry_test.rb' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a045c5..7e98e30 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,31 +1,84 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-03-14 17:50:29 +0000 using RuboCop version 0.80.0. +# on 2021-05-23 16:31:53 UTC using RuboCop version 1.12.1. # 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: 8 +# Cop supports --auto-correct. +# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'lib/zip/errors.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowAliasSyntax, AllowedMethods. +# AllowedMethods: alias_method, public, protected, private +Layout/EmptyLinesAroundAttributeAccessor: + Exclude: + - 'lib/zip/extra_field/zip64.rb' + - 'lib/zip/filesystem.rb' + - 'samples/gtk_ruby_zip.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + EnforcedStyle: consistent + # Offense count: 5 -# Configuration parameters: CountComments. +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Exclude: + - 'lib/zip/file.rb' + - 'test/gentestfiles.rb' + - 'test/settings_test.rb' + +# Offense count: 3 +# Configuration parameters: AllowComments. +Lint/EmptyClass: + Exclude: + - 'lib/zip/crypto/encryption.rb' + - 'test/decompressor_test.rb' + +# Offense count: 7 +Lint/MissingSuper: + Exclude: + - 'lib/zip/extra_field.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: 5 +# Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 610 + Max: 601 -# Offense count: 26 +# Offense count: 20 +# Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: - Max: 15 + Max: 14 -# Offense count: 44 -# Configuration parameters: CountComments, ExcludedMethods. +# Offense count: 46 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 32 -# Offense count: 2 +# Offense count: 5 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: - Max: 12 + Max: 11 + MaxOptionalParameters: 9 -# Offense count: 20 +# Offense count: 14 +# Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 15 @@ -37,18 +90,27 @@ Naming/AccessorMethodName: - 'lib/zip/input_stream.rb' - 'lib/zip/streamable_stream.rb' -# Offense count: 7 -# Configuration parameters: EnforcedStyle. -# SupportedStyles: inline, group -Style/AccessModifierDeclarations: +# Offense count: 4 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. +# SupportedStyles: snake_case, normalcase, non_integer +# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339 +Naming/VariableNumber: Exclude: - - 'lib/zip/central_directory.rb' - - 'lib/zip/extra_field/zip64.rb' - - 'lib/zip/filesystem.rb' + - 'test/file_extract_test.rb' + - 'test/file_permissions_test.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'lib/zip/decompressor.rb' + - 'lib/zip/entry.rb' # Offense count: 7 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle. +# Configuration parameters: EnforcedStyle. # SupportedStyles: nested, compact Style/ClassAndModuleChildren: Exclude: @@ -60,26 +122,50 @@ Style/ClassAndModuleChildren: - 'lib/zip/extra_field/zip64.rb' - 'lib/zip/extra_field/zip64_placeholder.rb' -# Offense count: 25 +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Keywords. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'test/file_test.rb' + - 'test/zip64_full_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Dir: + Exclude: + - 'test/file_test.rb' + +# Offense count: 2 +Style/DocumentDynamicEvalDefinition: + Exclude: + - 'test/test_helper.rb' + +# Offense count: 24 +# Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false -# Offense count: 3 -# Configuration parameters: . +# Offense count: 2 +# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods. # SupportedStyles: annotated, template, unannotated Style/FormatStringToken: EnforcedStyle: unannotated -# Offense count: 96 +# Offense count: 97 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Enabled: false -# This one has to be off until our base ruby is at least 2.5. -Style/HashTransformKeys: - Enabled: false +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'lib/zip/entry_set.rb' # Offense count: 13 # Cop supports --auto-correct. @@ -94,7 +180,7 @@ Style/IfUnlessModifier: # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, Autocorrect. -# SupportedStyles: module_function, extend_self +# SupportedStyles: module_function, extend_self, forbidden Style/ModuleFunction: Exclude: - 'lib/zip.rb' @@ -106,9 +192,15 @@ Style/ModuleFunction: Style/MutableConstant: Enabled: false -# Offense count: 23 +# Offense count: 2 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +Style/NegatedIfElseCondition: + Exclude: + - 'samples/qtzip.rb' + +# Offense count: 24 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: @@ -125,6 +217,35 @@ Style/NumericPredicate: - 'test/file_split_test.rb' - 'test/test_helper.rb' +# Offense count: 6 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Exclude: + - 'lib/zip/entry.rb' + - 'lib/zip/file.rb' + - 'lib/zip/output_stream.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'lib/zip/dos_time.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantFileExtensionInRequire: + Exclude: + - 'samples/qtzip.rb' + +# Offense count: 29 +# Cop supports --auto-correct. +Style/RedundantRegexpEscape: + Exclude: + - 'Guardfile' + - 'test/file_extract_test.rb' + - 'test/path_traversal_test.rb' + # Offense count: 17 # Cop supports --auto-correct. # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods. @@ -138,3 +259,14 @@ Style/SafeNavigation: - 'test/filesystem/file_nonmutating_test.rb' - 'test/filesystem/file_stat_test.rb' - 'test/test_helper.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +Style/StringConcatenation: + Exclude: + - 'lib/zip/filesystem.rb' + - 'samples/gtk_ruby_zip.rb' + - 'test/encryption_test.rb' + - 'test/file_test.rb' + - 'test/ioextras/abstract_input_stream_test.rb' + - 'test/test_helper.rb' diff --git a/rubyzip.gemspec b/rubyzip.gemspec index e6d4c5b..f858ee8 100644 --- a/rubyzip.gemspec +++ b/rubyzip.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.4' s.add_development_dependency 'minitest', '~> 5.4' s.add_development_dependency 'rake', '~> 12.3.3' - s.add_development_dependency 'rubocop', '~> 0.80.1' + s.add_development_dependency 'rubocop', '~> 1.12.0' s.add_development_dependency 'simplecov', '~> 0.18.0' s.add_development_dependency 'simplecov-lcov', '~> 0.8' end