From b1c659ec2ccb23b8c5eca70e39fc3d8a8fe6e8e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:45:58 +0000 Subject: [PATCH 1/2] Bump the rubocop group with 3 updates Bumps the rubocop group with 3 updates: [rubocop-capybara](https://github.com/rubocop/rubocop-capybara), [rubocop-minitest](https://github.com/rubocop/rubocop-minitest) and [rubocop-rails](https://github.com/rubocop/rubocop-rails). Updates `rubocop-capybara` from 2.18.0 to 2.19.0 - [Release notes](https://github.com/rubocop/rubocop-capybara/releases) - [Changelog](https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-capybara/compare/v2.18.0...v2.19.0) Updates `rubocop-minitest` from 0.31.1 to 0.32.2 - [Release notes](https://github.com/rubocop/rubocop-minitest/releases) - [Changelog](https://github.com/rubocop/rubocop-minitest/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-minitest/compare/v0.31.1...v0.32.2) Updates `rubocop-rails` from 2.21.1 to 2.21.2 - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.21.1...v2.21.2) --- updated-dependencies: - dependency-name: rubocop-capybara dependency-type: direct:development update-type: version-update:semver-minor dependency-group: rubocop - dependency-name: rubocop-minitest dependency-type: direct:development update-type: version-update:semver-minor dependency-group: rubocop - dependency-name: rubocop-rails dependency-type: direct:development update-type: version-update:semver-patch dependency-group: rubocop ... Signed-off-by: dependabot[bot] --- Gemfile | 6 +++--- Gemfile.lock | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index f9c311f4d1..e34f4ec9af 100644 --- a/Gemfile +++ b/Gemfile @@ -180,10 +180,10 @@ group :development do gem 'web-console', '~> 4.2.1' gem 'rb-readline', '~> 0.5.5' # require for irb - gem 'rubocop-capybara', '~> 2.18.0' + gem 'rubocop-capybara', '~> 2.19.0' gem 'rubocop-factory_bot', '~> 2.24' - gem 'rubocop-minitest', '~> 0.31.1' - gem 'rubocop-rails', '~> 2.21.1' + gem 'rubocop-minitest', '~> 0.32.2' + gem 'rubocop-rails', '~> 2.21.2' # for opening letters gem 'letter_opener', '~> 1.8.1' diff --git a/Gemfile.lock b/Gemfile.lock index d3ab8f0cff..cfa74c13e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -406,7 +406,7 @@ GEM railties (>= 5.2) rexml (3.2.6) rouge (4.1.3) - rubocop (1.56.3) + rubocop (1.56.4) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -420,13 +420,13 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) + rubocop-capybara (2.19.0) rubocop (~> 1.41) rubocop-factory_bot (2.24.0) rubocop (~> 1.33) - rubocop-minitest (0.31.1) + rubocop-minitest (0.32.2) rubocop (>= 1.39, < 2.0) - rubocop-rails (2.21.1) + rubocop-rails (2.21.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -489,7 +489,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.8.2) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) validate_email (0.1.6) activemodel (>= 3.0) mail (>= 2.2.5) @@ -589,10 +589,10 @@ DEPENDENCIES rails-i18n (~> 7.0.8) rb-readline (~> 0.5.5) rouge (= 4.1.3) - rubocop-capybara (~> 2.18.0) + rubocop-capybara (~> 2.19.0) rubocop-factory_bot (~> 2.24) - rubocop-minitest (~> 0.31.1) - rubocop-rails (~> 2.21.1) + rubocop-minitest (~> 0.32.2) + rubocop-rails (~> 2.21.2) ruby-saml (~> 1.15.0) rubyzip (~> 2.3.2) selenium-webdriver (~> 4.12.0) From 570fbc09f84bb59731c717285eba7cad319ff34f Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Mon, 2 Oct 2023 14:05:25 +0200 Subject: [PATCH 2/2] Fix linting --- app/helpers/renderers/feedback_table_renderer.rb | 8 ++++---- app/models/activity.rb | 2 +- app/runners/submission_runner.rb | 2 +- test/controllers/application_controller_test.rb | 2 +- test/models/api_token_test.rb | 2 +- test/models/feedback_test.rb | 4 ++-- test/system/search_test.rb | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/helpers/renderers/feedback_table_renderer.rb b/app/helpers/renderers/feedback_table_renderer.rb index e953772d60..de1c3b23d1 100644 --- a/app/helpers/renderers/feedback_table_renderer.rb +++ b/app/helpers/renderers/feedback_table_renderer.rb @@ -53,10 +53,10 @@ def show_code_tab def show_diff_type_switch(tab) tab[:groups]&.compact # Groups - &.flat_map { |t| t[:groups] }&.compact # Testcases - &.flat_map { |t| t[:tests] }&.compact # Tests - &.reject { |t| t[:accepted] } - &.any? + &.flat_map { |t| t[:groups] }&.compact # Testcases + &.flat_map { |t| t[:tests] }&.compact # Tests + &.reject { |t| t[:accepted] } + &.any? end def show_hide_correct_switch(tab) diff --git a/app/models/activity.rb b/app/models/activity.rb index 8836913da8..9409641565 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -465,7 +465,7 @@ def read_dirconfig(subdir) def read_config_locations(location) repository.read_config_file(location) - &.deep_transform_values! { location } + &.deep_transform_values! { location } end def config_locations diff --git a/app/runners/submission_runner.rb b/app/runners/submission_runner.rb index 7e7b4a7a69..81dbd05eb9 100644 --- a/app/runners/submission_runner.rb +++ b/app/runners/submission_runner.rb @@ -164,7 +164,7 @@ def execute while Time.zone.now - before_time < time_limit before_stats = Time.zone.now # Check if container is still running - if !Rails.env.test? && (Docker::Container.all.any? { |c| c.id.starts_with?(container.id) || container.id.starts_with?(container.id) } && container.refresh!.info['State']['Running']) # rubocop:disable Rails/RedundantActiveRecordAllMethod + if !Rails.env.test? && (Docker::Container.all.any? { |c| c.id.starts_with?(container.id) || container.id.starts_with?(container.id) } && container.refresh!.info['State']['Running']) # If we don't pass these extra options gathering stats takes 1+ seconds (https://github.com/moby/moby/issues/23188#issuecomment-223211481) stats = container.stats({ 'one-shot': true, stream: false }) memory = [stats['memory_stats']['usage'] / (1024.0 * 1024.0), memory].max if stats['memory_stats']&.fetch('usage', nil) diff --git a/test/controllers/application_controller_test.rb b/test/controllers/application_controller_test.rb index 411c93c3a1..8337b143e8 100644 --- a/test/controllers/application_controller_test.rb +++ b/test/controllers/application_controller_test.rb @@ -19,7 +19,7 @@ class ApplicationControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_not_equal session[:user_return_to], location - assert session[:user_return_to].length < 100 + assert_operator session[:user_return_to].length, :<, 100 end test 'should get unauthorized status when not logged in' do diff --git a/test/models/api_token_test.rb b/test/models/api_token_test.rb index 0770e24ef7..c7f1df0411 100644 --- a/test/models/api_token_test.rb +++ b/test/models/api_token_test.rb @@ -20,7 +20,7 @@ class ApiTokenTest < ActiveSupport::TestCase test 'api token creation' do assert_not_nil @api_token - assert @api_token.token.length > 30 + assert_operator @api_token.token.length, :>, 30 assert_not_nil @api_token.token_digest assert_equal ApiToken.digest(@token), @api_token.token_digest end diff --git a/test/models/feedback_test.rb b/test/models/feedback_test.rb index cf8b09b068..04ed597fbd 100644 --- a/test/models/feedback_test.rb +++ b/test/models/feedback_test.rb @@ -24,8 +24,8 @@ class FeedbackTest < ActiveSupport::TestCase end test 'Appropriate amount of feedbacks are created when making a session and when updating' do - assert @user_count > 1 - assert @exercise_count > 1 + assert_operator @user_count, :>, 1 + assert_operator @exercise_count, :>, 1 assert_equal @user_count * @exercise_count, @evaluation.feedbacks.count user_to_remove = @users.sample diff --git a/test/system/search_test.rb b/test/system/search_test.rb index f374e62cf4..6060b9a2dc 100644 --- a/test/system/search_test.rb +++ b/test/system/search_test.rb @@ -56,8 +56,8 @@ def assert_path_with_query(path, **query_params) test 'Going to a page with search does not create an extra history entry' do sign_in create(:zeus) visit root_path - click_on 'Toggle drawer' - click_on 'Exercises' + click_button 'Toggle drawer' + click_link 'Exercises' page.assert_current_path activities_path page.go_back