Fix rubocop offenses - Requires Ruby 3.1+
This commit is contained in:
@ -8,7 +8,7 @@ FactoryBot.define do
|
||||
|
||||
trait :singleton_consumer do
|
||||
initialize_with do
|
||||
Consumer.find_or_initialize_by(name: name) do |consumer|
|
||||
Consumer.find_or_initialize_by(name:) do |consumer|
|
||||
consumer.oauth_key = SecureRandom.hex
|
||||
consumer.oauth_secret = SecureRandom.hex
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-coffee:latest' }
|
||||
file_type { association :dot_coffee, user: user }
|
||||
file_type { association :dot_coffee, user: }
|
||||
help
|
||||
name { 'CoffeeScript' }
|
||||
network_enabled { false }
|
||||
@ -22,7 +22,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-html:latest' }
|
||||
file_type { association :dot_html, user: user }
|
||||
file_type { association :dot_html, user: }
|
||||
help
|
||||
name { 'HTML5' }
|
||||
network_enabled { false }
|
||||
@ -40,7 +40,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'openhpi/co_execenv_java:8-antlr' }
|
||||
file_type { association :dot_java, user: user }
|
||||
file_type { association :dot_java, user: }
|
||||
help
|
||||
name { 'Java 8' }
|
||||
network_enabled { false }
|
||||
@ -58,7 +58,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-jruby:latest' }
|
||||
file_type { association :dot_rb, user: user }
|
||||
file_type { association :dot_rb, user: }
|
||||
help
|
||||
name { 'JRuby 1.7' }
|
||||
network_enabled { false }
|
||||
@ -76,7 +76,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-node:latest' }
|
||||
file_type { association :dot_js, user: user }
|
||||
file_type { association :dot_js, user: }
|
||||
help
|
||||
name { 'Node.js' }
|
||||
network_enabled { false }
|
||||
@ -92,7 +92,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'openhpi/co_execenv_python:3.4' }
|
||||
file_type { association :dot_py, user: user }
|
||||
file_type { association :dot_py, user: }
|
||||
help
|
||||
name { 'Python 3.4' }
|
||||
network_enabled { false }
|
||||
@ -110,7 +110,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-ruby:latest' }
|
||||
file_type { association :dot_rb, user: user }
|
||||
file_type { association :dot_rb, user: }
|
||||
help
|
||||
name { 'Ruby 2.2' }
|
||||
network_enabled { false }
|
||||
@ -128,7 +128,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-sinatra:latest' }
|
||||
file_type { association :dot_rb, user: user }
|
||||
file_type { association :dot_rb, user: }
|
||||
exposed_ports { [4567] }
|
||||
help
|
||||
name { 'Sinatra' }
|
||||
@ -147,7 +147,7 @@ FactoryBot.define do
|
||||
default_memory_limit
|
||||
default_cpu_limit
|
||||
docker_image { 'hklement/ubuntu-sqlite:latest' }
|
||||
file_type { association :dot_sql, user: user }
|
||||
file_type { association :dot_sql, user: }
|
||||
help
|
||||
name { 'SQLite' }
|
||||
network_enabled { false }
|
||||
@ -173,6 +173,6 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
trait :singleton_execution_environment do
|
||||
initialize_with { ExecutionEnvironment.where(name: name).first_or_create }
|
||||
initialize_with { ExecutionEnvironment.where(name:).first_or_create }
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ def create_seed_file(exercise, path, file_attributes = {})
|
||||
user: exercise.user
|
||||
)
|
||||
name = File.basename(path).gsub(file_extension, '')
|
||||
file_attributes.merge!(file_type: file_type, name: name, path: path.split('/')[1..-2].join('/'), role: file_attributes[:role] || 'regular_file')
|
||||
file_attributes.merge!(file_type:, name:, path: path.split('/')[1..-2].join('/'), role: file_attributes[:role] || 'regular_file')
|
||||
if file_type.binary?
|
||||
file_attributes[:native_file] = File.open(SeedsHelper.seed_file_path(path), 'r')
|
||||
else
|
||||
@ -22,7 +22,7 @@ FactoryBot.define do
|
||||
factory :audio_video, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { "Try HTML's audio and video capabilities." }
|
||||
execution_environment { association :html, user: user }
|
||||
execution_environment { association :html, user: }
|
||||
instructions { 'Build a simple website including an HTML <audio> and <video> element. Link the following media files: chai.ogg, devstories.mp4.' }
|
||||
title { 'Audio & Video' }
|
||||
|
||||
@ -40,7 +40,7 @@ FactoryBot.define do
|
||||
factory :dummy, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Dummy' }
|
||||
execution_environment { association :ruby, user: user }
|
||||
execution_environment { association :ruby, user: }
|
||||
instructions
|
||||
title { 'Dummy' }
|
||||
|
||||
@ -56,7 +56,7 @@ FactoryBot.define do
|
||||
# attributes; `create_list`'s second argument is the number of records
|
||||
# to create and we make sure the user_exercise_feedback is associated properly to the exercise
|
||||
after(:create) do |exercise, evaluator|
|
||||
create_list(:user_exercise_feedback, evaluator.user_feedbacks_count, exercise: exercise)
|
||||
create_list(:user_exercise_feedback, evaluator.user_feedbacks_count, exercise:)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -64,7 +64,7 @@ FactoryBot.define do
|
||||
factory :even_odd, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Implement two methods even and odd which return whether a given number is even or odd, respectively.' }
|
||||
execution_environment { association :python, user: user }
|
||||
execution_environment { association :python, user: }
|
||||
instructions
|
||||
title { 'Even/Odd' }
|
||||
|
||||
@ -78,7 +78,7 @@ FactoryBot.define do
|
||||
factory :fibonacci, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Implement a recursive function that calculates a requested Fibonacci number.' }
|
||||
execution_environment { association :ruby, user: user }
|
||||
execution_environment { association :ruby, user: }
|
||||
instructions
|
||||
title { 'Fibonacci Sequence' }
|
||||
|
||||
@ -94,7 +94,7 @@ FactoryBot.define do
|
||||
factory :files, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Learn how to work with files.' }
|
||||
execution_environment { association :ruby, user: user }
|
||||
execution_environment { association :ruby, user: }
|
||||
instructions
|
||||
title { 'Working with Files' }
|
||||
|
||||
@ -108,7 +108,7 @@ FactoryBot.define do
|
||||
factory :geolocation, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { "Use the HTML5 Geolocation API to get the user's geographical position." }
|
||||
execution_environment { association :html, user: user }
|
||||
execution_environment { association :html, user: }
|
||||
instructions
|
||||
title { 'Geolocation' }
|
||||
|
||||
@ -121,7 +121,7 @@ FactoryBot.define do
|
||||
factory :hello_world, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { "Write a simple 'Hello World' application." }
|
||||
execution_environment { association :ruby, user: user }
|
||||
execution_environment { association :ruby, user: }
|
||||
instructions
|
||||
title { 'Hello World' }
|
||||
|
||||
@ -134,7 +134,7 @@ FactoryBot.define do
|
||||
factory :math, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Implement a recursive math library.' }
|
||||
execution_environment { association :java, user: user }
|
||||
execution_environment { association :java, user: }
|
||||
instructions
|
||||
title { 'Math' }
|
||||
|
||||
@ -149,7 +149,7 @@ FactoryBot.define do
|
||||
factory :primes, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Write a function that prints the first n prime numbers.' }
|
||||
execution_environment { association :node_js, user: user }
|
||||
execution_environment { association :node_js, user: }
|
||||
instructions
|
||||
title { 'Primes' }
|
||||
|
||||
@ -161,7 +161,7 @@ FactoryBot.define do
|
||||
factory :sql_select, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Learn to use the SELECT statement.' }
|
||||
execution_environment { association :sqlite, user: user }
|
||||
execution_environment { association :sqlite, user: }
|
||||
instructions { "Write a query which selects the full rows for all people with the last name 'Doe'." }
|
||||
title { 'SELECT' }
|
||||
|
||||
@ -175,7 +175,7 @@ FactoryBot.define do
|
||||
factory :tdd, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Learn to appreciate test-driven development.' }
|
||||
execution_environment { association :ruby, user: user }
|
||||
execution_environment { association :ruby, user: }
|
||||
instructions { SeedsHelper.read_seed_file('tdd/instructions.md') }
|
||||
title { 'Test-driven Development' }
|
||||
|
||||
@ -188,7 +188,7 @@ FactoryBot.define do
|
||||
factory :web_app, class: 'Exercise' do
|
||||
created_by_teacher
|
||||
description { 'Build a simple Web application with Sinatra.' }
|
||||
execution_environment { association :sinatra, user: user }
|
||||
execution_environment { association :sinatra, user: }
|
||||
instructions
|
||||
title { 'A Simple Web Application' }
|
||||
|
||||
|
@ -17,7 +17,7 @@ FactoryBot.define do
|
||||
|
||||
[ExternalUser, InternalUser].each do |klass|
|
||||
trait :"singleton_#{klass.name.underscore}" do
|
||||
initialize_with { klass.where(email: email).first_or_create }
|
||||
initialize_with { klass.where(email:).first_or_create }
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user