diff --git a/.rubocop.common.yml b/.rubocop.common.yml index 74b2dc34147..57fd02c51a9 100644 --- a/.rubocop.common.yml +++ b/.rubocop.common.yml @@ -301,6 +301,8 @@ Style/SelfAssignment: Severity: error Style/Semicolon: Severity: error +Style/SignalException: + Severity: error Style/SingleArgumentDig: Severity: error Style/SingleLineMethods: @@ -389,8 +391,6 @@ Style/RescueModifier: # TODO AutoCorrect: false Style/ReturnNil: # TODO: autocorrect (investigate violations) Enabled: false -Style/SignalException: # TODO: autocorrect - Enabled: false Style/StderrPuts: # TODO: autocorrect Enabled: false Style/StringConcatenation: # TODO: autocorrect (maybe) diff --git a/app/controllers/disable_post_to_sis_api_controller.rb b/app/controllers/disable_post_to_sis_api_controller.rb index 43c4f15618b..9943ac57211 100644 --- a/app/controllers/disable_post_to_sis_api_controller.rb +++ b/app/controllers/disable_post_to_sis_api_controller.rb @@ -69,7 +69,7 @@ class DisablePostToSisApiController < ApplicationController if params[:course_id] api_find(Course, params[:course_id]) else - fail ActiveRecord::RecordNotFound, 'unknown context type' + raise ActiveRecord::RecordNotFound, 'unknown context type' end end diff --git a/app/controllers/grading_periods_controller.rb b/app/controllers/grading_periods_controller.rb index c1f14db934f..86114986892 100644 --- a/app/controllers/grading_periods_controller.rb +++ b/app/controllers/grading_periods_controller.rb @@ -181,7 +181,7 @@ class GradingPeriodsController < ApplicationController def grading_period(inherit: true) @grading_period ||= begin grading_period = GradingPeriod.for(@context, inherit: inherit).find_by(id: params[:id]) - fail ActionController::RoutingError, 'Not Found' if grading_period.blank? + raise ActionController::RoutingError, 'Not Found' if grading_period.blank? grading_period end diff --git a/app/controllers/sis_api_controller.rb b/app/controllers/sis_api_controller.rb index 0f771b8a219..11ce03f674a 100644 --- a/app/controllers/sis_api_controller.rb +++ b/app/controllers/sis_api_controller.rb @@ -368,7 +368,7 @@ class SisApiController < ApplicationController elsif params[:course_id] api_find(Course, params[:course_id]) else - fail ActiveRecord::RecordNotFound, 'unknown context type' + raise ActiveRecord::RecordNotFound, 'unknown context type' end end diff --git a/app/models/importers/tool_profile_importer.rb b/app/models/importers/tool_profile_importer.rb index 50395567842..deb3896772f 100644 --- a/app/models/importers/tool_profile_importer.rb +++ b/app/models/importers/tool_profile_importer.rb @@ -62,7 +62,7 @@ module Importers missing_keys = values.select { |_, v| v.nil? }.keys if missing_keys.present? - fail MissingRequiredToolProfileValuesError, I18n.t("Missing required values: %{missing_values}", missing_values: missing_keys.join(',')) + raise MissingRequiredToolProfileValuesError, I18n.t("Missing required values: %{missing_values}", missing_values: missing_keys.join(',')) else values end diff --git a/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/codepoint_test_helper.rb b/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/codepoint_test_helper.rb index 9abae59d545..10c8b0adf16 100644 --- a/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/codepoint_test_helper.rb +++ b/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/codepoint_test_helper.rb @@ -28,7 +28,7 @@ module CodepointTestHelper if expected != actual message = "<#{expected.inspect}> expected but was <#{actual.inspect}>\n" message << " defined in #{LuckySneaks::Unidecoder.in_json_file(encoded)}" - fail message + raise message # raise Test::Unit::AssertionFailedError.new(message) end end diff --git a/lib/rake/task_graph.rb b/lib/rake/task_graph.rb index 2149f04c738..b44eb9790d0 100644 --- a/lib/rake/task_graph.rb +++ b/lib/rake/task_graph.rb @@ -112,7 +112,7 @@ module Rake end if undefined.any? - fail <<~TEXT + raise <<~TEXT The following nodes are listed as dependents but were not defined: @@ -124,7 +124,7 @@ module Rake def take_or_resolve(node, batch, to_take, visited = []) if visited.include?(node) - fail "node \"#{node}\" has a self or circular dependency" + raise "node \"#{node}\" has a self or circular dependency" end # don't dupe if we already took it this pass (e.g. as a dep): diff --git a/lib/tasks/css.rake b/lib/tasks/css.rake index d3a0533d350..8deb6bab82b 100644 --- a/lib/tasks/css.rake +++ b/lib/tasks/css.rake @@ -25,7 +25,7 @@ namespace :css do puts "--> creating styleguide" system('bin/dress_code config/styleguide.yml') - fail "error running dress_code" unless $?.success? + raise "error running dress_code" unless $?.success? end task :compile do @@ -46,7 +46,7 @@ namespace :css do end BrandableCSS.save_default_files! system('yarn run build:css') - fail "error running brandable_css" unless $?.success? + raise "error running brandable_css" unless $?.success? end puts "--> Finished: 'css:compile' in #{time}" end diff --git a/lib/turnitin/attachment_manager.rb b/lib/turnitin/attachment_manager.rb index ddd24221085..58e4317d8a7 100644 --- a/lib/turnitin/attachment_manager.rb +++ b/lib/turnitin/attachment_manager.rb @@ -43,7 +43,7 @@ module Turnitin Dir.mktmpdir do |dirname| turnitin_client.original_submission do |response| content_disposition = response.headers['content-disposition'] - fail Errors::ScoreStillPendingError if content_disposition.nil? + raise Errors::ScoreStillPendingError if content_disposition.nil? filename = content_disposition.match(/filename=("?)(.+)\1/)[2] filename.tr!('/', '-') diff --git a/lib/vericite.rb b/lib/vericite.rb index bafe8ea600f..e07385101f3 100644 --- a/lib/vericite.rb +++ b/lib/vericite.rb @@ -240,7 +240,7 @@ module VeriCite unless is_response_success?(response) response[:return_message] = "An error has occurred while creating the VeriCite assignment." response[:public_error_message] = response[:return_message] - fail "Failed to create assignment: #{assignment_id}, site #{context_id}" + raise "Failed to create assignment: #{assignment_id}, site #{context_id}" end # this is a flag to signal success response[:assignment_id] = assignment.id @@ -272,7 +272,7 @@ module VeriCite unless is_response_success?(response) response[:return_message] = "An error has occurred while submitting the paper to VeriCite." response[:public_error_message] = response[:return_message] - fail "Failed to submit paper: #{external_content_data.external_content_id}" + raise "Failed to submit paper: #{external_content_data.external_content_id}" end data.each do |externalContentUploadInfo| # API will return an upload URL to store the submission (throws an exception if it fails) @@ -301,7 +301,7 @@ module VeriCite unless is_response_success?(response) response[:return_message] = "An error has occurred while getting scores from VeriCite." response[:public_error_message] = response[:return_message] - fail "Failed to get scores for site: #{context_id}, assignment: #{assignment_id}, user: #{user_id}, exId: #{args[:oid]}" + raise "Failed to get scores for site: #{context_id}, assignment: #{assignment_id}, user: #{user_id}, exId: #{args[:oid]}" end # create the user scores map and cache it data.each do |reportScoreReponse| @@ -345,7 +345,7 @@ module VeriCite unless is_response_success?(response) response[:return_message] = "An error has occurred while getting the report URL from VeriCite." response[:public_error_message] = response[:return_message] - fail "Failed to get the report url for site: #{context_id}, assignment: #{assignment_id}, user: #{user_id}, exId: #{args[:oid]}, token_user: #{token_user}, token_user_role: #{token_user_role}" + raise "Failed to get the report url for site: #{context_id}, assignment: #{assignment_id}, user: #{user_id}, exId: #{args[:oid]}, token_user: #{token_user}, token_user_role: #{token_user_role}" end data.each do |reportURLLinkReponse| # should only be 1 url diff --git a/spec/apis/v1/discussion_topics_api_spec.rb b/spec/apis/v1/discussion_topics_api_spec.rb index 45416ef456c..e28528979e5 100644 --- a/spec/apis/v1/discussion_topics_api_spec.rb +++ b/spec/apis/v1/discussion_topics_api_spec.rb @@ -2666,7 +2666,7 @@ describe DiscussionTopicsController, type: :request do it "sets and return editor_id if editing another user's post" do pending "WIP: Not implemented" - fail + raise end it "fails if the max entry depth is reached" do diff --git a/spec/apis/v1/outcomes_import/outcomes_import_api_spec.rb b/spec/apis/v1/outcomes_import/outcomes_import_api_spec.rb index a7dc6826d5d..e924fd230dd 100644 --- a/spec/apis/v1/outcomes_import/outcomes_import_api_spec.rb +++ b/spec/apis/v1/outcomes_import/outcomes_import_api_spec.rb @@ -122,7 +122,7 @@ describe "Outcomes Import API", type: :request do case type when "available" then return available_json(expected_status: expected_status) when "create" then return create_json(guid: guid, expected_status: expected_status) - else fail "unknown request type" + else raise "unknown request type" end end end diff --git a/spec/selenium/dashboard/dashcards_spec.rb b/spec/selenium/dashboard/dashcards_spec.rb index 58d92cdf777..d9a7499dd20 100644 --- a/spec/selenium/dashboard/dashcards_spec.rb +++ b/spec/selenium/dashboard/dashcards_spec.rb @@ -299,7 +299,7 @@ describe 'dashcards' do def select_color_palette_from_calendar_page get '/calendar' - fail 'Not the right course' unless f('#context-list li:nth-of-type(2)').text.include? @course1.name + raise 'Not the right course' unless f('#context-list li:nth-of-type(2)').text.include? @course1.name f('#context-list li:nth-of-type(2) .ContextList__MoreBtn').click wait_for_ajaximations