diff --git a/Gemfile b/Gemfile index 2d3bb84170..a59a44361c 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 3cc7454cd5..66b1a3cb9c 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.13.1) 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