use #fail instead of #raise to signal exceptions, as suggested by RuboCop
This commit is contained in:
@ -17,7 +17,7 @@ class Assessor
|
||||
if options[:execution_environment].testing_framework?
|
||||
@testing_framework_adapter = Kernel.const_get(options[:execution_environment].testing_framework).new
|
||||
else
|
||||
raise Error.new('No testing framework adapter set!')
|
||||
fail(Error, 'No testing framework adapter set!')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ module CodeOcean
|
||||
content = options[:erb] ? YAML.load(ERB.new(::File.new(path, 'r').read).result) : YAML.load_file(path)
|
||||
content[Rails.env].with_indifferent_access
|
||||
else
|
||||
raise Error.new("Configuration file not found: #{path}")
|
||||
fail(Error, "Configuration file not found: #{path}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ class DockerClient
|
||||
def self.check_availability!
|
||||
Timeout::timeout(config[:connection_timeout]) { Docker.version }
|
||||
rescue Excon::Errors::SocketError, Timeout::Error
|
||||
raise Error.new("The Docker host at #{Docker.url} is not reachable!")
|
||||
raise(Error, "The Docker host at #{Docker.url} is not reachable!")
|
||||
end
|
||||
|
||||
def command_substitutions(filename)
|
||||
@ -96,12 +96,12 @@ class DockerClient
|
||||
@execution_environment = options[:execution_environment]
|
||||
@user = options[:user]
|
||||
@image = self.class.find_image_by_tag(@execution_environment.docker_image)
|
||||
raise Error.new("Cannot find image #{@execution_environment.docker_image}!") unless @image
|
||||
fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image
|
||||
end
|
||||
|
||||
def self.initialize_environment
|
||||
unless config[:connection_timeout] && config[:workspace_root]
|
||||
raise Error.new('Docker configuration missing!')
|
||||
fail(Error, 'Docker configuration missing!')
|
||||
end
|
||||
Docker.url = config[:host] if config[:host]
|
||||
check_availability!
|
||||
|
@ -15,7 +15,7 @@ class TestingFrameworkAdapter
|
||||
end
|
||||
|
||||
def parse_output(output)
|
||||
raise NotImplementedError.new("#{self.class} should implement #parse_output!")
|
||||
fail(NotImplementedError, "#{self.class} should implement #parse_output!")
|
||||
end
|
||||
private :parse_output
|
||||
|
||||
|
Reference in New Issue
Block a user