Fix Rubocop offenses after Rubocop was reconfigured
This commit is contained in:

committed by
Sebastian Serth

parent
fc6aa12b0a
commit
63d997a7e3
@ -49,14 +49,15 @@ module SubmissionScoring
|
||||
|
||||
private :execute_test_file
|
||||
|
||||
def feedback_message(file, output)
|
||||
# set_locale
|
||||
def feedback_message(_file, output)
|
||||
# TODO: why did we comment out set_locale and render_markdown?
|
||||
set_locale
|
||||
if output[:score] == Assessor::MAXIMUM_SCORE && output[:file_role] == 'teacher_defined_test'
|
||||
I18n.t('exercises.implement.default_test_feedback')
|
||||
elsif output[:score] == Assessor::MAXIMUM_SCORE && output[:file_role] == 'teacher_defined_linter'
|
||||
I18n.t('exercises.implement.default_linter_feedback')
|
||||
else
|
||||
# render_markdown(file.feedback_message)
|
||||
render_markdown(file.feedback_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -9,7 +9,7 @@ class SubmissionsController < ApplicationController
|
||||
include Tubesock::Hijack
|
||||
|
||||
before_action :set_submission,
|
||||
only: %i[download download_file render_file run score extract_errors show statistics test]
|
||||
only: %i[download download_file render_file run score extract_errors show statistics]
|
||||
before_action :set_files, only: %i[download download_file render_file show run]
|
||||
before_action :set_file, only: %i[download_file render_file run]
|
||||
before_action :set_mime_type, only: %i[download_file render_file]
|
||||
@ -134,7 +134,7 @@ class SubmissionsController < ApplicationController
|
||||
|
||||
def handle_websockets(tubesock, runner, socket)
|
||||
tubesock.send_data JSON.dump({'cmd' => 'status', 'status' => :container_running})
|
||||
@output = String.new
|
||||
@output = +''
|
||||
|
||||
socket.on :output do |data|
|
||||
Rails.logger.info("#{Time.zone.now.getutc}: Container sending: #{data}")
|
||||
@ -239,9 +239,8 @@ class SubmissionsController < ApplicationController
|
||||
def score
|
||||
Thread.new do
|
||||
hijack do |tubesock|
|
||||
if @embed_options[:disable_run]
|
||||
return kill_socket(tubesock)
|
||||
end
|
||||
return kill_socket(tubesock) if @embed_options[:disable_run]
|
||||
|
||||
tubesock.send_data(@submission.calculate_score)
|
||||
# To enable hints when scoring a submission, uncomment the next line:
|
||||
# send_hints(tubesock, StructuredError.where(submission: @submission))
|
||||
|
@ -22,7 +22,7 @@ class Runner < ApplicationRecord
|
||||
|
||||
return runner if runner.save
|
||||
|
||||
raise(RunnerNotAvailableError, 'No runner available')
|
||||
raise RunnerNotAvailableError.new('No runner available')
|
||||
end
|
||||
|
||||
def copy_files(files)
|
||||
@ -33,7 +33,7 @@ class Runner < ApplicationRecord
|
||||
|
||||
# runner has disappeared for some reason
|
||||
destroy
|
||||
raise(RunnerNotAvailableError, 'Runner unavailable')
|
||||
raise RunnerNotAvailableError.new('Runner unavailable')
|
||||
end
|
||||
|
||||
def execute_command(command)
|
||||
@ -42,7 +42,7 @@ class Runner < ApplicationRecord
|
||||
if response.status == 404
|
||||
# runner has disappeared for some reason
|
||||
destroy
|
||||
raise(RunnerNotAvailableError, 'Runner unavailable')
|
||||
raise RunnerNotAvailableError.new('Runner unavailable')
|
||||
end
|
||||
parse response
|
||||
end
|
||||
|
@ -165,7 +165,7 @@ class Submission < ApplicationRecord
|
||||
container_execution_time: execution_time,
|
||||
status: exit_code.zero? ? :ok : :failed,
|
||||
stdout: stdout,
|
||||
stderr: stderr
|
||||
stderr: stderr,
|
||||
}
|
||||
test_result(output, file)
|
||||
end
|
||||
@ -210,7 +210,7 @@ class Submission < ApplicationRecord
|
||||
{
|
||||
class_name: File.basename(filename, File.extname(filename)).camelize,
|
||||
filename: filename,
|
||||
module_name: File.basename(filename, File.extname(filename)).underscore
|
||||
module_name: File.basename(filename, File.extname(filename)).underscore,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateRunners < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :runners do |t|
|
||||
|
Reference in New Issue
Block a user