diff --git a/Gemfile.lock b/Gemfile.lock index 1b18981f..b69ff9b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,7 +200,7 @@ GEM activesupport (>= 5.0.0) js-routes (2.2.8) railties (>= 4) - json (2.6.3) + json (2.7.0) json_schemer (2.1.1) hana (~> 1.3) regexp_parser (~> 2.0) @@ -409,7 +409,7 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.1) - rubocop (1.57.2) + rubocop (1.58.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -417,7 +417,7 @@ GEM 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.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) diff --git a/app/controllers/concerns/lti.rb b/app/controllers/concerns/lti.rb index 47bffb6f..f9d1af77 100644 --- a/app/controllers/concerns/lti.rb +++ b/app/controllers/concerns/lti.rb @@ -229,7 +229,7 @@ module Lti hide_test_results disable_hints disable_download].each do |option| - value = params["custom_embed_options_#{option}".to_sym] == 'true' + value = params[:"custom_embed_options_#{option}"] == 'true' # Optimize storage and save only those that are true, the session cookie is limited to 4KB @embed_options[option] = value if value.present? end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index aae4f2bd..ad39a5ac 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -28,7 +28,7 @@ class TipsController < ApplicationController params[:tip] .permit(:title, :description, :example, :file_type_id) - .each {|_key, value| value.strip! unless value.is_a?(Array) } + .each_value {|value| value.strip! unless value.is_a?(Array) } .merge(user: current_user) end private :tip_params diff --git a/app/models/application_record.rb b/app/models/application_record.rb index ae82f5a8..2870c0e8 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -12,7 +12,7 @@ class ApplicationRecord < ActiveRecord::Base # and except the `log` of TestrunMessages or the `output` of Testruns attribute_names.without('content', 'log', 'output').each do |name| if send(name.to_sym).respond_to?(:strip) - send("#{name}=".to_sym, send(name).strip) + send(:"#{name}=", send(name).strip) end end end @@ -21,7 +21,7 @@ class ApplicationRecord < ActiveRecord::Base # remove null bytes from string attributes attribute_names.each do |name| if send(name.to_sym).respond_to?(:tr) - send("#{name}=".to_sym, send(name).tr("\0", '')) + send(:"#{name}=", send(name).tr("\0", '')) end end end diff --git a/app/models/submission.rb b/app/models/submission.rb index a2288e0b..75565104 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -213,7 +213,7 @@ class Submission < ApplicationRecord private def build_files_hash(files, attribute) - files&.map(&attribute.to_proc)&.zip(files)&.to_h || {} + files&.map(&attribute.to_proc)&.zip(files).to_h end def prepared_runner @@ -269,7 +269,7 @@ class Submission < ApplicationRecord def score_file(output, file, requesting_user) assessor = Assessor.new(execution_environment:) assessment = assessor.assess(output) - passed = ((assessment[:passed] == assessment[:count]) and (assessment[:score]).positive?) + passed = (assessment[:passed] == assessment[:count]) and (assessment[:score]).positive? testrun_output = passed ? nil : "status: #{output[:status]}\n stdout: #{output[:stdout]}\n stderr: #{output[:stderr]}" if testrun_output.present? execution_environment.error_templates.each do |template| diff --git a/spec/lib/runner/strategy/poseidon/connection_spec.rb b/spec/lib/runner/strategy/poseidon/connection_spec.rb index 17fb8aab..7b5ca562 100644 --- a/spec/lib/runner/strategy/poseidon/connection_spec.rb +++ b/spec/lib/runner/strategy/poseidon/connection_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Runner::Strategy::Poseidon::Connection do shared_examples 'calls a message handler' do it 'calls the corresponding handler' do - handler = "handle_#{message[:type]}".to_sym + handler = :"handle_#{message[:type]}" expect(connection).to receive(handler) process_message end