diff --git a/app/controllers/analytics_controller.rb b/app/controllers/analytics_controller.rb
index de765ceb0b..472120a92a 100644
--- a/app/controllers/analytics_controller.rb
+++ b/app/controllers/analytics_controller.rb
@@ -121,7 +121,7 @@ def campaign_stats
def campaign_intersection
set_campaigns
- campaign_name = @campaign_1.title + ' + ' + @campaign_2.title
+ campaign_name = "#{@campaign_1.title} + #{@campaign_2.title}"
campaign_1_course_ids = @campaign_1.courses.pluck(:id)
course_ids = @campaign_2.courses.where(id: campaign_1_course_ids).pluck(:id)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index bb5aa913a6..0b034a6c74 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -35,7 +35,7 @@ def hot_javascript_path(filename)
def fingerprinted(path, filename, file_prefix = nil)
manifest_path = "#{Rails.root}/public/#{path}/manifest.json"
manifest = Oj.load(File.read(File.expand_path(manifest_path, __FILE__)))
- "#{file_prefix}#{manifest[filename + '.js']}"
+ "#{file_prefix}#{manifest["#{filename}.js"]}"
end
def css_fingerprinted(filename)
diff --git a/app/helpers/surveys_helper.rb b/app/helpers/surveys_helper.rb
index f2d4c762e4..f13efb9915 100644
--- a/app/helpers/surveys_helper.rb
+++ b/app/helpers/surveys_helper.rb
@@ -28,7 +28,7 @@ def survey_preview_url(survey)
def question_answer_field_name(form, multiple)
name = "answer_group[#{form.object.question_id}][answer_text]"
if multiple
- name + '[]'
+ "#{name}[]"
else
name
end
diff --git a/app/mailers/fall2017_cmu_experiment_mailer.rb b/app/mailers/fall2017_cmu_experiment_mailer.rb
index 103fab4fe7..239488d80f 100644
--- a/app/mailers/fall2017_cmu_experiment_mailer.rb
+++ b/app/mailers/fall2017_cmu_experiment_mailer.rb
@@ -11,7 +11,7 @@ def email(course, instructor, email_code, reminder: false)
@course = course
@instructor = instructor
subject = 'Peer support for students in your Wikipedia assignment'
- subject = 'Reminder: ' + subject if reminder
+ subject = "Reminder: #{subject}" if reminder
@opt_in_link = "https://#{ENV['dashboard_url']}/experiments/fall2017_cmu_experiment/"\
"#{@course.id}/#{email_code}/opt_in"
@opt_out_link = "https://#{ENV['dashboard_url']}/experiments/fall2017_cmu_experiment/"\
diff --git a/app/mailers/spring2018_cmu_experiment_mailer.rb b/app/mailers/spring2018_cmu_experiment_mailer.rb
index 6bff80293c..7f6f17bd17 100644
--- a/app/mailers/spring2018_cmu_experiment_mailer.rb
+++ b/app/mailers/spring2018_cmu_experiment_mailer.rb
@@ -11,7 +11,7 @@ def email(course, instructor, email_code, reminder: false)
@course = course
@instructor = instructor
subject = 'Peer support for students in your Wikipedia assignment'
- subject = 'Reminder: ' + subject if reminder
+ subject = "Reminder: #{subject}" if reminder
@opt_in_link = "https://#{ENV['dashboard_url']}/experiments/spring2018_cmu_experiment/"\
"#{@course.id}/#{email_code}/opt_in"
@opt_out_link = "https://#{ENV['dashboard_url']}/experiments/spring2018_cmu_experiment/"\
diff --git a/app/mailers/suspected_plagiarism_mailer.rb b/app/mailers/suspected_plagiarism_mailer.rb
index da553d29ac..f56665eccf 100644
--- a/app/mailers/suspected_plagiarism_mailer.rb
+++ b/app/mailers/suspected_plagiarism_mailer.rb
@@ -17,7 +17,7 @@ def content_expert_email(alert, content_experts)
@article_url = @article&.url
@courses_user = @user.courses_users.last
@course = alert.course
- @talk_page_new_section_url = @courses_user.talk_page_url + '?action=edit§ion=new'
+ @talk_page_new_section_url = "#{@courses_user.talk_page_url}?action=edit§ion=new"
@report_url = alert.url
mail(to: @course.instructors.pluck(:email),
cc: content_experts.pluck(:email),
diff --git a/app/mailers/ticket_notification_mailer.rb b/app/mailers/ticket_notification_mailer.rb
index ada0aa3a68..511c8347a2 100644
--- a/app/mailers/ticket_notification_mailer.rb
+++ b/app/mailers/ticket_notification_mailer.rb
@@ -60,6 +60,6 @@ def carbon_copy
def email_subject
subject_prefix = @course ? "#{@course.title}: " : ''
- subject_prefix + 'Response to your help request'
+ "#{subject_prefix}Response to your help request"
end
end
diff --git a/app/models/wiki.rb b/app/models/wiki.rb
index 10e5e5e267..b2a8f9eb18 100644
--- a/app/models/wiki.rb
+++ b/app/models/wiki.rb
@@ -118,7 +118,7 @@ def domain
end
def base_url
- 'https://' + domain
+ "https://#{domain}"
end
def api_url
diff --git a/app/services/add_sandbox_template.rb b/app/services/add_sandbox_template.rb
index e1f181e37b..bc1e399009 100644
--- a/app/services/add_sandbox_template.rb
+++ b/app/services/add_sandbox_template.rb
@@ -44,7 +44,7 @@ def replace_default_with_sandbox_template
def add_sandbox_template
sandbox_summary = "adding #{@sandbox_template}"
- new_line_template = @sandbox_template + "\n"
+ new_line_template = "#{@sandbox_template}\n"
@wiki_editor.add_to_page_top(@sandbox, @current_user, new_line_template, sandbox_summary)
end
end
diff --git a/app/services/copy_course.rb b/app/services/copy_course.rb
index 003a7865db..0d076b02db 100644
--- a/app/services/copy_course.rb
+++ b/app/services/copy_course.rb
@@ -134,7 +134,7 @@ def retrieve_users_data
end
def retrieve_all_training_modules
- dashboard_uri = URI.parse(@host + '/training_modules.json')
+ dashboard_uri = URI.parse("#{@host}/training_modules.json")
response = Net::HTTP.get_response(dashboard_uri)
return [] unless response.is_a?(Net::HTTPSuccess)
diff --git a/lib/analytics/tagged_courses_csv_builder.rb b/lib/analytics/tagged_courses_csv_builder.rb
index d7fcd03cd3..e3d53e22d8 100644
--- a/lib/analytics/tagged_courses_csv_builder.rb
+++ b/lib/analytics/tagged_courses_csv_builder.rb
@@ -24,7 +24,7 @@ def initialize(tag)
def row(course) # rubocop:disable Metrics/AbcSize
row = [course.title]
- row << (course.school + '/' + course.term)
+ row << ("#{course.school}/#{course.term}")
row << (@wiki_experts.find { |user| user.course_id == course.id }&.user&.username || 'N/A')
row << course.courses_users.where(role: 1).first&.real_name
row << course.recent_revision_count
diff --git a/lib/default_campaign_update.rb b/lib/default_campaign_update.rb
index f1344289c4..f0cc319b14 100644
--- a/lib/default_campaign_update.rb
+++ b/lib/default_campaign_update.rb
@@ -14,6 +14,6 @@ def current_term
month = Time.zone.today.month
# Determine if it's spring or fall semester based on academic calendar
semester = month.between?(1, 6) ? 'spring' : 'fall'
- semester + '_' + year.to_s
+ "#{semester}_#{year}"
end
end
diff --git a/lib/errors/rescue_development_errors.rb b/lib/errors/rescue_development_errors.rb
index c80ef0f231..cbd745dac4 100644
--- a/lib/errors/rescue_development_errors.rb
+++ b/lib/errors/rescue_development_errors.rb
@@ -15,7 +15,7 @@ def self.included(base)
def self.rescue_from_rev_manifest(base)
base.rescue_from ActionView::Template::Error do |e|
raise e unless /rev-manifest.json/.match?(e.message)
- explanation = '
' + String.new(e.message) + '
'
+ explanation = "#{String.new(e.message)}
"
explanation << REV_MANIFEST_EXPLANATION
render plain: explanation,
diff --git a/lib/pagepile_api.rb b/lib/pagepile_api.rb
index f1cd3faa75..0e839fc417 100644
--- a/lib/pagepile_api.rb
+++ b/lib/pagepile_api.rb
@@ -56,7 +56,7 @@ def query_url
def pagepile
conn = Faraday.new(url: 'https://pagepile.toolforge.org')
- conn.headers['User-Agent'] = ENV['dashboard_url'] + ' ' + Rails.env
+ conn.headers['User-Agent'] = "#{ENV['dashboard_url']} #{Rails.env}"
conn
end
diff --git a/lib/petscan_api.rb b/lib/petscan_api.rb
index 3dcddfb12d..168713e605 100644
--- a/lib/petscan_api.rb
+++ b/lib/petscan_api.rb
@@ -43,7 +43,7 @@ def query_url(psid)
def petscan
conn = Faraday.new(url: 'https://petscan.wmcloud.org')
- conn.headers['User-Agent'] = ENV['dashboard_url'] + ' ' + Rails.env
+ conn.headers['User-Agent'] = "#{ENV['dashboard_url']} #{Rails.env}"
conn
end
diff --git a/lib/training/wiki_training_loader.rb b/lib/training/wiki_training_loader.rb
index 61c2edaa10..da5fb0a0c1 100644
--- a/lib/training/wiki_training_loader.rb
+++ b/lib/training/wiki_training_loader.rb
@@ -116,7 +116,7 @@ def translated_pages(base_page:, base_page_wikitext:)
return [] unless response
translations = []
response.data['messagegroupstats'].each do |language|
- translations << (base_page + '/' + language['code']) if any_translations?(language)
+ translations << ("#{base_page}/#{language['code']}") if any_translations?(language)
end
return translations
end
diff --git a/lib/wiki_course_edits.rb b/lib/wiki_course_edits.rb
index 0b00d61022..c681e9cab5 100644
--- a/lib/wiki_course_edits.rb
+++ b/lib/wiki_course_edits.rb
@@ -157,7 +157,7 @@ def add_template_to_user_page
return if initial_page_content.include?(template)
summary = @generator.enrollment_summary
- new_line_template = template + "\n"
+ new_line_template = "#{template}\n"
@wiki_editor.add_to_page_top(user_page, @current_user, new_line_template, summary)
end
@@ -170,7 +170,7 @@ def add_template_to_user_talk_page
return if initial_page_content.include?(talk_template)
talk_summary = "adding {{#{template_name(@templates, 'user_talk')}}}"
- new_line_template = talk_template + "\n"
+ new_line_template = "#{talk_template}\n"
@wiki_editor.add_to_page_top(talk_page, @current_user, new_line_template, talk_summary)
end
diff --git a/lib/wiki_course_output.rb b/lib/wiki_course_output.rb
index 1e76ab17c0..37b6f04925 100644
--- a/lib/wiki_course_output.rb
+++ b/lib/wiki_course_output.rb
@@ -44,7 +44,7 @@ def translate_course_to_wikitext
def course_details_and_description
description = Wikitext.markdown_to_mediawiki(@course.description)
- course_details + "\r" + description
+ "#{course_details}\r#{description}"
end
def course_details # rubocop:disable Metrics/MethodLength
diff --git a/lib/wiki_edits.rb b/lib/wiki_edits.rb
index dea4f0d789..40731a4375 100644
--- a/lib/wiki_edits.rb
+++ b/lib/wiki_edits.rb
@@ -24,7 +24,7 @@ def oauth_credentials_valid?(current_user)
def notify_untrained(course, current_user)
untrained_users = course.students_with_overdue_training
training_link = "https://#{ENV['dashboard_url']}/training/students"
- signed_text = I18n.t('wiki_edits.notify_overdue.message', link: training_link) + ' --~~~~'
+ signed_text = "#{I18n.t('wiki_edits.notify_overdue.message', link: training_link)} --~~~~"
message = { sectiontitle: I18n.t('wiki_edits.notify_overdue.header'),
text: signed_text,
diff --git a/lib/wikitext.rb b/lib/wikitext.rb
index 290ef41321..4a637e27f9 100644
--- a/lib/wikitext.rb
+++ b/lib/wikitext.rb
@@ -71,7 +71,7 @@ def self.assignments_to_wikilinks(assignments, home_wiki)
formatted_titles = assignments.map do |assignment|
format_assignment_title(assignment, home_wiki)
end
- wikitext = '[[' + formatted_titles.join(']], [[') + ']]'
+ wikitext = "[[#{formatted_titles.join(']], [[')}]]"
wikitext
end
@@ -90,7 +90,7 @@ def self.format_assignment_title(assignment, home_wiki)
# If the project is different, a project prefix is also necessary.
project_prefix = project == home_wiki.project ? '' : ":#{project}"
- (INTERWIKI_PREFIXES[project_prefix] || project_prefix) + language_prefix + ':' + title
+ "#{INTERWIKI_PREFIXES[project_prefix] || project_prefix}#{language_prefix}:#{title}"
end
# converts page title to a format suitable for on-wiki use
diff --git a/spec/features/surveys_spec.rb b/spec/features/surveys_spec.rb
index e38d393eb9..1682059292 100644
--- a/spec/features/surveys_spec.rb
+++ b/spec/features/surveys_spec.rb
@@ -248,7 +248,7 @@
expect(SurveyNotification.last.completed).to eq(true)
expect(Survey.last.to_csv).to match('username,') # beginning of header
- expect(Survey.last.to_csv).to match(@instructor.username + ',') # beginning of response row
+ expect(Survey.last.to_csv).to match("#{@instructor.username},") # beginning of response row
end
it 'loads a question group preview' do
diff --git a/spec/lib/analytics/course_wikidata_csv_builder_spec.rb b/spec/lib/analytics/course_wikidata_csv_builder_spec.rb
index 9ffb8e6135..f0c9ccca37 100644
--- a/spec/lib/analytics/course_wikidata_csv_builder_spec.rb
+++ b/spec/lib/analytics/course_wikidata_csv_builder_spec.rb
@@ -28,7 +28,7 @@
it 'generates csv data' do
expect(builder.generate_csv.lines.first).to start_with('course name,claims created')
- expect(builder.generate_csv.lines.last).to start_with(course.title + ',2')
+ expect(builder.generate_csv.lines.last).to start_with("#{course.title},2")
expect(builder.generate_csv.lines.count).to eq 2
end
end
diff --git a/spec/lib/importers/user_importer_spec.rb b/spec/lib/importers/user_importer_spec.rb
index fdb4d596d7..3ead757924 100644
--- a/spec/lib/importers/user_importer_spec.rb
+++ b/spec/lib/importers/user_importer_spec.rb
@@ -132,15 +132,15 @@
it 'removes invisible left-to-right and right-to-left marks from start or end of username' do
VCR.use_cassette 'user/new_from_username_with_ltr' do
- username = 'Jashan1994' + 8206.chr + 8206.chr
+ username = "Jashan1994#{8206.chr}#{8206.chr}"
user = described_class.new_from_username(username)
expect(user.username).to eq('Jashan1994')
- username = 8206.chr + 'Jashan1994'
+ username = "#{8206.chr}Jashan1994"
user = described_class.new_from_username(username)
expect(user.username).to eq('Jashan1994')
- username = 8207.chr + 'Ofrit Assaf'
+ username = "#{8207.chr}Ofrit Assaf"
user = described_class.new_from_username(username)
expect(user.username).to eq('Ofrit Assaf')
end
diff --git a/spec/lib/wiki_assignment_output_spec.rb b/spec/lib/wiki_assignment_output_spec.rb
index feceb5236f..48f9243164 100644
--- a/spec/lib/wiki_assignment_output_spec.rb
+++ b/spec/lib/wiki_assignment_output_spec.rb
@@ -197,7 +197,7 @@
output = wiki_assignment_output
.build_assignment_page_content(assignment_tag,
initial_talk_page_content)
- expected_output = assignment_tag + "\n\n" + initial_talk_page_content
+ expected_output = "#{assignment_tag}\n\n#{initial_talk_page_content}"
expect(output).to eq(expected_output)
end
@@ -209,7 +209,7 @@
output = wiki_assignment_output
.build_assignment_page_content(assignment_tag,
initial_talk_page_content)
- expected_output = talk_page_templates + assignment_tag + "\n" + additional_talk_content
+ expected_output = "#{talk_page_templates}#{assignment_tag}\n#{additional_talk_content}"
expect(output).to eq(expected_output)
end
@@ -254,7 +254,7 @@
output = wiki_assignment_output
.build_assignment_page_content(assignment_tag,
initial_talk_page_content)
- expected_output = initial_talk_page_content + assignment_tag + "\n"
+ expected_output = "#{initial_talk_page_content}#{assignment_tag}\n"
expect(output).to eq(expected_output)
end
end
diff --git a/spec/mailers/course_approval_mailer_spec.rb b/spec/mailers/course_approval_mailer_spec.rb
index 48d959f5e2..ee899414c2 100644
--- a/spec/mailers/course_approval_mailer_spec.rb
+++ b/spec/mailers/course_approval_mailer_spec.rb
@@ -11,7 +11,7 @@
it 'delivers an email with an enrollment link' do
allow(Features).to receive(:email?).and_return(true)
- expect(mail.html_part.body).to include(escaped_slug(course.slug) + '?enroll=')
+ expect(mail.html_part.body).to include("#{escaped_slug(course.slug)}?enroll=")
expect(mail.to).to eq([instructor.email])
end
end
diff --git a/spec/services/copy_course_spec.rb b/spec/services/copy_course_spec.rb
index 7186f4eb99..2b42b42b04 100644
--- a/spec/services/copy_course_spec.rb
+++ b/spec/services/copy_course_spec.rb
@@ -12,11 +12,11 @@
let(:existent_prod_course_slug) do
'University_of_South_Carolina/Invertebrate_Zoology_(COPIED_FROM_Spring_2022)'
end
- let(:course_url) { url_base + existent_prod_course_slug + '/course.json' }
- let(:categories_url) { url_base + existent_prod_course_slug + '/categories.json' }
- let(:users_url) { url_base + existent_prod_course_slug + '/users.json' }
- let(:timeline_url) { url_base + existent_prod_course_slug + '/timeline.json' }
- let(:training_modules_url) { @selected_dashboard + '/training_modules.json' }
+ let(:course_url) { "#{url_base}#{existent_prod_course_slug}/course.json" }
+ let(:categories_url) { "#{url_base}#{existent_prod_course_slug}/categories.json" }
+ let(:users_url) { "#{url_base}#{existent_prod_course_slug}/users.json" }
+ let(:timeline_url) { "#{url_base}#{existent_prod_course_slug}/timeline.json" }
+ let(:training_modules_url) { "#{@selected_dashboard}/training_modules.json" }
let(:course_response_body) do
'{
"course": {