diff --git a/.rubocop.common.yml b/.rubocop.common.yml
index 4d2feb00c43..dcda87f890c 100644
--- a/.rubocop.common.yml
+++ b/.rubocop.common.yml
@@ -191,6 +191,8 @@ Specs/EnsureSpecExtension:
Style/Alias:
EnforcedStyle: prefer_alias_method # https://github.com/rubocop/ruby-style-guide/issues/821
Severity: error
+Style/BarePercentLiterals:
+ Severity: error
Style/CaseLikeIf:
Severity: error
Style/ColonMethodCall:
@@ -244,6 +246,9 @@ Style/ParenthesesAroundCondition:
Severity: error
Style/PercentLiteralDelimiters:
Severity: error
+Style/PercentQLiterals:
+ EnforcedStyle: upper_case_q
+ Severity: error
Style/PerlBackrefs:
Enabled: false # Regexp.last_match(1) is far worse than $1
Style/PreferredHashMethods:
@@ -365,8 +370,6 @@ Style/NumericLiterals: # TODO: autocorrect
Enabled: false
Style/ParallelAssignment: # TODO: autocorrect (with probable exceptions)
Enabled: false
-Style/PercentQLiterals: # TODO: autocorrect
- Enabled: false
Style/RedundantSelf: # TODO: autocorrect
Enabled: false
Style/RescueModifier: # TODO
diff --git a/gems/canvas_kaltura/spec/canvas_kaltura/kaltura_client_v3_spec.rb b/gems/canvas_kaltura/spec/canvas_kaltura/kaltura_client_v3_spec.rb
index 12e283f4e89..0c4ccddd7f7 100644
--- a/gems/canvas_kaltura/spec/canvas_kaltura/kaltura_client_v3_spec.rb
+++ b/gems/canvas_kaltura/spec/canvas_kaltura/kaltura_client_v3_spec.rb
@@ -409,7 +409,7 @@ describe CanvasKaltura::ClientV3 do
}]
expect(@kaltura).to receive(:bulkUploadCsv).with(
- %Q(the_name,the_desc,the_tags,the_url,the_media_type,"","","","","","",the_partner_data\n)
+ %(the_name,the_desc,the_tags,the_url,the_media_type,"","","","","","",the_partner_data\n)
)
@kaltura.bulkUploadAdd(files)
diff --git a/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb b/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb
index 190de4c3476..3429a27064c 100644
--- a/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb
+++ b/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb
@@ -41,7 +41,7 @@ describe Qti::AssessmentTestConverter do
def test_section(select)
Nokogiri::XML(<<~XML).at_css('testPart')
- #{select && %Q()}
+ #{select && %()}
XML
end
diff --git a/lib/inst_fs.rb b/lib/inst_fs.rb
index 76928f4d7e1..47224939c10 100644
--- a/lib/inst_fs.rb
+++ b/lib/inst_fs.rb
@@ -43,7 +43,7 @@ module InstFS
if !session[:shown_instfs_pixel] && user && enabled?
session[:shown_instfs_pixel] = true
pixel_url = login_pixel_url(token: session_jwt(user, oauth_host))
- %Q(
).html_safe
+ %(
).html_safe
end
end
diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake
index 146e59f5db7..5710536da32 100644
--- a/lib/tasks/rspec.rake
+++ b/lib/tasks/rspec.rake
@@ -195,7 +195,7 @@ unless Rails.env.production? || ARGV.any? { |a| a.start_with?('gems') }
desc "check if spec server is running"
task :status do
if File.exist?(daemonized_server_pid)
- $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).delete("\n")})}
+ $stderr.puts %{spec_server is running (PID: #{File.read(daemonized_server_pid).delete("\n")})}
else
$stderr.puts "No server running."
end
diff --git a/spec/apis/user_content_spec.rb b/spec/apis/user_content_spec.rb
index cbafb948ba7..fbaa4d7e595 100644
--- a/spec/apis/user_content_spec.rb
+++ b/spec/apis/user_content_spec.rb
@@ -426,7 +426,7 @@ describe UserContent, type: :request do
end
def confirm_url_stability(url)
- link = %Q(what)
+ link = %(what)
html = tester.process_incoming_html_content(link)
doc = Nokogiri::HTML5.fragment(html)
expect(doc.at_css('a')['href']).to eq url
@@ -450,7 +450,7 @@ describe UserContent, type: :request do
end
def confirm_url_stability(url)
- link = %Q(whata>)
+ link = %(whata>)
html = tester.process_incoming_html_content(link)
doc = Nokogiri::HTML5.fragment(html)
expect(doc.at_css('a')['href']).to eq url
diff --git a/spec/controllers/oauth2_provider_controller_spec.rb b/spec/controllers/oauth2_provider_controller_spec.rb
index 8d6b6525bd7..b6be751b312 100644
--- a/spec/controllers/oauth2_provider_controller_spec.rb
+++ b/spec/controllers/oauth2_provider_controller_spec.rb
@@ -474,8 +474,8 @@ describe OAuth2ProviderController do
let(:redis) do
redis = double('Redis')
allow(redis).to receive(:get)
- allow(redis).to receive(:get).with(valid_code_redis_key).and_return(%Q({"client_id": #{key.id}, "user": #{user.id}}))
- allow(redis).to receive(:del).with(valid_code_redis_key).and_return(%Q({"client_id": #{key.id}, "user": #{user.id}}))
+ allow(redis).to receive(:get).with(valid_code_redis_key).and_return(%({"client_id": #{key.id}, "user": #{user.id}}))
+ allow(redis).to receive(:del).with(valid_code_redis_key).and_return(%({"client_id": #{key.id}, "user": #{user.id}}))
redis
end
diff --git a/spec/helpers/quizzes_helper_spec.rb b/spec/helpers/quizzes_helper_spec.rb
index f5a3528c6b0..42a83c00ee9 100644
--- a/spec/helpers/quizzes_helper_spec.rb
+++ b/spec/helpers/quizzes_helper_spec.rb
@@ -186,7 +186,7 @@ describe QuizzesHelper do
context 'fill_in_multiple_blanks_question' do
before do
- @question_text = %q()
+ @question_text = %()
@answer_list = []
@answers = []
@@ -205,7 +205,7 @@ describe QuizzesHelper do
:answers => @answers
)
- expect(html).to eq %q()
+ expect(html).to eq %()
end
it 'sanitizes user input' do
@@ -220,7 +220,7 @@ describe QuizzesHelper do
:answers => @answers
)
- expect(html).to eq %q||
+ expect(html).to eq %||
expect(html).to be_html_safe
end
diff --git a/spec/lib/canvas/plugins/ticketing_system/custom_error_spec.rb b/spec/lib/canvas/plugins/ticketing_system/custom_error_spec.rb
index a3241b946b0..457f333ca38 100644
--- a/spec/lib/canvas/plugins/ticketing_system/custom_error_spec.rb
+++ b/spec/lib/canvas/plugins/ticketing_system/custom_error_spec.rb
@@ -154,7 +154,7 @@ module Canvas::Plugins::TicketingSystem
it "maps an env hash to a json string" do
report.http_env = { one: "two", three: "four" }
- expect(delegate.pretty_http_env).to eq(%Q(one: "two"\nthree: "four"))
+ expect(delegate.pretty_http_env).to eq(%(one: "two"\nthree: "four"))
end
end
end
diff --git a/spec/lib/cc/cc_exporter_spec.rb b/spec/lib/cc/cc_exporter_spec.rb
index a345ad3b118..2bdb7abc531 100644
--- a/spec/lib/cc/cc_exporter_spec.rb
+++ b/spec/lib/cc/cc_exporter_spec.rb
@@ -440,7 +440,7 @@ describe "Common Cartridge exporting" do
it "does not get confused by attachments with absolute paths" do
@att = Attachment.create!(:filename => 'first.png', :uploaded_data => StringIO.new('ohai'), :folder => Folder.unfiled_folder(@course), :context => @course)
- @q1 = @course.quizzes.create(:title => 'quiz1', :description => %Q(
))
+ @q1 = @course.quizzes.create(:title => 'quiz1', :description => %(
))
@ce.export_type = ContentExport::COMMON_CARTRIDGE
run_export
doc = Nokogiri::XML.parse(@zip_file.read("#{mig_id(@q1)}/assessment_meta.xml"))
@@ -593,7 +593,7 @@ describe "Common Cartridge exporting" do
it "exports CC 1.3 assignments" do
@file = Attachment.create!(:filename => 'test.txt', :uploaded_data => StringIO.new('ohai'), :folder => Folder.unfiled_folder(@course), :context => @course)
- @course.assignments.create! name: 'test assignment', description: %Q(what?), points_possible: 11,
+ @course.assignments.create! name: 'test assignment', description: %(what?), points_possible: 11,
submission_types: 'online_text_entry,online_upload,online_url'
@ce.export_type = ContentExport::COMMON_CARTRIDGE
@ce.save!
@@ -620,7 +620,7 @@ describe "Common Cartridge exporting" do
expect(extension_node.namespace.href).to eq 'http://canvas.instructure.com/xsd/cccv1p0'
# validate fallback html manifest resource
- variant_tag = @manifest_doc.at_css(%Q(resource[identifier="#{assignment_id}_fallback"])).elements.first
+ variant_tag = @manifest_doc.at_css(%(resource[identifier="#{assignment_id}_fallback"])).elements.first
expect(variant_tag.name).to eq 'variant'
expect(variant_tag.attribute('identifierref').value).to eql assignment_id
expect(variant_tag.next_element.name).to eq 'file'
diff --git a/spec/lib/user_content_spec.rb b/spec/lib/user_content_spec.rb
index 11f10400e3b..eff6b1202bd 100644
--- a/spec/lib/user_content_spec.rb
+++ b/spec/lib/user_content_spec.rb
@@ -154,14 +154,14 @@ describe UserContent do
end
it "matches absolute paths with https" do
- expect(regex.match(%Q()).to_a).to eq([
- "https://this-is-terrible.example.com/courses/#{rewriter.context.id}/pages/whatever?srsly=0",
- "https://this-is-terrible.example.com",
- "/courses/#{rewriter.context.id}",
- "pages",
- "whatever",
- "?srsly=0"
- ])
+ expect(regex.match(%()).to_a).to eq([
+ "https://this-is-terrible.example.com/courses/#{rewriter.context.id}/pages/whatever?srsly=0",
+ "https://this-is-terrible.example.com",
+ "/courses/#{rewriter.context.id}",
+ "pages",
+ "whatever",
+ "?srsly=0"
+ ])
end
it "doesn't match invalid hostnames" do
diff --git a/spec/models/content_migration/course_copy_attachments_spec.rb b/spec/models/content_migration/course_copy_attachments_spec.rb
index b337795bf43..6a0f4ce255a 100644
--- a/spec/models/content_migration/course_copy_attachments_spec.rb
+++ b/spec/models/content_migration/course_copy_attachments_spec.rb
@@ -152,11 +152,11 @@ describe ContentMigration do
it "preserves new-RCE mediahref iframes" do
att = @copy_from.attachments.create!(:filename => 'videro.mov', :uploaded_data => StringIO.new('...'), :folder => Folder.root_folders(@copy_from).first)
page = @copy_from.wiki_pages.create!(:title => "watch this y'all", :body =>
- %Q())
+ %())
run_course_copy
att_to = @copy_to.attachments.where(migration_id: mig_id(att)).take
page_to = @copy_to.wiki_pages.where(migration_id: mig_id(page)).take
- expect(page_to.body).to include %Q(src="/media_objects_iframe?mediahref=/courses/#{@copy_to.id}/files/#{att_to.id}/download")
+ expect(page_to.body).to include %(src="/media_objects_iframe?mediahref=/courses/#{@copy_to.id}/files/#{att_to.id}/download")
end
it "references existing usage rights on course copy" do
diff --git a/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb
index 9a753bb4a48..30ac5f366a3 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb
@@ -200,7 +200,7 @@ describe "speed grader submissions" do
end
expect(f('#submission_not_newest_notice')).to be_displayed
- f(%Q(#students_selectmenu option[value="#{submission2.user.id}"])).click
+ f(%(#students_selectmenu option[value="#{submission2.user.id}"])).click
in_frame 'speedgrader_iframe', '.is-inside-submission-frame' do
wait_for_ajaximations
diff --git a/spec/views/shared/_select_content_dialog.html.erb_spec.rb b/spec/views/shared/_select_content_dialog.html.erb_spec.rb
index abb6344ddad..379d094133b 100644
--- a/spec/views/shared/_select_content_dialog.html.erb_spec.rb
+++ b/spec/views/shared/_select_content_dialog.html.erb_spec.rb
@@ -213,7 +213,7 @@ describe "shared/_select_content_dialog" do
view_context
render partial: 'shared/select_content_dialog'
page = Nokogiri(response.body)
- expect(page.css(%Q(#quizs_select .module_item_select option[value="quiz_#{existing_quiz.id}"]))).not_to be_empty
+ expect(page.css(%(#quizs_select .module_item_select option[value="quiz_#{existing_quiz.id}"]))).not_to be_empty
expect(page.css('#quizs_select .module_item_select option[value="new"]')).to be_empty
expect(page.css('#assignments_select .module_item_select option[value="new"]')).to be_empty
end