From 67e50023151cdfe194dc03c700eeb272b0225b61 Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Thu, 20 Feb 2025 23:38:12 -0800 Subject: [PATCH] Upgrade standardrb. --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- .../elastic_graph/schema_definition/json_schema_pruner.rb | 4 +++- .../lib/elastic_graph/schema_definition/results.rb | 2 ++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 1a6f29db..9525e06f 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :development do gem "rspec-retry", "~> 0.6" gem "simplecov", "~> 0.22" gem "simplecov-console", "~> 0.9" - gem "standard", "~> 1.44.0" + gem "standard", "~> 1.45.0" gem "steep", "~> 1.9.4" gem "super_diff", "~> 0.15" gem "vcr", "~> 6.3", ">= 6.3.1" diff --git a/Gemfile.lock b/Gemfile.lock index c54358f3..ea497f15 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -400,7 +400,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.13.2) - rubocop (1.70.0) + rubocop (1.71.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -466,10 +466,10 @@ GEM simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) simpleidn (0.2.3) - standard (1.44.0) + standard (1.45.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.70.0) + rubocop (~> 1.71.0) standard-custom (~> 1.0.0) standard-performance (~> 1.6) standard-custom (1.0.2) @@ -575,7 +575,7 @@ DEPENDENCIES rubocop-rspec (~> 3.4) simplecov (~> 0.22) simplecov-console (~> 0.9) - standard (~> 1.44.0) + standard (~> 1.45.0) steep (~> 1.9.4) super_diff (~> 0.15) vcr (~> 6.3, >= 6.3.1) diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/json_schema_pruner.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/json_schema_pruner.rb index 173b5ccc..de3b91b8 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/json_schema_pruner.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/json_schema_pruner.rb @@ -21,7 +21,9 @@ def self.prune(original_json_schema) types_to_keep = referenced_type_names(initial_type_names, original_json_schema["$defs"]) # The .select will preserve the sort order of the original hash + # standard:disable Style/HashSlice -- https://github.com/soutaro/steep/issues/1503 pruned_defs = original_json_schema["$defs"].select { |k, _v| types_to_keep.include?(k) } + # standard:enable Style/HashSlice original_json_schema.merge("$defs" => pruned_defs) end @@ -31,7 +33,7 @@ def self.prune(original_json_schema) def self.referenced_type_names(source_type_names, original_defs) return Set.new if source_type_names.empty? - referenced_type_defs = original_defs.select { |k, _| source_type_names.include?(k) } + referenced_type_defs = original_defs.slice(*source_type_names) ref_names = collect_ref_names(referenced_type_defs) referenced_type_names(ref_names, original_defs) + source_type_names diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/results.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/results.rb index aec644c8..95ec9def 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/results.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/results.rb @@ -307,7 +307,9 @@ def check_for_circular_dependencies! end circular_reference_sets = referenced_types_by_source_type + # standard:disable Style/HashSlice -- https://github.com/rubocop/rubocop/issues/13885 .select { |source_type, referenced_types| referenced_types.include?(source_type) } + # standard:enable Style/HashSlice .values .uniq