Skip to content

Commit

Permalink
Fix Rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerth committed Jan 24, 2025
1 parent 0328551 commit ce57019
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/codeharbor_links_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def set_user_and_authorize
end

def codeharbor_link_params
params.require(:codeharbor_link).permit(:push_url, :check_uuid_url, :api_key)
params.expect(codeharbor_link: %i[push_url check_uuid_url api_key])
end
end
4 changes: 2 additions & 2 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ def set_comment
end

def comment_params_for_update
params.require(:comment).permit(:text)
params.expect(comment: [:text])
end

def comment_params_without_request_id
comment_params.except :request_id
end

def comment_params
params.require(:comment).permit(:file_id, :row, :column, :text, :request_id).merge(user: current_user)
params.expect(comment: %i[file_id row column text request_id]).merge(user: current_user)
end

def send_mail_to_author(comment, request_for_comment)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/internal_users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def deliver_reset_password_instructions
end

def internal_user_params
permitted_params = params.require(:internal_user).permit(:consumer_id, :email, :name, study_group_ids: []).presence || {}
permitted_params = params.expect(internal_user: [:consumer_id, :email, :name, {study_group_ids: []}]).presence || {}
checked_study_group_memberships = @study_group_memberships.select {|sgm| permitted_params[:study_group_ids]&.include? sgm.study_group.id.to_s }
removed_study_group_memberships = @study_group_memberships.reject {|sgm| permitted_params[:study_group_ids]&.include? sgm.study_group.id.to_s }

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/programming_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def authorize!
end

def programming_group_params
params.require(:programming_group).permit(:programming_partner_ids, programming_group_membership_ids: []) if params[:programming_group].present?
params.expect(programming_group: [:programming_partner_ids, {programming_group_membership_ids: []}]) if params[:programming_group].present?
end

def set_exercise_and_authorize
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/request_for_comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def set_request_for_comment

def request_for_comment_params
# The study_group_id might not be present in the session (e.g. for internal users), resulting in session[:study_group_id] = nil which is intended.
params.require(:request_for_comment).permit(:exercise_id, :file_id, :question, :requested_at, :solved, :submission_id).merge(user: current_user)
params.expect(request_for_comment: %i[exercise_id file_id question requested_at solved submission_id]).merge(user: current_user)
end

# The index page requires the grouping of the study groups
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/study_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def destroy
end

def study_group_params
params.require(:study_group).permit(:name, study_group_membership_ids: [])
params.expect(study_group: [:name, {study_group_membership_ids: []}])
end
private :study_group_params

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def deny_access_for_users_without_webauthn_credentials
def credential_param
return @credential_param if defined? @credential_param

credential_param = params.require(:webauthn_credential).permit(:credential)[:credential]
credential_param = params.expect(webauthn_credential: [:credential])[:credential]
@credential_param = JSON.parse(credential_param.to_s)
rescue JSON::ParserError
@credential_param = {}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/webauthn_credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def set_webauthn_credential
end

def webauthn_credential_params
params.require(:webauthn_credential).permit(:credential, :label)
params.expect(webauthn_credential: %i[credential label])
end

def credential_param
Expand Down

0 comments on commit ce57019

Please sign in to comment.