Skip to content

Commit 7baf3df

Browse files
committed
Fix Rubocop offenses
1 parent ecf5b6f commit 7baf3df

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

app/controllers/account_links_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ def set_user
9191

9292
# Never trust parameters from the scary internet, only allow the following list through.
9393
def account_link_params
94-
params.require(:account_link).permit(:push_url, :check_uuid_url, :api_key, :name, :proforma_version)
94+
params.expect(account_link: %i[push_url check_uuid_url api_key name proforma_version])
9595
end
9696
end

app/controllers/collections_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def collection_tasks_params
182182
end
183183

184184
def collection_params
185-
params.require(:collection).permit(:title, :task_ids, :visibility_level, :description,
186-
collection_tasks_attributes: collection_tasks_params)
185+
params.expect(collection: [:title, :task_ids, :visibility_level, :description,
186+
{collection_tasks_attributes: [collection_tasks_params]}])
187187
end
188188
end

app/controllers/comments_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ def load_and_authorize_comment
5555

5656
# Never trust parameters from the scary internet, only allow the following list through.
5757
def comment_params
58-
params.require(:comment).permit(:text)
58+
params.expect(comment: [:text])
5959
end
6060
end

app/controllers/concerns/task_parameters.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ def file_params
1010

1111
def test_params
1212
[:id, :title, :testing_framework_id, :description, :internal_description, :test_type, :xml_id, :validity, :timeout, :_destroy,
13-
:parent_id, {files_attributes: file_params}]
13+
:parent_id, {files_attributes: [file_params]}]
1414
end
1515

1616
def model_solution_params
17-
[:id, :description, :internal_description, :xml_id, :_destroy, :parent_id, {files_attributes: file_params}]
17+
[:id, :description, :internal_description, :xml_id, :_destroy, :parent_id, {files_attributes: [file_params]}]
1818
end
1919

2020
def task_params
21-
params.require(:task).permit(:title, :description, :internal_description, :parent_uuid, :language, :license_id,
22-
:programming_language_id, :access_level, files_attributes: file_params, tests_attributes: test_params,
23-
model_solutions_attributes: model_solution_params, label_names: []).tap {|parameters| fix_nested_files_params(parameters) }
21+
params.expect(task: [:title, :description, :internal_description, :parent_uuid, :language, :license_id,
22+
:programming_language_id, :access_level, {files_attributes: [file_params], tests_attributes: [test_params],
23+
model_solutions_attributes: [model_solution_params], label_names: []}]).tap {|parameters| fix_nested_files_params(parameters) }
2424
end
2525

2626
def group_tasks_params
27-
params.require(:group_tasks).permit(group_ids: [])
27+
params.expect(group_tasks: [group_ids: []])
2828
end
2929

3030
def import_confirm_params

app/controllers/groups_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ def set_user
132132

133133
# Never trust parameters from the scary internet, only allow the following list through.
134134
def group_params
135-
params.require(:group).permit(:name, :description)
135+
params.expect(group: %i[name description])
136136
end
137137
end

app/controllers/labels_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def search # rubocop:disable Metrics/AbcSize
5050
private
5151

5252
def label_params
53-
params.require(:label).permit(:color)
53+
params.expect(label: [:color])
5454
end
5555

5656
def load_and_authorize_label

app/controllers/messages_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ def load_and_authorize_user
8181

8282
# Never trust parameters from the scary internet, only allow the following list through.
8383
def message_params
84-
params.require(:message).permit(:text, :sender_id, :recipient_id, :sender_status, :recipient_status)
84+
params.expect(message: %i[text sender_id recipient_id sender_status recipient_status])
8585
end
8686
end

app/controllers/ratings_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def load_and_authorize_task
2626

2727
# Never trust parameters from the scary internet, only allow the following list through.
2828
def rating_params
29-
params.require(:rating).permit(Rating::CATEGORIES)
29+
params.expect(rating: Rating::CATEGORIES)
3030
end
3131

3232
def handle_own_rating

0 commit comments

Comments
 (0)