RuboCop: Style/SignalException

[skip-stages=Flakey]

auto-corrected

Change-Id: I44760d64545d7ea55561536b99b9e70bff1dfa4f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278847
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-11-18 16:43:39 -07:00
parent 185501719c
commit bac1dd1bc0
13 changed files with 19 additions and 19 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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!('/', '-')

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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