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

committed by
Sebastian Serth

parent
fc6aa12b0a
commit
63d997a7e3
@@ -22,18 +22,18 @@ class Runner < ApplicationRecord
|
||||
|
||||
return runner if runner.save
|
||||
|
||||
raise(RunnerNotAvailableError, 'No runner available')
|
||||
raise RunnerNotAvailableError.new('No runner available')
|
||||
end
|
||||
|
||||
def copy_files(files)
|
||||
url = "#{runner_url}/files"
|
||||
body = {files: files.map { |filename, content| {filepath: filename, content: content} }}
|
||||
body = {files: files.map {|filename, content| {filepath: filename, content: content} }}
|
||||
response = Faraday.patch(url, body.to_json, HEADERS)
|
||||
return unless response.status == 404
|
||||
|
||||
# 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
|
||||
|
@@ -72,7 +72,7 @@ class Submission < ApplicationRecord
|
||||
# expects the full file path incl. file extension
|
||||
# Caution: There must be no unnecessary path prefix included.
|
||||
# Use `file.ext` rather than `./file.ext`
|
||||
collect_files.detect { |file| file.filepath == file_path }
|
||||
collect_files.detect {|file| file.filepath == file_path }
|
||||
end
|
||||
|
||||
def normalized_score
|
||||
@@ -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
|
||||
@@ -202,7 +202,7 @@ class Submission < ApplicationRecord
|
||||
end
|
||||
|
||||
def command_for(template, file)
|
||||
filepath = collect_files.find { |f| f.name_with_extension == file }.filepath
|
||||
filepath = collect_files.find {|f| f.name_with_extension == file }.filepath
|
||||
template % command_substitutions(filepath)
|
||||
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
|
||||
|
Reference in New Issue
Block a user