Fix rubocop offenses - Requires Ruby 3.1+
This commit is contained in:
@ -146,7 +146,7 @@ class SubmissionsController < ApplicationController
|
||||
end
|
||||
else
|
||||
Rails.logger.info("Unknown command from client: #{event[:cmd]}")
|
||||
Sentry.set_extras(event: event)
|
||||
Sentry.set_extras(event:)
|
||||
Sentry.capture_message("Unknown command from client: #{event[:cmd]}")
|
||||
end
|
||||
rescue JSON::ParserError => e
|
||||
@ -183,19 +183,19 @@ class SubmissionsController < ApplicationController
|
||||
exit_statement =
|
||||
if @testrun[:output].empty? && exit_code.zero?
|
||||
@testrun[:status] = :ok
|
||||
t('exercises.implement.no_output_exit_successful', timestamp: l(Time.zone.now, format: :short), exit_code: exit_code)
|
||||
t('exercises.implement.no_output_exit_successful', timestamp: l(Time.zone.now, format: :short), exit_code:)
|
||||
elsif @testrun[:output].empty?
|
||||
@testrun[:status] = :failed
|
||||
t('exercises.implement.no_output_exit_failure', timestamp: l(Time.zone.now, format: :short), exit_code: exit_code)
|
||||
t('exercises.implement.no_output_exit_failure', timestamp: l(Time.zone.now, format: :short), exit_code:)
|
||||
elsif exit_code.zero?
|
||||
@testrun[:status] = :ok
|
||||
"\n#{t('exercises.implement.exit_successful', timestamp: l(Time.zone.now, format: :short), exit_code: exit_code)}"
|
||||
"\n#{t('exercises.implement.exit_successful', timestamp: l(Time.zone.now, format: :short), exit_code:)}"
|
||||
else
|
||||
@testrun[:status] = :failed
|
||||
"\n#{t('exercises.implement.exit_failure', timestamp: l(Time.zone.now, format: :short), exit_code: exit_code)}"
|
||||
"\n#{t('exercises.implement.exit_failure', timestamp: l(Time.zone.now, format: :short), exit_code:)}"
|
||||
end
|
||||
stream = @testrun[:status] == :ok ? :stdout : :stderr
|
||||
send_and_store client_socket, {cmd: :write, stream: stream, data: "#{exit_statement}\n"}
|
||||
send_and_store client_socket, {cmd: :write, stream:, data: "#{exit_statement}\n"}
|
||||
if exit_code == 137
|
||||
send_and_store client_socket, {cmd: :status, status: :out_of_memory}
|
||||
@testrun[:status] = :out_of_memory
|
||||
@ -307,8 +307,8 @@ class SubmissionsController < ApplicationController
|
||||
exercise_id = @submission.exercise_id
|
||||
|
||||
remote_evaluation_mapping = RemoteEvaluationMapping.create(
|
||||
user: user,
|
||||
exercise_id: exercise_id,
|
||||
user:,
|
||||
exercise_id:,
|
||||
study_group_id: session[:study_group_id]
|
||||
)
|
||||
|
||||
@ -370,7 +370,7 @@ class SubmissionsController < ApplicationController
|
||||
testrun = Testrun.create!(
|
||||
file: @file,
|
||||
passed: @testrun[:passed],
|
||||
cause: cause,
|
||||
cause:,
|
||||
submission: @submission,
|
||||
exit_code: @testrun[:exit_code], # might be nil, e.g., when the run did not finish
|
||||
status: @testrun[:status] || :failed,
|
||||
@ -379,7 +379,7 @@ class SubmissionsController < ApplicationController
|
||||
waiting_for_container_time: @testrun[:waiting_for_container_time]
|
||||
)
|
||||
TestrunMessage.create_for(testrun, @testrun[:messages])
|
||||
TestrunExecutionEnvironment.create(testrun: testrun, execution_environment: @submission.used_execution_environment)
|
||||
TestrunExecutionEnvironment.create(testrun:, execution_environment: @submission.used_execution_environment)
|
||||
end
|
||||
|
||||
def send_hints(tubesock, errors)
|
||||
@ -430,10 +430,10 @@ class SubmissionsController < ApplicationController
|
||||
parsed[:stream] = parsed[:stream].to_sym if parsed.key? :stream
|
||||
parsed
|
||||
else
|
||||
{cmd: :write, stream: stream, data: data}
|
||||
{cmd: :write, stream:, data:}
|
||||
end
|
||||
rescue JSON::ParserError
|
||||
{cmd: :write, stream: stream, data: data}
|
||||
{cmd: :write, stream:, data:}
|
||||
end
|
||||
|
||||
def augment_files_for_download(files)
|
||||
|
Reference in New Issue
Block a user