From fc8566170f96628c90b951eff5520491d7781c1b Mon Sep 17 00:00:00 2001
From: Paul DobbinSchmaltz
Date: Fri, 22 Mar 2024 00:22:51 -0500
Subject: [PATCH] Gemwork update v0.5.0: New Rubocop cops added
Fix up new offenses after adding new Rubocop cops.
Update all gems.
---
.rubocop.yml | 5 +-
Gemfile.lock | 50 +++++++++----------
lib/object_identifier/array_wrap.rb | 2 +-
.../formatters/string_formatter.rb | 2 +-
rakelib/bump.rake | 3 +-
rakelib/gemwork.rake | 17 ++++++-
test/object_identifier/parameters_test.rb | 2 +-
test/test_helper.rb | 2 +-
8 files changed, 50 insertions(+), 33 deletions(-)
diff --git a/.rubocop.yml b/.rubocop.yml
index f20490d..f953a7d 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -5,7 +5,10 @@ require:
- rubocop-performance
inherit_gem:
- gemwork: lib/rubocop/.rubocop.yml
+ gemwork: lib/rubocop/.rubocop-gems.yml
AllCops:
TargetRubyVersion: 2.7
+
+Performance/OpenStruct:
+ Enabled: false # Reconsider later.
diff --git a/Gemfile.lock b/Gemfile.lock
index f65a114..89ed2d4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -9,9 +9,9 @@ GEM
ansi (1.5.0)
ast (2.4.2)
benchmark-ips (2.13.0)
- bigdecimal (3.1.5)
+ bigdecimal (3.1.7)
builder (3.2.4)
- concurrent-ruby (1.2.2)
+ concurrent-ruby (1.2.3)
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
@@ -43,7 +43,7 @@ GEM
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
- gemwork (0.3.0)
+ gemwork (0.5.0)
debug
irb
minitest
@@ -56,13 +56,13 @@ GEM
rubocop-rake
simplecov
yard
- io-console (0.7.1)
- irb (1.11.0)
+ io-console (0.7.2)
+ irb (1.12.0)
rdoc
- reline (>= 0.3.8)
+ reline (>= 0.4.2)
json (2.7.1)
language_server-protocol (3.17.0.3)
- minitest (5.20.0)
+ minitest (5.22.3)
minitest-reporters (1.6.1)
ansi
builder
@@ -70,7 +70,7 @@ GEM
ruby-progressbar
much-stub (0.1.10)
parallel (1.24.0)
- parser (3.2.2.4)
+ parser (3.3.0.5)
ast (~> 2.4.1)
racc
psych (5.1.2)
@@ -78,34 +78,34 @@ GEM
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
- rdoc (6.6.2)
+ rdoc (6.6.3.1)
psych (>= 4.0.0)
- reek (6.2.0)
+ reek (6.3.0)
dry-schema (~> 1.13.0)
- parser (~> 3.2.0)
+ parser (~> 3.3.0)
rainbow (>= 2.0, < 4.0)
rexml (~> 3.1)
- regexp_parser (2.8.3)
- reline (0.4.2)
+ regexp_parser (2.9.0)
+ reline (0.4.3)
io-console (~> 0.5)
rexml (3.2.6)
- rubocop (1.59.0)
+ rubocop (1.62.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
- parser (>= 3.2.2.4)
+ parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.30.0, < 2.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.30.0)
- parser (>= 3.2.1.0)
- rubocop-minitest (0.34.3)
- rubocop (>= 1.39, < 2.0)
- rubocop-ast (>= 1.30.0, < 2.0)
- rubocop-performance (1.20.1)
+ rubocop-ast (1.31.2)
+ parser (>= 3.3.0.4)
+ rubocop-minitest (0.35.0)
+ rubocop (>= 1.61, < 2.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
+ rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rake (0.6.0)
@@ -119,8 +119,8 @@ GEM
simplecov_json_formatter (0.1.4)
stringio (3.1.0)
unicode-display_width (2.5.0)
- yard (0.9.34)
- zeitwerk (2.6.12)
+ yard (0.9.36)
+ zeitwerk (2.6.13)
PLATFORMS
arm64-darwin-23
@@ -133,4 +133,4 @@ DEPENDENCIES
rake
BUNDLED WITH
- 2.4.13
+ 2.5.6
diff --git a/lib/object_identifier/array_wrap.rb b/lib/object_identifier/array_wrap.rb
index 63e798b..fda9fe4 100644
--- a/lib/object_identifier/array_wrap.rb
+++ b/lib/object_identifier/array_wrap.rb
@@ -4,7 +4,7 @@
# Array.wrap method. This allows us to get around objects that respond to
# `to_a` (such as Struct) and, instead, either utilize `to_ary` or just
# actually wrap the object in an Array ourselves.
-class ObjectIdentifier::ArrayWrap
+module ObjectIdentifier::ArrayWrap
# :reek:NilCheck
# :reek:ManualDispatch
diff --git a/lib/object_identifier/formatters/string_formatter.rb b/lib/object_identifier/formatters/string_formatter.rb
index c0d6517..6047e97 100644
--- a/lib/object_identifier/formatters/string_formatter.rb
+++ b/lib/object_identifier/formatters/string_formatter.rb
@@ -51,7 +51,7 @@ def initialize(objects, parameters)
#
# @return [String]
def call
- parts = objects.first(limit).map { |obj| format_item(obj) }
+ parts = objects.first(limit).map! { |obj| format_item(obj) }
parts << "... (#{truncated_objects_count} more)" if truncated?
parts.join(", ")
end
diff --git a/rakelib/bump.rake b/rakelib/bump.rake
index d2ff8b0..1616e1f 100644
--- a/rakelib/bump.rake
+++ b/rakelib/bump.rake
@@ -85,7 +85,8 @@ module RubyVersions
def self.latest_supported_patches
@latest_supported_patches ||= begin
- patches = versions.fetch_values(*VERSION_TYPES).compact.flatten
+ patches =
+ versions.fetch_values(*VERSION_TYPES).tap(&:flatten!).tap(&:compact!)
patches.map { |patch| Gem::Version.new(patch) }.sort!.map(&:to_s)
end
end
diff --git a/rakelib/gemwork.rake b/rakelib/gemwork.rake
index 43102f6..85ac267 100644
--- a/rakelib/gemwork.rake
+++ b/rakelib/gemwork.rake
@@ -1,6 +1,19 @@
# frozen_string_literal: true
+spec = Gem::Specification.find_by_name("gemwork")
+
# Load additional tasks defined by Gemwork.
-Gem::Specification.find_by_name("gemwork").tap do |gemspec|
- Rake.load_rakefile("#{gemspec.gem_dir}/lib/tasks/Rakefile")
+Dir.glob(
+ Pathname.new(spec.gem_dir).
+ join("lib", "tasks", "{util,rubocop,reek,test}.rake")) do |task|
+ load(task)
+end
+
+# Redefine the default `rake` task.
+task :default do
+ run_tasks(%i[
+ test
+ rubocop
+ reek
+ ])
end
diff --git a/test/object_identifier/parameters_test.rb b/test/object_identifier/parameters_test.rb
index a36d941..c9f07be 100644
--- a/test/object_identifier/parameters_test.rb
+++ b/test/object_identifier/parameters_test.rb
@@ -4,7 +4,7 @@
class ObjectIdentifier::ParametersTest < Minitest::Spec
# ObjectIdentifier::ParametersTest::CustomFormatter is a Test Dummy.
- class CustomFormatter
+ module CustomFormatter
def self.call(*)
end
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 32fe821..9661135 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -7,6 +7,6 @@
require "minitest/autorun"
-require "gemwork/test/support/reporters"
require "gemwork/test/support/much_stub"
+require "gemwork/test/support/reporters"
require "gemwork/test/support/spec_dsl"