Skip to content

Commit c36d5cd

Browse files
committed
Fix Rubocop offenses
1 parent 3bfdd41 commit c36d5cd

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

app/controllers/programming_groups_controller.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,17 @@ def edit
3838
end
3939

4040
def create
41-
programming_partner_ids = programming_group_params&.fetch(:programming_partner_ids, [])&.split(',')&.map(&:strip)&.uniq
42-
users = programming_partner_ids&.map do |partner_id|
41+
programming_partner_ids = []
42+
programming_partner_ids = programming_group_params.fetch(:programming_partner_ids, '').split(',').map(&:strip).uniq if programming_group_params
43+
users = programming_partner_ids.map do |partner_id|
4344
User.find_by_id_with_type(partner_id)
4445
rescue ActiveRecord::RecordNotFound
4546
partner_id
4647
end
4748
@programming_group = ProgrammingGroup.new(exercise: @exercise, users:)
4849
authorize!
4950

50-
unless programming_partner_ids&.include? current_user.id_with_type
51+
unless programming_partner_ids.include? current_user.id_with_type
5152
@programming_group.add(current_user)
5253
end
5354

app/controllers/submissions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ def score
268268
# send_hints(client_socket, StructuredError.where(submission: @submission))
269269

270270
# Finally, send the score to the LTI consumer and check for notifications
271-
check_submission(send_scores(@submission)).compact.each do |notification|
272-
client_socket&.send_data(notification&.merge(cmd: :status)&.to_json)
271+
check_submission(send_scores(@submission)).compact_blank.each do |notification|
272+
client_socket&.send_data(notification.merge(cmd: :status).to_json)
273273
end
274274
rescue Runner::Error::RunnerInUse => e
275275
extract_durations(e)

app/models/code_ocean/file.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ def missing_read_permissions?
180180

181181
# We use a bitwise AND with the permission bits and compare that to zero
182182
if privileged_execution.present?
183-
(permissions & OWNER_READ_PERMISSION).zero?
183+
permissions.nobits?(OWNER_READ_PERMISSION)
184184
else
185-
(permissions & OTHER_READ_PERMISSION).zero?
185+
permissions.nobits?(OTHER_READ_PERMISSION)
186186
end
187187
end
188188
end

lib/file_tree.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def name(node)
111111
private :name
112112

113113
def path(node)
114-
"#{node.parentage&.reverse&.drop(1)&.map(&:name)&.join('/')}/#{node.name}"
114+
path = node.parentage
115+
path = "/#{path.reverse.drop(1).map(&:name).join('/')}" unless path.nil?
116+
"#{path}/#{node.name}"
115117
end
116118
private :path
117119

0 commit comments

Comments
 (0)