fixed multiple style guide violations
This commit is contained in:
@ -4,7 +4,7 @@ class Assessor
|
||||
def assess(output)
|
||||
test_outcome = @testing_framework_adapter.test_outcome(output)
|
||||
test_outcome.merge(score: calculate_score(test_outcome))
|
||||
rescue Exception
|
||||
rescue
|
||||
{score: 0}
|
||||
end
|
||||
|
||||
@ -20,7 +20,6 @@ class Assessor
|
||||
fail(Error, 'No testing framework adapter set!')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Assessor::Error < RuntimeError
|
||||
class Error < RuntimeError; end
|
||||
end
|
||||
|
@ -6,15 +6,14 @@ module CodeOcean
|
||||
|
||||
def read(options = {})
|
||||
path = Rails.root.join('config', "#{@filename}.yml#{options[:erb] ? '.erb' : ''}")
|
||||
if ::File.exists?(path)
|
||||
if ::File.exist?(path)
|
||||
content = options[:erb] ? YAML.load(ERB.new(::File.new(path, 'r').read).result) : YAML.load_file(path)
|
||||
content[Rails.env].with_indifferent_access
|
||||
else
|
||||
fail(Error, "Configuration file not found: #{path}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Config::Error < RuntimeError
|
||||
class Error < RuntimeError; end
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ class DockerClient
|
||||
attr_reader :container_id
|
||||
|
||||
def self.check_availability!
|
||||
Timeout::timeout(config[:connection_timeout]) { Docker.version }
|
||||
Timeout.timeout(config[:connection_timeout]) { Docker.version }
|
||||
rescue Excon::Errors::SocketError, Timeout::Error
|
||||
raise(Error, "The Docker host at #{Docker.url} is not reachable!")
|
||||
end
|
||||
@ -94,7 +94,6 @@ class DockerClient
|
||||
|
||||
def initialize(options = {})
|
||||
@execution_environment = options[:execution_environment]
|
||||
@user = options[:user]
|
||||
@image = self.class.find_image_by_tag(@execution_environment.docker_image)
|
||||
fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image
|
||||
end
|
||||
@ -133,7 +132,7 @@ class DockerClient
|
||||
end
|
||||
|
||||
def send_command(command, container, &block)
|
||||
Timeout::timeout(@execution_environment.permitted_execution_time) do
|
||||
Timeout.timeout(@execution_environment.permitted_execution_time) do
|
||||
stderr = []
|
||||
stdout = []
|
||||
container.attach(stdin: StringIO.new(command)) do |stream, chunk|
|
||||
@ -152,7 +151,6 @@ class DockerClient
|
||||
Concurrent::Future.execute { self.class.destroy_container(container) }
|
||||
end
|
||||
private :send_command
|
||||
end
|
||||
|
||||
class DockerClient::Error < RuntimeError
|
||||
class Error < RuntimeError; end
|
||||
end
|
||||
|
@ -6,12 +6,12 @@ namespace :docker do
|
||||
end
|
||||
|
||||
desc 'List all installed Docker images'
|
||||
task :images => :environment do
|
||||
task images: :environment do
|
||||
puts DockerClient.image_tags
|
||||
end
|
||||
|
||||
desc 'Pull all Docker images referenced by execution environments'
|
||||
task :pull => :environment do
|
||||
task pull: :environment do
|
||||
ExecutionEnvironment.all.map(&:docker_image).each do |docker_image|
|
||||
puts "Pulling #{docker_image}..."
|
||||
DockerClient.pull(docker_image)
|
||||
|
@ -11,10 +11,10 @@ class TestingFrameworkAdapter
|
||||
private :augment_output
|
||||
|
||||
def self.framework_name
|
||||
self.name
|
||||
name
|
||||
end
|
||||
|
||||
def parse_output(output)
|
||||
def parse_output(*)
|
||||
fail(NotImplementedError, "#{self.class} should implement #parse_output!")
|
||||
end
|
||||
private :parse_output
|
||||
|
Reference in New Issue
Block a user