diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index d66266dd..ad8ef10e 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -8,11 +8,11 @@ jobs: env: BUNDLE_WITHOUT: development steps: - - uses: actions/checkout@v3 - - name: Set up Ruby 2.6 + - uses: actions/checkout@v5 + - name: Set up Ruby 3.4 uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 + ruby-version: 3.4 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run RuboCop run: bundle exec rubocop diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 02cfbae1..9a0c4b62 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,18 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-05-30 13:48:55 UTC using RuboCop version 1.30.0. +# on 2025-09-23 00:00:00 UTC using RuboCop version 1.80.2. # 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: 3 -# This cop supports safe autocorrection (--autocorrect). -Layout/HeredocIndentation: - Exclude: - - 'support/ruby_enc_to_mysql.rb' - - 'tasks/compile.rake' - # Offense count: 2 # Configuration parameters: AllowedMethods. # AllowedMethods: enums @@ -22,23 +15,24 @@ Lint/ConstantDefinitionInBlock: - 'tasks/rspec.rake' # Offense count: 1 +# Configuration parameters: AllowedParentClasses. Lint/MissingSuper: Exclude: - 'lib/mysql2/em.rb' # Offense count: 2 -# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 94 + Max: 89 # Offense count: 34 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. -# IgnoredMethods: refine +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +# AllowedMethods: refine Metrics/BlockLength: - Max: 592 + Max: 477 # Offense count: 1 -# Configuration parameters: CountBlocks. +# Configuration parameters: CountBlocks, CountModifierForms. Metrics/BlockNesting: Max: 5 @@ -48,34 +42,28 @@ Metrics/ClassLength: Max: 141 # Offense count: 3 -# Configuration parameters: IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: - Max: 34 + Max: 32 # Offense count: 6 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 57 + Max: 52 # Offense count: 2 -# Configuration parameters: IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: - Max: 32 + Max: 30 # Offense count: 2 # Configuration parameters: ForbiddenDelimiters. -# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) Naming/HeredocDelimiterNaming: Exclude: - 'tasks/compile.rake' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/CaseLikeIf: - Exclude: - - 'ext/mysql2/extconf.rb' - -# Offense count: 8 +# Offense count: 9 # Configuration parameters: AllowedConstants. Style/Documentation: Exclude: @@ -100,13 +88,13 @@ Style/ExpandPathArguments: - 'support/mysql_enc_to_ruby.rb' - 'tasks/compile.rake' -# Offense count: 15 +# Offense count: 17 # Configuration parameters: AllowedVariables. Style/GlobalVars: Exclude: - 'ext/mysql2/extconf.rb' -# Offense count: 8 +# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Exclude: @@ -116,14 +104,14 @@ Style/IfUnlessModifier: # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowMethodComparison. +# Configuration parameters: AllowMethodComparison, ComparisonsThreshold. Style/MultipleComparison: Exclude: - 'lib/mysql2/client.rb' -# Offense count: 18 +# Offense count: 24 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Strict, AllowedNumbers. +# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. Style/NumericLiterals: MinDigits: 20 @@ -144,7 +132,7 @@ Style/StringConcatenation: - 'lib/mysql2/client.rb' - 'tasks/compile.rake' -# Offense count: 782 +# Offense count: 805 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes @@ -159,9 +147,9 @@ Style/WordArray: EnforcedStyle: percent MinSize: 4 -# Offense count: 32 +# Offense count: 43 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: Max: 232 diff --git a/Gemfile b/Gemfile index abf41562..b8335fd2 100644 --- a/Gemfile +++ b/Gemfile @@ -16,9 +16,7 @@ group :test do gem 'eventmachine' unless RUBY_PLATFORM =~ /mswin|mingw/ gem 'rspec', '~> 3.2' - # https://github.com/bbatsov/rubocop/pull/4789 - # 1.51 is the last version supporting Ruby 2.6 - gem 'rubocop', '>= 1.30.1', '< 1.51' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6') + gem 'rubocop' end group :benchmarks, optional: true do diff --git a/ext/mysql2/extconf.rb b/ext/mysql2/extconf.rb index 147b998b..44914729 100644 --- a/ext/mysql2/extconf.rb +++ b/ext/mysql2/extconf.rb @@ -113,7 +113,7 @@ def add_ssl_defines(header) warn "-----\nUsing --with-mysql-dir=#{File.dirname inc}\n-----" rpath_dir = lib have_library('mysqlclient') -elsif (mc = (with_config('mysql-config') || Dir[GLOB].first)) +elsif (mc = with_config('mysql-config') || Dir[GLOB].first) # If the user has provided a --with-mysql-config argument, we must respect it or fail. # If the user gave --with-mysql-config with no argument means we should try to find it. mc = Dir[GLOB].first if mc == true