Skip to content

Commit

Permalink
Gemwork update v0.5.0: New Rubocop cops added
Browse files Browse the repository at this point in the history
Fix up new offenses after adding new Rubocop cops.

Update all gems.
  • Loading branch information
Paul DobbinSchmaltz committed Mar 22, 2024
1 parent 90c3cdf commit 3616737
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 60 deletions.
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
95 changes: 63 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,42 @@ GEM
specs:
ansi (1.5.0)
ast (2.4.2)
benchmark-ips (2.12.0)
benchmark-ips (2.13.0)
bigdecimal (3.1.7)
builder (3.2.4)
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
concurrent-ruby (1.2.3)
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
docile (1.4.0)
gemwork (0.3.0)
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
dry-initializer (3.1.1)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-schema (1.13.3)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-logic (>= 1.4, < 2)
dry-types (>= 1.7, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.2)
bigdecimal (~> 3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
gemwork (0.5.0)
debug
irb
minitest
Expand All @@ -27,58 +56,59 @@ GEM
rubocop-rake
simplecov
yard
io-console (0.6.0)
irb (1.9.1)
io-console (0.7.2)
irb (1.12.0)
rdoc
reline (>= 0.3.8)
json (2.6.3)
kwalify (0.7.2)
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
minitest (>= 5.0)
ruby-progressbar
much-stub (0.1.10)
object_identifier (0.7.0)
parallel (1.23.0)
parser (3.2.2.4)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
psych (5.1.1.1)
psych (5.1.2)
stringio
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
rdoc (6.6.0)
rdoc (6.6.3.1)
psych (>= 4.0.0)
reek (6.1.4)
kwalify (~> 0.7.0)
parser (~> 3.2.0)
reek (6.3.0)
dry-schema (~> 1.13.0)
parser (~> 3.3.0)
rainbow (>= 2.0, < 4.0)
regexp_parser (2.8.2)
reline (0.4.0)
rexml (~> 3.1)
regexp_parser (2.9.0)
reline (0.4.3)
io-console (~> 0.5)
rexml (3.2.6)
rubocop (1.57.2)
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.28.1, < 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.33.0)
rubocop (>= 1.39, < 2.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
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)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
Expand All @@ -88,9 +118,10 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
stringio (3.0.9)
stringio (3.1.0)
unicode-display_width (2.5.0)
yard (0.9.34)
yard (0.9.36)
zeitwerk (2.6.13)

PLATFORMS
arm64-darwin-23
Expand Down
4 changes: 2 additions & 2 deletions lib/object_inspector/inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def name
value(key: key)
else
interrogate_object_inspect_method(key) ||
interrogate_object(method_name: :display_name,
kwargs: object_method_keyword_arguments)
interrogate_object(
method_name: :display_name, kwargs: object_method_keyword_arguments)
end
end

Expand Down
18 changes: 9 additions & 9 deletions lib/object_inspector/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,35 @@ def initialize(names = %w[self])
#
# @param parts [Array<#to_s>]
# @param separator [#to_s] (ObjectInspector.configuration.flags_separator)
def join_name(parts,
separator: ObjectInspector.configuration.name_separator)
def join_name(
parts, separator: ObjectInspector.configuration.name_separator)
_join(parts, separator)
end

# Join the passed in flags with the passed in separator.
#
# @param flags [Array<#to_s>]
# @param separator [#to_s] (ObjectInspector.configuration.flags_separator)
def join_flags(flags,
separator: ObjectInspector.configuration.flags_separator)
def join_flags(
flags, separator: ObjectInspector.configuration.flags_separator)
_join(flags, separator)
end

# Join the passed in issues with the passed in separator.
#
# @param issues [Array<#to_s>]
# @param separator [#to_s] (ObjectInspector.configuration.issues_separator)
def join_issues(issues,
separator: ObjectInspector.configuration.issues_separator)
def join_issues(
issues, separator: ObjectInspector.configuration.issues_separator)
_join(issues, separator)
end

# Join the passed in items with the passed in separator.
#
# @param items [Array<#to_s>]
# @param separator [#to_s] (ObjectInspector.configuration.info_separator)
def join_info(items,
separator: ObjectInspector.configuration.info_separator)
def join_info(
items, separator: ObjectInspector.configuration.info_separator)
_join(items, separator)
end

Expand All @@ -66,7 +66,7 @@ def join_info(items,
# @return [FalseClass] if self and `other` resolve to a different set of
# objects
def ==(other)
@names.sort == Array(other).map(&:to_s).sort
@names.sort == Array(other).map(&:to_s).sort!
end
alias_method :eql?, :==

Expand Down
7 changes: 6 additions & 1 deletion object_inspector.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ Gem::Specification.new do |spec|
}

# Specify which files should be added to the gem when it is released.
spec.files = Dir.glob(%w[LICENSE.txt README.md {exe,lib}/**/*]).reject { |f| File.directory?(f) }
spec.files =
Dir.glob(%w[
LICENSE.txt
README.md
{exe,lib}/**/*
]).reject { |f| File.directory?(f) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
Expand Down
3 changes: 2 additions & 1 deletion rakelib/bump.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions rakelib/gemwork.rake
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions test/object_inspector/inspector_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ class ObjectInspector::InspectorTest < Minitest::Spec

context "GIVEN :identification is passed in" do
subject {
klazz.new(simple_object1,
identification: "PASSED_IN_IDENTIFICATION")
klazz.new(simple_object1, identification: "PASSED_IN_IDENTIFICATION")
}

it "returns the passed in :identification" do
Expand Down Expand Up @@ -195,19 +194,21 @@ class ObjectInspector::InspectorTest < Minitest::Spec

context "GIVEN #value is a Symbol" do
it "returns Object#<value>, GIVEN Object responds to #value" do
value(subject.send(:evaluate_passed_in_value, :simple_test_method)).
value(
subject.__send__(:evaluate_passed_in_value, :simple_test_method)).
must_equal("TEST_RESULT")
end

it "returns #value, GIVEN Object does not respond to #value" do
value(subject.send(:evaluate_passed_in_value, :unknown_method1)).
value(subject.__send__(:evaluate_passed_in_value, :unknown_method1)).
must_equal(:unknown_method1)
end
end

context "GIVEN #value is not a Symbol" do
it "returns #value" do
value(subject.send(:evaluate_passed_in_value, "simple_test_method")).
value(
subject.__send__(:evaluate_passed_in_value, "simple_test_method")).
must_equal("simple_test_method")
end
end
Expand Down
13 changes: 7 additions & 6 deletions test/object_inspector/inspectors_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ def initialize(full_test_object)
end

def inspect(**kwargs)
super(identification: self.class.name,
name: nil,
flags: nil,
info: nil,
issues: nil,
**kwargs)
super(
identification: self.class.name,
name: nil,
flags: nil,
info: nil,
issues: nil,
**kwargs)
end

def to_model
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 3616737

Please sign in to comment.