From 3e56b7264df0c23e19bcfe8c26183a6a9e26a6ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:35:39 +0000 Subject: [PATCH 1/2] Bump rubocop from 1.48.1 to 1.62.1 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.48.1 to 1.62.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.48.1...v1.62.1) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 07e6bbc..2aa9b0e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,6 +37,7 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) json (2.7.1) + language_server-protocol (3.17.0.3) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -52,8 +53,8 @@ GEM racc (~> 1.4) nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc racc (1.7.3) @@ -67,20 +68,21 @@ GEM nokogiri (~> 1.14) rainbow (3.1.1) rake (13.1.0) - regexp_parser (2.8.3) + regexp_parser (2.9.0) rexml (3.2.6) - rubocop (1.48.1) + rubocop (1.62.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + 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.26.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-ast (1.31.2) + parser (>= 3.3.0.4) rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) From cc0116116a4f8794693f0c08ee1efccdab5dee1e Mon Sep 17 00:00:00 2001 From: Abraham Williams Date: Fri, 29 Mar 2024 19:12:46 +0000 Subject: [PATCH 2/2] Add cop name to test matches --- ...t_avoid_object_send_with_dynamic_method.rb | 12 +++---- test/test_insecure_hash_algorithm.rb | 36 +++++++++---------- ...t_rails_controller_render_action_symbol.rb | 2 +- test/test_rails_controller_render_literal.rb | 20 +++++------ .../test_rails_controller_render_shorthand.rb | 12 +++---- test/test_rails_render_object_collection.rb | 6 ++-- test/test_rails_view_render_literal.rb | 4 +-- test/test_rails_view_render_shorthand.rb | 4 +-- 8 files changed, 48 insertions(+), 48 deletions(-) diff --git a/test/test_avoid_object_send_with_dynamic_method.rb b/test/test_avoid_object_send_with_dynamic_method.rb index 68d529f..bdca640 100644 --- a/test/test_avoid_object_send_with_dynamic_method.rb +++ b/test/test_avoid_object_send_with_dynamic_method.rb @@ -16,7 +16,7 @@ def my_method(foo) end RUBY assert_equal 1, offenses.size - assert_equal "Avoid using Object#send with a dynamic method name.", offenses.first.message + assert_equal "#{cop.name}: Avoid using Object#send with a dynamic method name.", offenses.first.message end def test_offended_by_public_send_call @@ -24,7 +24,7 @@ def test_offended_by_public_send_call foo.public_send(bar) RUBY assert_equal 1, offenses.size - assert_equal "Avoid using Object#public_send with a dynamic method name.", offenses.first.message + assert_equal "#{cop.name}: Avoid using Object#public_send with a dynamic method name.", offenses.first.message end def test_offended_by_call_to___send__ @@ -32,7 +32,7 @@ def test_offended_by_call_to___send__ foo.__send__(bar) RUBY assert_equal 1, offenses.size - assert_equal "Avoid using Object#__send__ with a dynamic method name.", offenses.first.message + assert_equal "#{cop.name}: Avoid using Object#__send__ with a dynamic method name.", offenses.first.message end def test_offended_by_send_calls_without_receiver @@ -42,9 +42,9 @@ def test_offended_by_send_calls_without_receiver __send__(a_variable, "foo", "bar") RUBY assert_equal 3, offenses.size - assert_equal "Avoid using Object#send with a dynamic method name.", offenses[0].message - assert_equal "Avoid using Object#public_send with a dynamic method name.", offenses[1].message - assert_equal "Avoid using Object#__send__ with a dynamic method name.", offenses[2].message + assert_equal "#{cop.name}: Avoid using Object#send with a dynamic method name.", offenses[0].message + assert_equal "#{cop.name}: Avoid using Object#public_send with a dynamic method name.", offenses[1].message + assert_equal "#{cop.name}: Avoid using Object#__send__ with a dynamic method name.", offenses[2].message end def test_unoffended_by_other_method_calls diff --git a/test/test_insecure_hash_algorithm.rb b/test/test_insecure_hash_algorithm.rb index 597450b..71df7e3 100644 --- a/test/test_insecure_hash_algorithm.rb +++ b/test/test_insecure_hash_algorithm.rb @@ -57,7 +57,7 @@ def secret_hmac RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_digest_method_md5_str @@ -70,7 +70,7 @@ def h RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_digest_method_md5_symbol @@ -83,7 +83,7 @@ def h RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_digest_method_sha256_str @@ -122,7 +122,7 @@ class Something RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_alias_for_openssl_digest_md5 @@ -133,7 +133,7 @@ class Something RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_alias_for_digest_sha1 @@ -144,7 +144,7 @@ class Something RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_alias_for_openssl_digest_sha1 @@ -155,7 +155,7 @@ class Something RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_alias_for_digest_sha256 @@ -200,7 +200,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_md5_hexdigest @@ -213,7 +213,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_md5_digest_by_name @@ -226,7 +226,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha1_digest_by_name @@ -239,7 +239,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha1_hexdigest_by_name_mixed_case @@ -252,7 +252,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha256_digest_by_name @@ -277,7 +277,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha1_hmac_by_name @@ -290,7 +290,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha256_hmac_by_name @@ -315,7 +315,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha1_digest_instance_by_name @@ -328,7 +328,7 @@ def something(str) RUBY assert_equal 1, offenses.count - assert_equal cop_class::MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::MSG}", offenses.first.message end def test_openssl_sha256_digest_instance_by_name @@ -367,7 +367,7 @@ def uuid RUBY assert_equal 1, offenses.count - assert_equal cop_class::UUID_V3_MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::UUID_V3_MSG}", offenses.first.message end def test_uuid_v3_with_md5_allowed @@ -405,7 +405,7 @@ def uuid RUBY assert_equal 1, offenses.count - assert_equal cop_class::UUID_V5_MSG, offenses.first.message + assert_equal "#{cop.name}: #{cop_class::UUID_V5_MSG}", offenses.first.message end def test_uuid_v5_with_sha1_allowed diff --git a/test/test_rails_controller_render_action_symbol.rb b/test/test_rails_controller_render_action_symbol.rb index 5731d82..8376ab6 100644 --- a/test/test_rails_controller_render_action_symbol.rb +++ b/test/test_rails_controller_render_action_symbol.rb @@ -47,7 +47,7 @@ def update RUBY assert_equal 3, offenses.count - expected_message = "Prefer `render` with string instead of symbol" + expected_message = "#{cop.name}: Prefer `render` with string instead of symbol" assert_equal expected_message, offenses[0].message assert_equal expected_message, offenses[1].message assert_equal expected_message, offenses[2].message diff --git a/test/test_rails_controller_render_literal.rb b/test/test_rails_controller_render_literal.rb index d8ebfba..712b81d 100644 --- a/test/test_rails_controller_render_literal.rb +++ b/test/test_rails_controller_render_literal.rb @@ -274,7 +274,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_implicit_with_layout_offense @@ -287,7 +287,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_implicit_with_status_offense @@ -300,7 +300,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_variable_offense @@ -313,7 +313,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_to_string_variable_offense @@ -326,7 +326,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_action_variable_offense @@ -339,7 +339,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_template_variable_offense @@ -352,7 +352,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_partial_variable_offense @@ -365,7 +365,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_template_with_layout_variable_offense @@ -378,7 +378,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_template_variable_with_layout_offense @@ -391,7 +391,7 @@ def index RUBY assert_equal 1, offenses.count - assert_equal "render must be used with a string literal or an instance of a Class", offenses[0].message + assert_equal "#{cop.name}: render must be used with a string literal or an instance of a Class", offenses[0].message end def test_render_shorthand_static_locals_no_offsense diff --git a/test/test_rails_controller_render_shorthand.rb b/test/test_rails_controller_render_shorthand.rb index 0c16bd5..4998c02 100644 --- a/test/test_rails_controller_render_shorthand.rb +++ b/test/test_rails_controller_render_shorthand.rb @@ -55,9 +55,9 @@ def confirm RUBY assert_equal 3, offenses.count - assert_equal "Use `render \"edit\"` instead", offenses[0].message - assert_equal "Use `render \"new\"` instead", offenses[1].message - assert_equal "Use `render \"confirm.html.erb\"` instead", offenses[2].message + assert_equal "#{cop.name}: Use `render \"edit\"` instead", offenses[0].message + assert_equal "#{cop.name}: Use `render \"new\"` instead", offenses[1].message + assert_equal "#{cop.name}: Use `render \"confirm.html.erb\"` instead", offenses[2].message end def test_render_template_offense @@ -78,8 +78,8 @@ def edit RUBY assert_equal 3, offenses.count - assert_equal "Use `render \"books/new\"` instead", offenses[0].message - assert_equal "Use `render \"books/show\", locals: { book: @book }` instead", offenses[1].message - assert_equal "Use `render \"books/edit.html.erb\", status: :ok, layout: \"application\"` instead", offenses[2].message + assert_equal "#{cop.name}: Use `render \"books/new\"` instead", offenses[0].message + assert_equal "#{cop.name}: Use `render \"books/show\", locals: { book: @book }` instead", offenses[1].message + assert_equal "#{cop.name}: Use `render \"books/edit.html.erb\", status: :ok, layout: \"application\"` instead", offenses[2].message end end diff --git a/test/test_rails_render_object_collection.rb b/test/test_rails_render_object_collection.rb index 7786ded..e5fa972 100644 --- a/test/test_rails_render_object_collection.rb +++ b/test/test_rails_render_object_collection.rb @@ -27,7 +27,7 @@ def test_render_partial_with_object_offense ERB assert_equal 1, offenses.count - assert_equal "Avoid `render object:`, instead `render partial: \"account\", locals: { account: @buyer }`", offenses[0].message + assert_equal "#{cop.name}: Avoid `render object:`, instead `render partial: \"account\", locals: { account: @buyer }`", offenses[0].message end def test_render_collection_with_object_offense @@ -36,7 +36,7 @@ def test_render_collection_with_object_offense ERB assert_equal 1, offenses.count - assert_equal "Avoid `render collection:`", offenses[0].message + assert_equal "#{cop.name}: Avoid `render collection:`", offenses[0].message end def test_render_spacer_template_with_object_offense @@ -45,6 +45,6 @@ def test_render_spacer_template_with_object_offense ERB assert_equal 1, offenses.count - assert_equal "Avoid `render collection:`", offenses[0].message + assert_equal "#{cop.name}: Avoid `render collection:`", offenses[0].message end end diff --git a/test/test_rails_view_render_literal.rb b/test/test_rails_view_render_literal.rb index c2ba57e..0def50e 100644 --- a/test/test_rails_view_render_literal.rb +++ b/test/test_rails_view_render_literal.rb @@ -43,7 +43,7 @@ def test_render_variable_offense ERB assert_equal 2, offenses.count - assert_equal "render must be used with a literal template and use literals for locals keys", offenses[0].message + assert_equal "#{cop.name}: render must be used with a literal template and use literals for locals keys", offenses[0].message end def test_render_component_no_offense @@ -102,7 +102,7 @@ def test_render_layout_variable_literal_no_offense ERB assert_equal 1, offenses.count - assert_equal "render must be used with a literal template and use literals for locals keys", offenses[0].message + assert_equal "#{cop.name}: render must be used with a literal template and use literals for locals keys", offenses[0].message end def test_render_inline_no_offense diff --git a/test/test_rails_view_render_shorthand.rb b/test/test_rails_view_render_shorthand.rb index 22ff453..4c8110f 100644 --- a/test/test_rails_view_render_shorthand.rb +++ b/test/test_rails_view_render_shorthand.rb @@ -31,7 +31,7 @@ def test_render_partial_offense ERB assert_equal 1, offenses.count - assert_equal "Use `render \"foo/bar\"` instead", offenses[0].message + assert_equal "#{cop.name}: Use `render \"foo/bar\"` instead", offenses[0].message end def test_render_partial_with_locals_offense @@ -40,7 +40,7 @@ def test_render_partial_with_locals_offense ERB assert_equal 1, offenses.count - assert_equal "Use `render \"foo/bar\", { bar: 42 }` instead", offenses[0].message + assert_equal "#{cop.name}: Use `render \"foo/bar\", { bar: 42 }` instead", offenses[0].message end def test_render_layout_no_offense