Skip to content

Commit 99b1909

Browse files
committed
Fix Rubocop offenses
1 parent 489741b commit 99b1909

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

app/controllers/exercises_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def external_user_statistics
547547
# Hacky: If the autosave is the first element after a break, we need to set the delta of the following element to 0.
548548
# Since the @delta array is "broken" for filtered views anyway, we use this hack to get the red "highlight" line right.
549549
# TODO: Refactor the whole method into a more clean solution.
550-
@deltas[index + 1] = 0 if (@deltas[index]).zero? && @deltas[index + 1].present?
550+
@deltas[index + 1] = 0 if @deltas[index].zero? && @deltas[index + 1].present?
551551
@deltas.delete_at(index)
552552
end
553553
end

app/models/submission.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def run_file(action, file, runner, waiting_duration)
284284
def score_file(output, file, requesting_user)
285285
assessor = Assessor.new(execution_environment:)
286286
assessment = assessor.assess(output)
287-
passed = (assessment[:passed] == assessment[:count]) and (assessment[:score]).positive?
287+
passed = (assessment[:passed] == assessment[:count]) and assessment[:score].positive?
288288
testrun_output = passed ? nil : "status: #{output[:status]}\n stdout: #{output[:stdout]}\n stderr: #{output[:stderr]}"
289289
if testrun_output.present?
290290
execution_environment.error_templates.each do |template|

db/migrate/20210602071834_change_type_of_exposed_ports_in_execution_environment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class ChangeTypeOfExposedPortsInExecutionEnvironment < ActiveRecord::Migration[6
44
class ExecutionEnvironment < ApplicationRecord
55
end
66

7-
# rubocop:disable Rails/SkipsModelValidations:
7+
# rubocop:disable Rails/SkipsModelValidations
88
def up
99
rename_column :execution_environments, :exposed_ports, :exposed_ports_migration
1010
add_column :execution_environments, :exposed_ports, :integer, array: true, default: [], nil: true
@@ -36,5 +36,5 @@ def down
3636
end
3737
remove_column :execution_environments, :exposed_ports_migration
3838
end
39-
# rubocop:enable Rails/SkipsModelValidations:
39+
# rubocop:enable Rails/SkipsModelValidations
4040
end

lib/runner/strategy/docker_container_pool.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ def copy_files(files)
104104
Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Finished copying files" }
105105
end
106106

107-
def retrieve_files(path: './', recursive: true, privileged_execution: false) # rubocop:disable Lint/UnusedMethodArgument for the keyword argument
107+
def retrieve_files(path: './', recursive: true, privileged_execution: false) # rubocop:disable Lint/UnusedMethodArgument -- for the keyword argument
108108
# The DockerContainerPool does not support retrieving files from the runner.
109109
{'files' => []}
110110
end
111111

112-
def attach_to_execution(command, event_loop, starting_time, privileged_execution: false) # rubocop:disable Lint/UnusedMethodArgument for the keyword argument
112+
def attach_to_execution(command, event_loop, starting_time, privileged_execution: false) # rubocop:disable Lint/UnusedMethodArgument -- for the keyword argument
113113
reset_inactivity_timer
114114

115115
@command = command

lib/runner/strategy/null.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def copy_files(_files); end
2727

2828
def retrieve_files(path: './', recursive: true, privileged_execution: false); end
2929

30-
def download_file(_file, privileged_execution: false, &_block) # rubocop:disable Lint/UnusedMethodArgument for the keyword argument
30+
def download_file(_file, privileged_execution: false, &_block) # rubocop:disable Lint/UnusedMethodArgument -- for the keyword argument
3131
raise Runner::Error.new
3232
end
3333

34-
def attach_to_execution(command, event_loop, starting_time, privileged_execution: false) # rubocop:disable Lint/UnusedMethodArgument for the keyword argument
34+
def attach_to_execution(command, event_loop, starting_time, privileged_execution: false) # rubocop:disable Lint/UnusedMethodArgument -- for the keyword argument
3535
socket = Connection.new(nil, self, event_loop)
3636
# We don't want to return an error if the execution environment is changed
3737
socket.status = :terminated_by_codeocean if command == ExecutionEnvironment::VALIDATION_COMMAND

lib/tasks/detect_exercise_anomalies.rake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace :detect_exercise_anomalies do
66
# logger.level = Logger::DEBUG
77
# Rails.logger = logger
88

9-
# rubocop:disable Lint/ConstantDefinitionInBlock Style/MutableConstant
9+
# rubocop:disable Lint/ConstantDefinitionInBlock, Style/MutableConstant
1010
# These factors determine if an exercise is an anomaly, given the average working time (avg):
1111
# (avg * MIN_TIME_FACTOR) <= working_time <= (avg * MAX_TIME_FACTOR)
1212
MIN_TIME_FACTOR = 0.1
@@ -19,11 +19,9 @@ namespace :detect_exercise_anomalies do
1919
MIN_CONTRIBUTOR_WORKING_TIME = 0.0
2020

2121
# Cache exercise working times, because queries are expensive and values do not change between collections
22-
# rubocop:disable Style/MutableConstant
2322
WORKING_TIME_CACHE = {}
2423
AVERAGE_WORKING_TIME_CACHE = {}
25-
# rubocop:enable Style/MutableConstant
26-
# rubocop:enable Lint/ConstantDefinitionInBlock
24+
# rubocop:enable Lint/ConstantDefinitionInBlock, Style/MutableConstant
2725

2826
task :with_at_least, %i[number_of_exercises number_of_contributors] => :environment do |_task, args|
2927
include TimeHelper

0 commit comments

Comments
 (0)