From 4c130c928d0df3e976993f9a6991717a9d6a1a79 Mon Sep 17 00:00:00 2001 From: Florian Wininger Date: Fri, 26 Apr 2024 16:47:46 +0200 Subject: [PATCH] Fix rubocop on master (#102) --- .rubocop.yml | 3 +++ .rubocop_todo.yml | 46 +++++++++++++++++++++++++++++++++------- lib/registry/registry.rb | 2 +- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c8ec561..6c5e5ce 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ +AllCops: + NewCops: enable + Metrics/BlockLength: Enabled: false inherit_from: .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d12a238..cec7b08 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,35 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-05-28 18:46:24 UTC using RuboCop version 1.51.0. +# on 2024-04-26 14:37:29 UTC using RuboCop version 1.63.3. # 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: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/DeprecatedAttributeAssignment: + Exclude: + - 'docker_registry2.gemspec' + +# Offense count: 6 +# Configuration parameters: EnforcedStyle, AllowedGems, Include. +# SupportedStyles: Gemfile, gems.rb, gemspec +# Include: **/*.gemspec, **/Gemfile, **/gems.rb +Gemspec/DevelopmentDependencies: + Exclude: + - 'docker_registry2.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequireMFA: + Exclude: + - 'docker_registry2.gemspec' + # Offense count: 1 # Configuration parameters: Severity, Include. # Include: **/*.gemspec @@ -20,6 +44,7 @@ Lint/ShadowingOuterLocalVariable: # Offense count: 5 # This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AutoCorrect. Lint/UselessAssignment: Exclude: - 'lib/registry/registry.rb' @@ -27,7 +52,7 @@ Lint/UselessAssignment: # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: CheckForMethodsWithNoSideEffects. +# Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects. Lint/Void: Exclude: - 'lib/registry/registry.rb' @@ -76,14 +101,12 @@ Style/Documentation: - 'lib/registry/blob.rb' - 'lib/registry/registry.rb' -# Offense count: 6 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. -# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys -# SupportedShorthandSyntax: always, never, either, consistent -Style/HashSyntax: +# Configuration parameters: AllowedVars. +Style/FetchEnvVar: Exclude: - - 'lib/registry/registry.rb' + - 'test/test.rb' # Offense count: 2 # Configuration parameters: AllowedMethods. @@ -92,6 +115,13 @@ Style/OptionalBooleanParameter: Exclude: - 'lib/registry/registry.rb' +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Methods. +Style/RedundantArgument: + Exclude: + - 'lib/registry/registry.rb' + # Offense count: 8 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. diff --git a/lib/registry/registry.rb b/lib/registry/registry.rb index 5f804e0..e89a326 100644 --- a/lib/registry/registry.rb +++ b/lib/registry/registry.rb @@ -246,7 +246,7 @@ def parse_link_header(header) links = {} # Parse each part into a named link - parts.each do |part, _index| + parts.each_key do |part| section = part.split(';') url = section[0][/<(.*)>/, 1] name = section[1][/rel="?([^"]*)"?/, 1].to_sym