From 1d3d9ed4992755391fdeda2805aeca489226460c Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Tue, 4 Apr 2023 15:26:44 -0700 Subject: [PATCH] rubocop: fix miscelleneuos violations in prep of bumping rubocop Change-Id: I9d37303737f00d6e022cb8fc08726e293a7336ab Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315166 Tested-by: Service Cloud Jenkins Reviewed-by: Jacob Burroughs QA-Review: Cody Cutrer Product-Review: Cody Cutrer --- .irbrc | 2 ++ app/controllers/assignments_controller.rb | 4 +--- .../discussion_topics_controller.rb | 4 ++-- app/controllers/messages_controller.rb | 2 +- app/helpers/rollup_score_aggregator_helper.rb | 2 +- app/models/assignment.rb | 2 +- app/models/collaboration.rb | 7 +++--- app/models/content_migration.rb | 2 +- app/models/importers/wiki_page_importer.rb | 2 +- app/models/lti/line_item.rb | 2 +- app/models/notification_finder.rb | 2 +- app/models/rubric.rb | 2 +- app/models/sis_batch.rb | 2 +- .../grade_summary_assignment_presenter.rb | 2 +- bin/byebug-remote | 23 +++++++++---------- bin/dress_code | 10 ++++---- bin/flakey_spec_catcher | 8 +++---- bin/rails | 11 +++++---- bin/rake | 7 +++--- bin/rdebug-ide | 6 +++-- bin/rspec | 7 +++--- bin/rubocop | 4 ++-- bin/spring | 12 +++++----- config/environments/development.rb | 2 +- config/initializers/active_record.rb | 2 +- .../activesupport-suspend_callbacks.gemspec | 1 - gems/acts_as_list/acts_as_list.gemspec | 1 - .../adheres_to_policy.gemspec | 1 - gems/attachment_fu/attachment_fu.gemspec | 1 - gems/autoextend/autoextend.gemspec | 1 - .../bookmarked_collection.gemspec | 1 - .../broadcast_policy/broadcast_policy.gemspec | 1 - .../bundler_lockfile_extensions.gemspec | 1 - .../canvas_breach_mitigation.gemspec | 1 - gems/canvas_cache/canvas_cache.gemspec | 1 - gems/canvas_cache/lib/canvas_cache/redis.rb | 2 +- gems/canvas_cache/spec/spec_helper.rb | 1 + .../canvas_cassandra/canvas_cassandra.gemspec | 1 - gems/canvas_color/canvas_color.gemspec | 1 - gems/canvas_crummy/canvas_crummy.gemspec | 1 - gems/canvas_dynamodb/canvas_dynamodb.gemspec | 1 - gems/canvas_errors/canvas_errors.gemspec | 1 - gems/canvas_ext/canvas_ext.gemspec | 1 - gems/canvas_ext/lib/canvas_ext/marshal.rb | 6 +---- gems/canvas_http/canvas_http.gemspec | 1 - gems/canvas_kaltura/canvas_kaltura.gemspec | 1 - .../canvas_mimetype_fu.gemspec | 1 - .../canvas_panda_pub/canvas_panda_pub.gemspec | 1 - gems/canvas_partman/canvas_partman.gemspec | 1 - .../canvas_quiz_statistics.gemspec | 1 - gems/canvas_sanitize/canvas_sanitize.gemspec | 1 - gems/canvas_security/Gemfile | 2 ++ gems/canvas_security/canvas_security.gemspec | 1 - gems/canvas_slug/canvas_slug.gemspec | 1 - gems/canvas_sort/canvas_sort.gemspec | 1 - gems/canvas_stringex/canvas_stringex.gemspec | 1 - .../canvas_text_helper.gemspec | 1 - gems/canvas_time/canvas_time.gemspec | 1 - gems/canvas_unzip/canvas_unzip.gemspec | 1 - gems/config_file/config_file.gemspec | 1 - gems/csv_diff/csv_diff.gemspec | 1 - gems/diigo/diigo.gemspec | 1 - gems/dr_diff/dr_diff.gemspec | 1 - .../dynamic_settings/dynamic_settings.gemspec | 1 - gems/event_stream/event_stream.gemspec | 1 - .../spec/event_stream/attr_config_spec.rb | 16 ++++++------- gems/google_drive/google_drive.gemspec | 1 - .../html_text_helper/html_text_helper.gemspec | 1 - gems/i18n_extraction/i18n_extraction.gemspec | 1 - gems/i18n_tasks/i18n_tasks.gemspec | 1 - .../spec/i18n_tasks/extract_spec.rb | 2 +- .../incoming_mail_processor.gemspec | 1 - gems/json_token/json_token.gemspec | 1 - gems/linked_in/linked_in.gemspec | 1 - gems/live_events/live_events.gemspec | 1 - .../serializers/jwt_message_serializer.rb | 4 ++-- .../lib/lti_outbound/lti_model.rb | 2 +- gems/lti_outbound/lti_outbound.gemspec | 1 - gems/multipart/multipart.gemspec | 1 - .../paginated_collection.gemspec | 1 - .../academic_benchmark.gemspec | 1 - .../account_reports/account_reports.gemspec | 1 - .../lib/account_reports/report_helper.rb | 2 +- .../moodle_importer/moodle_importer.gemspec | 1 - .../plugins/qti_exporter/qti_exporter.gemspec | 1 - .../respondus_soap_endpoint.gemspec | 1 - .../simply_versioned/simply_versioned.gemspec | 1 - gems/request_context/Gemfile | 2 ++ gems/request_context/request_context.gemspec | 1 - .../cops/specs/scope_includes.rb | 2 -- .../cops/style/concat_array_literals.rb | 2 +- gems/rubocop-canvas/rubocop-canvas.gemspec | 1 - gems/stringify_ids/stringify_ids.gemspec | 1 - .../linters/copyright_linter_spec.rb | 1 - gems/tatl_tael/tatl_tael.gemspec | 1 - gems/twitter/twitter.gemspec | 1 - gems/utf8_cleaner/utf8_cleaner.gemspec | 1 - gems/workflow/workflow.gemspec | 1 - lib/api.rb | 2 +- lib/api/v1/enrollment_term.rb | 4 +++- .../migration/external_content/migrator.rb | 18 ++++++++------- lib/i18n/backend/csv.rb | 6 ++--- lib/microsoft_sync/syncer_steps.rb | 2 +- lib/user_merge.rb | 4 ++-- script/rlint | 1 - script/tail_kinesis | 1 - ...rse_outcome_alignment_stats_loader_spec.rb | 4 ++-- .../active_record_query_trace_spec.rb | 4 ++-- spec/lib/api_spec.rb | 4 ++-- spec/models/access_token_spec.rb | 6 ++--- spec/models/context_external_tool_spec.rb | 2 +- spec/models/root_account_resolver_spec.rb | 1 + spec/models/user_service_spec.rb | 6 ++--- 113 files changed, 122 insertions(+), 176 deletions(-) diff --git a/.irbrc b/.irbrc index 2507b8ca1e9..f850f01ac33 100644 --- a/.irbrc +++ b/.irbrc @@ -1 +1,3 @@ +# frozen_string_literal: true + IRB.conf[:USE_AUTOCOMPLETE] = false diff --git a/app/controllers/assignments_controller.rb b/app/controllers/assignments_controller.rb index 5acd602bdaf..1adf6d0364e 100644 --- a/app/controllers/assignments_controller.rb +++ b/app/controllers/assignments_controller.rb @@ -622,9 +622,7 @@ class AssignmentsController < ApplicationController set_tutorial_js_env log_asset_access(["syllabus", @context], "syllabus", "other") - respond_to do |format| - format.html - end + respond_to(&:html) end end diff --git a/app/controllers/discussion_topics_controller.rb b/app/controllers/discussion_topics_controller.rb index 7a0745f217f..e72b7baba98 100644 --- a/app/controllers/discussion_topics_controller.rb +++ b/app/controllers/discussion_topics_controller.rb @@ -458,9 +458,9 @@ class DiscussionTopicsController < ApplicationController end InstStatsd::Statsd.increment("discussion_topic.index.visit") - InstStatsd::Statsd.count("discussion_topic.index.visit.pinned", @topics&.select { |dt| dt.pinned }&.count) + InstStatsd::Statsd.count("discussion_topic.index.visit.pinned", @topics&.select(&:pinned)&.count) InstStatsd::Statsd.count("discussion_topic.index.visit.discussions", @topics&.length) - InstStatsd::Statsd.count("discussion_topic.index.visit.closed_for_comments", @topics&.select { |dt| dt.locked }&.count) + InstStatsd::Statsd.count("discussion_topic.index.visit.closed_for_comments", @topics&.select(&:locked)&.count) format.json do log_api_asset_access(["topics", @context], "topics", "other") diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index b4d58d664fe..e30ce415534 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -51,7 +51,7 @@ class MessagesController < ApplicationController def html_message message = @context.messages.find(params[:message_id]) if message.html_body.present? - render inline: message.html_body, layout: false + render inline: message.html_body, layout: false # rubocop:disable Rails/RenderInline else render layout: false end diff --git a/app/helpers/rollup_score_aggregator_helper.rb b/app/helpers/rollup_score_aggregator_helper.rb index f2f0a855b0a..cc6b436cd01 100644 --- a/app/helpers/rollup_score_aggregator_helper.rb +++ b/app/helpers/rollup_score_aggregator_helper.rb @@ -34,7 +34,7 @@ module RollupScoreAggregatorHelper private def present_scores - score_sets.pluck(:score).reject(&:nil?) + score_sets.pluck(:score).compact end def latest_result diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 58575e72973..48c4dc67785 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -1582,7 +1582,7 @@ class Assignment < ActiveRecord::Base # the time zone that was active during editing time_zone = tz || (ActiveSupport::TimeZone.new(time_zone_edited) rescue nil) || Time.zone self.all_day, self.all_day_date = Assignment.all_day_interpretation( - due_at: due_at ? due_at.in_time_zone(time_zone) : nil, + due_at: due_at&.in_time_zone(time_zone), due_at_was: due_at_was, all_day_was: all_day_was, all_day_date_was: all_day_date_was diff --git a/app/models/collaboration.rb b/app/models/collaboration.rb index bdcaaa7b07d..0ca3a1f67a1 100644 --- a/app/models/collaboration.rb +++ b/app/models/collaboration.rb @@ -415,11 +415,12 @@ class Collaboration < ActiveRecord::Base end private :add_users_to_collaborators + class InvalidCollaborationType < StandardError; end + protected + # Internal: Get the authorized_service_user_id for a user. # May be overridden by other collaboration types. - protected def authorized_service_user_id_for(user) + def authorized_service_user_id_for(user) user.gmail end - - class InvalidCollaborationType < StandardError; end end diff --git a/app/models/content_migration.rb b/app/models/content_migration.rb index 141e3d46f73..0bf6e3df980 100644 --- a/app/models/content_migration.rb +++ b/app/models/content_migration.rb @@ -1154,7 +1154,7 @@ class ContentMigration < ActiveRecord::Base key = Context.api_type_name(klass) context.shard.activate do - scope = (klass.column_names.include? "assignment_id") ? klass.select(:id, :assignment_id, :migration_id) : klass.select(:id, :migration_id) + scope = klass.column_names.include?("assignment_id") ? klass.select(:id, :assignment_id, :migration_id) : klass.select(:id, :migration_id) scope = scope.where(context: context).where.not(migration_id: nil) scope = scope.only_discussion_topics if asset_type == "DiscussionTopic" end diff --git a/app/models/importers/wiki_page_importer.rb b/app/models/importers/wiki_page_importer.rb index c02c244e6cc..3b518979831 100644 --- a/app/models/importers/wiki_page_importer.rb +++ b/app/models/importers/wiki_page_importer.rb @@ -205,7 +205,7 @@ module Importers item.body = description allow_save = false if description.blank? - elsif hash[:page_type] == "module_toc" + # elsif hash[:page_type] == "module_toc" elsif hash[:topics] item.title = t("title_for_topics_category", "%{category} Topics", category: hash[:category_name]) description = (hash[:category_description]).to_s diff --git a/app/models/lti/line_item.rb b/app/models/lti/line_item.rb index 41d41d52949..213914aef92 100644 --- a/app/models/lti/line_item.rb +++ b/app/models/lti/line_item.rb @@ -112,7 +112,7 @@ class Lti::LineItem < ApplicationRecord return if resource_link.blank? ids = resource_link.line_items.pluck(:assignment_id) - return if ids.size.zero? + return if ids.empty? return if ids.uniq.size == 1 && ids.first == assignment_id errors.add(:assignment, "does not match ltiLink") diff --git a/app/models/notification_finder.rb b/app/models/notification_finder.rb index 3abe76b4845..4e062583496 100644 --- a/app/models/notification_finder.rb +++ b/app/models/notification_finder.rb @@ -38,7 +38,7 @@ class NotificationFinder def refresh_cache(notifications = Notification.all_cached) @notifications = notifications.index_by(&:name) - @notifications.values.each(&:freeze) + @notifications.each_value(&:freeze) true end end diff --git a/app/models/rubric.rb b/app/models/rubric.rb index a785cde3dd7..8ce1ac09af4 100644 --- a/app/models/rubric.rb +++ b/app/models/rubric.rb @@ -193,7 +193,7 @@ class Rubric < ActiveRecord::Base # I know. def destroy_for(context, current_user: nil) ras = rubric_associations.where(context_id: context, context_type: context.class.to_s) - if context.class.to_s == "Course" + if context.instance_of?(Course) # if rubric is removed at the course level, we want to destroy any # assignment associations found in the context of the course ras.each do |association| diff --git a/app/models/sis_batch.rb b/app/models/sis_batch.rb index f82650d0388..df3ae764cd8 100644 --- a/app/models/sis_batch.rb +++ b/app/models/sis_batch.rb @@ -115,7 +115,7 @@ class SisBatch < ActiveRecord::Base # Progress is calculated on the number of jobs remaining. num_jobs, min_rows, max_rows = Setting.get("sis_batch_rows_for_parallel", "99,100,1000").split(",").map(&:to_i) - [[(rows / num_jobs.to_f).ceil, min_rows].max, max_rows].min + (rows / num_jobs.to_f).ceil.clamp(min_rows, max_rows) end workflow do diff --git a/app/presenters/grade_summary_assignment_presenter.rb b/app/presenters/grade_summary_assignment_presenter.rb index 1dd01c8823e..3b35d6525f5 100644 --- a/app/presenters/grade_summary_assignment_presenter.rb +++ b/app/presenters/grade_summary_assignment_presenter.rb @@ -84,7 +84,7 @@ class GradeSummaryAssignmentPresenter end def is_assignment? - assignment.class.to_s == "Assignment" + assignment.instance_of?(Assignment) end def has_no_group_weight? diff --git a/bin/byebug-remote b/bin/byebug-remote index 4873905330e..6e916bc02c2 100755 --- a/bin/byebug-remote +++ b/bin/byebug-remote @@ -1,11 +1,11 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require 'byebug/core' -require 'tmpdir' +require "byebug/core" +require "tmpdir" def byebug_port_file - File.join(Dir.tmpdir, 'byebug.port') + File.join(Dir.tmpdir, "byebug.port") end def byebug_port @@ -15,17 +15,16 @@ def byebug_port end def connect - begin - while !byebug_port do - puts "Waiting for byebug port..." - sleep 0.5 - end - - Byebug.start_client('localhost', byebug_port) - rescue Errno::ECONNREFUSED + until byebug_port do + puts "Waiting for byebug port..." + sleep 0.5 end + + Byebug.start_client("localhost", byebug_port) +rescue Errno::ECONNREFUSED + nil end -while !connect do +until connect do sleep 0.5 end diff --git a/bin/dress_code b/bin/dress_code index f7d293e85e1..f8c5ee56952 100755 --- a/bin/dress_code +++ b/bin/dress_code @@ -8,11 +8,11 @@ # this file is here to facilitate running it. # -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) -require 'rubygems' -require 'bundler/setup' +require "rubygems" +require "bundler/setup" -load Gem.bin_path('dress_code', 'dress_code') +load Gem.bin_path("dress_code", "dress_code") diff --git a/bin/flakey_spec_catcher b/bin/flakey_spec_catcher index 4e369c67f97..a14ee690322 100755 --- a/bin/flakey_spec_catcher +++ b/bin/flakey_spec_catcher @@ -2,9 +2,9 @@ # frozen_string_literal: true begin - load File.expand_path("../spring", __FILE__) + load File.expand_path("spring", __dir__) rescue LoadError => e - raise unless e.message.include?('spring') + raise unless e.message.include?("spring") end -require 'bundler/setup' -load Gem.bin_path('flakey_spec_catcher', 'flakey_spec_catcher') +require "bundler/setup" +load Gem.bin_path("flakey_spec_catcher", "flakey_spec_catcher") diff --git a/bin/rails b/bin/rails index f60b2a48b6d..909c07ea285 100755 --- a/bin/rails +++ b/bin/rails @@ -2,15 +2,16 @@ # frozen_string_literal: true begin - load File.expand_path("../spring", __FILE__) + load File.expand_path("spring", __dir__) rescue LoadError + nil end # added by instructure: # resolve any symlinks in the file path, to avoid double-require issues -require 'pathname' +require "pathname" expanded_path = Pathname.new(__FILE__).realpath -APP_PATH = File.expand_path('../../config/application', expanded_path) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../../config/application", expanded_path) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index 688c3bbe0a5..6b7748b8480 100755 --- a/bin/rake +++ b/bin/rake @@ -2,8 +2,9 @@ # frozen_string_literal: true begin - load File.expand_path("../spring", __FILE__) + load File.expand_path("spring", __dir__) rescue LoadError + nil end -require 'bundler/setup' -load Gem.bin_path('rake', 'rake') +require "bundler/setup" +load Gem.bin_path("rake", "rake") diff --git a/bin/rdebug-ide b/bin/rdebug-ide index 51990dcc03d..32c6703245a 100755 --- a/bin/rdebug-ide +++ b/bin/rdebug-ide @@ -1,17 +1,19 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require "rubygems" require "bundler/setup" require "ruby-debug-ide" Debugger::QuitCommand.prepend( - Module.new { + Module.new do def execute # NOTE: We must ensure that all breakpoints are cleared before disconnecting sessions, # or you'll face a `closed stream` error. Debugger.breakpoints.clear @printer.print_msg("finished") end - } + end ) load Gem.bin_path("ruby-debug-ide", "rdebug-ide") diff --git a/bin/rspec b/bin/rspec index d70fb4b99f7..e0f6c2a032b 100755 --- a/bin/rspec +++ b/bin/rspec @@ -2,8 +2,9 @@ # frozen_string_literal: true begin - load File.expand_path("../spring", __FILE__) + load File.expand_path("spring", __dir__) rescue LoadError + nil end -require 'bundler/setup' -load Gem.bin_path('rspec-core', 'rspec') +require "bundler/setup" +load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/rubocop b/bin/rubocop index 770a80863f2..9c5a25d331b 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -14,10 +14,10 @@ Dir.chdir(File.expand_path("..", __dir__)) do # be tricksy and use a tiny subset of the gemfile so that # it will be very quick gemfile do - source 'https://rubygems.org/' + source "https://rubygems.org/" gemfile = File.expand_path("../Gemfile.d/rubocop.rb", __dir__) - eval(File.read(gemfile)) + eval(File.read(gemfile)) # rubocop:disable Security/Eval end end diff --git a/bin/spring b/bin/spring index 7240d0a38e7..200da8dd7a3 100755 --- a/bin/spring +++ b/bin/spring @@ -5,19 +5,19 @@ # It gets overwritten when you run the `spring binstub` command. unless defined?(Spring) - require 'rubygems' - require 'bundler' + require "rubygems" + require "bundler" - ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) lockfile_name = Dir.glob(Bundler.default_lockfile.dirname + "Gemfile.rails*.lock").first raise "no valid lockfile found" unless lockfile_name lockfile = Bundler::LockfileParser.new(Pathname.new(lockfile_name).read) - spring = lockfile.specs.detect { |spec| spec.name == 'spring' } + spring = lockfile.specs.detect { |spec| spec.name == "spring" } if spring Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem 'spring', spring.version - require 'spring/binstub' + gem "spring", spring.version + require "spring/binstub" end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 09cc157816c..1c751c55a0f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -21,7 +21,7 @@ class HostUrlContainer mattr_accessor :host_url def self.===(host) # rubocop:disable Style/CaseEquality - host_url.===(host) + host_url === (host) # rubocop:enable Style/CaseEquality end end diff --git a/config/initializers/active_record.rb b/config/initializers/active_record.rb index 0860472fe9b..d9264b61988 100644 --- a/config/initializers/active_record.rb +++ b/config/initializers/active_record.rb @@ -445,7 +445,7 @@ class ActiveRecord::Base end def self.rank_hash(ary) - ary.each_with_index.each_with_object(Hash.new(ary.size + 1)) do |(values, i), hash| + ary.each_with_index.with_object(Hash.new(ary.size + 1)) do |(values, i), hash| Array(values).each { |value| hash[value] = i + 1 } end end diff --git a/gems/activesupport-suspend_callbacks/activesupport-suspend_callbacks.gemspec b/gems/activesupport-suspend_callbacks/activesupport-suspend_callbacks.gemspec index 4fc2774440a..6ebbb56da56 100644 --- a/gems/activesupport-suspend_callbacks/activesupport-suspend_callbacks.gemspec +++ b/gems/activesupport-suspend_callbacks/activesupport-suspend_callbacks.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE.txt Rakefile README.md test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 3.2", "< 7.1" diff --git a/gems/acts_as_list/acts_as_list.gemspec b/gems/acts_as_list/acts_as_list.gemspec index 1743c8b6a0d..5eeaaf44cee 100644 --- a/gems/acts_as_list/acts_as_list.gemspec +++ b/gems/acts_as_list/acts_as_list.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "rails", ">= 3.2" diff --git a/gems/adheres_to_policy/adheres_to_policy.gemspec b/gems/adheres_to_policy/adheres_to_policy.gemspec index 0c741154fc0..cb519624e1a 100644 --- a/gems/adheres_to_policy/adheres_to_policy.gemspec +++ b/gems/adheres_to_policy/adheres_to_policy.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile README.md test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "rails", ">= 3.2" diff --git a/gems/attachment_fu/attachment_fu.gemspec b/gems/attachment_fu/attachment_fu.gemspec index bdc329fc065..291269cc6fc 100644 --- a/gems/attachment_fu/attachment_fu.gemspec +++ b/gems/attachment_fu/attachment_fu.gemspec @@ -12,7 +12,6 @@ Gem::Specification.new do |s| s.summary = "Instructure-maintained fork of attachment_fu" s.files = Dir["{app,config,db,lib}/**/*"] - s.test_files = Dir["spec_canvas/**/*"] s.add_dependency "rails", ">= 3.2" end diff --git a/gems/autoextend/autoextend.gemspec b/gems/autoextend/autoextend.gemspec index 0e84f9172c2..113652b677f 100644 --- a/gems/autoextend/autoextend.gemspec +++ b/gems/autoextend/autoextend.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib|spec}/**/*") spec.require_paths = ["lib"] - spec.test_files = spec.files.grep(%r{^spec/}) spec.required_ruby_version = ">= 2.0" diff --git a/gems/bookmarked_collection/bookmarked_collection.gemspec b/gems/bookmarked_collection/bookmarked_collection.gemspec index 1987f138934..9b882c11506 100644 --- a/gems/bookmarked_collection/bookmarked_collection.gemspec +++ b/gems/bookmarked_collection/bookmarked_collection.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") + %w[Rakefile] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "folio-pagination", "~> 0.0.12" diff --git a/gems/broadcast_policy/broadcast_policy.gemspec b/gems/broadcast_policy/broadcast_policy.gemspec index 1f346f3dcca..5333625bd57 100644 --- a/gems/broadcast_policy/broadcast_policy.gemspec +++ b/gems/broadcast_policy/broadcast_policy.gemspec @@ -12,7 +12,6 @@ Gem::Specification.new do |s| s.summary = "Notification management for ActiveRecord models in Canvas" s.files = Dir["{lib}/**/*"] - s.test_files = Dir["spec_canvas/**/*"] s.add_dependency "activesupport" s.add_dependency "after_transaction_commit" diff --git a/gems/bundler_lockfile_extensions/bundler_lockfile_extensions.gemspec b/gems/bundler_lockfile_extensions/bundler_lockfile_extensions.gemspec index 0e501be8898..2b0c9e5069d 100644 --- a/gems/bundler_lockfile_extensions/bundler_lockfile_extensions.gemspec +++ b/gems/bundler_lockfile_extensions/bundler_lockfile_extensions.gemspec @@ -7,7 +7,6 @@ Gem::Specification.new do |spec| spec.summary = "Support Multiple Lockfiles" spec.files = Dir.glob("{lib,spec}/**/*") + %w[plugins.rb] - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "rspec", "~> 3.9.0" diff --git a/gems/canvas_breach_mitigation/canvas_breach_mitigation.gemspec b/gems/canvas_breach_mitigation/canvas_breach_mitigation.gemspec index 749daecf3ba..2ad01e3c6d1 100644 --- a/gems/canvas_breach_mitigation/canvas_breach_mitigation.gemspec +++ b/gems/canvas_breach_mitigation/canvas_breach_mitigation.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE.txt README.md test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport" diff --git a/gems/canvas_cache/canvas_cache.gemspec b/gems/canvas_cache/canvas_cache.gemspec index 9ab649279a8..f9783923428 100644 --- a/gems/canvas_cache/canvas_cache.gemspec +++ b/gems/canvas_cache/canvas_cache.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "config_file" diff --git a/gems/canvas_cache/lib/canvas_cache/redis.rb b/gems/canvas_cache/lib/canvas_cache/redis.rb index 42e7770aa09..599f0257345 100644 --- a/gems/canvas_cache/lib/canvas_cache/redis.rb +++ b/gems/canvas_cache/lib/canvas_cache/redis.rb @@ -395,7 +395,7 @@ module CanvasCache ::Sentry.register_patch do patch = ::Sentry::Redis::Client - ::Redis::Client.prepend(patch) unless ::Redis::Client <= patch + ::Redis::Client.prepend(patch) unless ::Redis::Client <= patch # rubocop:disable Style/YodaCondition end ::Redis::Client.prepend(::CanvasCache::Redis::Client) diff --git a/gems/canvas_cache/spec/spec_helper.rb b/gems/canvas_cache/spec/spec_helper.rb index 785e44f322e..59c3d4244d6 100644 --- a/gems/canvas_cache/spec/spec_helper.rb +++ b/gems/canvas_cache/spec/spec_helper.rb @@ -77,6 +77,7 @@ RSpec.shared_context "caching_helpers", shared_context: :metadata do attr_reader :captured_message_stack def initialize + super(nil) @captured_message_stack = [] end diff --git a/gems/canvas_cassandra/canvas_cassandra.gemspec b/gems/canvas_cassandra/canvas_cassandra.gemspec index eb31d27449a..4937080f895 100644 --- a/gems/canvas_cassandra/canvas_cassandra.gemspec +++ b/gems/canvas_cassandra/canvas_cassandra.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "cassandra-cql", "~> 1.2.2" diff --git a/gems/canvas_color/canvas_color.gemspec b/gems/canvas_color/canvas_color.gemspec index 3bc5fd8aad3..4e5a2e15890 100644 --- a/gems/canvas_color/canvas_color.gemspec +++ b/gems/canvas_color/canvas_color.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,test}/**/*") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 2.2" diff --git a/gems/canvas_crummy/canvas_crummy.gemspec b/gems/canvas_crummy/canvas_crummy.gemspec index 53e7ead4d12..7cdc3410056 100644 --- a/gems/canvas_crummy/canvas_crummy.gemspec +++ b/gems/canvas_crummy/canvas_crummy.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") + %w[LICENSE.txt README.md Rakefile] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 2.2" diff --git a/gems/canvas_dynamodb/canvas_dynamodb.gemspec b/gems/canvas_dynamodb/canvas_dynamodb.gemspec index 773a2981a68..95d356cc5a1 100644 --- a/gems/canvas_dynamodb/canvas_dynamodb.gemspec +++ b/gems/canvas_dynamodb/canvas_dynamodb.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "aws-sdk-applicationautoscaling", "~> 1.26" diff --git a/gems/canvas_errors/canvas_errors.gemspec b/gems/canvas_errors/canvas_errors.gemspec index 90f26f7fa4d..9be6e76ea2f 100644 --- a/gems/canvas_errors/canvas_errors.gemspec +++ b/gems/canvas_errors/canvas_errors.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport" diff --git a/gems/canvas_ext/canvas_ext.gemspec b/gems/canvas_ext/canvas_ext.gemspec index 44064964b53..6d3a7f4dc54 100644 --- a/gems/canvas_ext/canvas_ext.gemspec +++ b/gems/canvas_ext/canvas_ext.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 3.2" diff --git a/gems/canvas_ext/lib/canvas_ext/marshal.rb b/gems/canvas_ext/lib/canvas_ext/marshal.rb index 0085bc255a2..38ef85c78ef 100644 --- a/gems/canvas_ext/lib/canvas_ext/marshal.rb +++ b/gems/canvas_ext/lib/canvas_ext/marshal.rb @@ -31,11 +31,7 @@ module CanvasExt raise e if viewed_class_names.include?(class_name) viewed_class_names << class_name - begin - retry if class_name.constantize - rescue - raise - end + retry if class_name.constantize else raise end diff --git a/gems/canvas_http/canvas_http.gemspec b/gems/canvas_http/canvas_http.gemspec index 87948efbb31..af95213096b 100644 --- a/gems/canvas_http/canvas_http.gemspec +++ b/gems/canvas_http/canvas_http.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "multipart" diff --git a/gems/canvas_kaltura/canvas_kaltura.gemspec b/gems/canvas_kaltura/canvas_kaltura.gemspec index 09593db4350..0ae8f326743 100644 --- a/gems/canvas_kaltura/canvas_kaltura.gemspec +++ b/gems/canvas_kaltura/canvas_kaltura.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "canvas_http" diff --git a/gems/canvas_mimetype_fu/canvas_mimetype_fu.gemspec b/gems/canvas_mimetype_fu/canvas_mimetype_fu.gemspec index c2500178e77..85791c3e8d7 100644 --- a/gems/canvas_mimetype_fu/canvas_mimetype_fu.gemspec +++ b/gems/canvas_mimetype_fu/canvas_mimetype_fu.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE.txt Rakefile README.md test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 2.2" diff --git a/gems/canvas_panda_pub/canvas_panda_pub.gemspec b/gems/canvas_panda_pub/canvas_panda_pub.gemspec index b85cb9a023c..c932dbf810c 100644 --- a/gems/canvas_panda_pub/canvas_panda_pub.gemspec +++ b/gems/canvas_panda_pub/canvas_panda_pub.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "canvas_http" diff --git a/gems/canvas_partman/canvas_partman.gemspec b/gems/canvas_partman/canvas_partman.gemspec index 2757e6e6c35..1b611d38268 100644 --- a/gems/canvas_partman/canvas_partman.gemspec +++ b/gems/canvas_partman/canvas_partman.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.email = ["ahmad@instructure.com"] spec.summary = "PostgreSQL partitioning manager and helper." spec.files = Dir.glob("{lib,spec}/**/*") + %w[Gemfile LICENSE.txt README.md] - spec.test_files = spec.files.grep(/spec/) spec.require_paths = ["lib"] spec.license = "AGPL" diff --git a/gems/canvas_quiz_statistics/canvas_quiz_statistics.gemspec b/gems/canvas_quiz_statistics/canvas_quiz_statistics.gemspec index fd6353e70b4..a9762145d21 100644 --- a/gems/canvas_quiz_statistics/canvas_quiz_statistics.gemspec +++ b/gems/canvas_quiz_statistics/canvas_quiz_statistics.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.email = ["ahmad@instructure.com"] spec.summary = "Bundle of statistics generators for quizzes and quiz questions." spec.files = Dir.glob("lib/**/*") + %w[LICENSE.txt README.md Rakefile] - spec.test_files = spec.files.grep(/spec/) spec.require_paths = ["lib"] spec.add_dependency "activesupport" diff --git a/gems/canvas_sanitize/canvas_sanitize.gemspec b/gems/canvas_sanitize/canvas_sanitize.gemspec index a1236790280..4923c558464 100644 --- a/gems/canvas_sanitize/canvas_sanitize.gemspec +++ b/gems/canvas_sanitize/canvas_sanitize.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") + %w[Rakefile README.md] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "sanitize", "~> 6.0" diff --git a/gems/canvas_security/Gemfile b/gems/canvas_security/Gemfile index e49b3c7c5a8..8589b71d502 100644 --- a/gems/canvas_security/Gemfile +++ b/gems/canvas_security/Gemfile @@ -4,9 +4,11 @@ source "https://rubygems.org" gemspec +# rubocop:disable Gemspec/DevelopmentDependencies path ".." do gem "canvas_cache" gem "canvas_errors" gem "config_file" gem "dynamic_settings" end +# rubocop:enable Gemspec/DevelopmentDependencies diff --git a/gems/canvas_security/canvas_security.gemspec b/gems/canvas_security/canvas_security.gemspec index a5d55ab8c52..8410742f468 100644 --- a/gems/canvas_security/canvas_security.gemspec +++ b/gems/canvas_security/canvas_security.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "canvas_cache" diff --git a/gems/canvas_slug/canvas_slug.gemspec b/gems/canvas_slug/canvas_slug.gemspec index fa1b8f73dea..1f2fce75d99 100644 --- a/gems/canvas_slug/canvas_slug.gemspec +++ b/gems/canvas_slug/canvas_slug.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,test}/**/*") + %w[Rakefile] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", ">= 1.5", "< 3" diff --git a/gems/canvas_sort/canvas_sort.gemspec b/gems/canvas_sort/canvas_sort.gemspec index 82325480d1f..3e186554ca6 100644 --- a/gems/canvas_sort/canvas_sort.gemspec +++ b/gems/canvas_sort/canvas_sort.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 2.2" diff --git a/gems/canvas_stringex/canvas_stringex.gemspec b/gems/canvas_stringex/canvas_stringex.gemspec index dd6013dba31..dcbba55358a 100644 --- a/gems/canvas_stringex/canvas_stringex.gemspec +++ b/gems/canvas_stringex/canvas_stringex.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,test}/**/*") + %w[LICENSE.txt Rakefile README.rdoc test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "rails", ">= 3.2" diff --git a/gems/canvas_text_helper/canvas_text_helper.gemspec b/gems/canvas_text_helper/canvas_text_helper.gemspec index 3c03b953f91..2dc0410e3a2 100644 --- a/gems/canvas_text_helper/canvas_text_helper.gemspec +++ b/gems/canvas_text_helper/canvas_text_helper.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "i18n" diff --git a/gems/canvas_time/canvas_time.gemspec b/gems/canvas_time/canvas_time.gemspec index fec59608396..d6721ad1a68 100644 --- a/gems/canvas_time/canvas_time.gemspec +++ b/gems/canvas_time/canvas_time.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "tzinfo" diff --git a/gems/canvas_unzip/canvas_unzip.gemspec b/gems/canvas_unzip/canvas_unzip.gemspec index 202c49a3f36..9d6b512705e 100644 --- a/gems/canvas_unzip/canvas_unzip.gemspec +++ b/gems/canvas_unzip/canvas_unzip.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,test}/**/*") + %w[Rakefile] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport" diff --git a/gems/config_file/config_file.gemspec b/gems/config_file/config_file.gemspec index 1ee063e3713..d8e3ef545b1 100644 --- a/gems/config_file/config_file.gemspec +++ b/gems/config_file/config_file.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "rails", ">= 5.0" diff --git a/gems/csv_diff/csv_diff.gemspec b/gems/csv_diff/csv_diff.gemspec index c0a65f55733..9da6bd6849f 100644 --- a/gems/csv_diff/csv_diff.gemspec +++ b/gems/csv_diff/csv_diff.gemspec @@ -10,7 +10,6 @@ Gem::Specification.new do |spec| spec.summary = "Generate CSV diffs" spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "sqlite3" diff --git a/gems/diigo/diigo.gemspec b/gems/diigo/diigo.gemspec index e08e72a1657..f6b1f61f341 100644 --- a/gems/diigo/diigo.gemspec +++ b/gems/diigo/diigo.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "nokogiri" diff --git a/gems/dr_diff/dr_diff.gemspec b/gems/dr_diff/dr_diff.gemspec index 008687fb0fe..b4dd05ff8ec 100644 --- a/gems/dr_diff/dr_diff.gemspec +++ b/gems/dr_diff/dr_diff.gemspec @@ -8,7 +8,6 @@ Gem::Specification.new do |spec| spec.summary = "Run linters only on the git diff." spec.files = Dir.glob("{lib,spec,bin}/**/*") - spec.test_files = spec.files.grep(%r{^spec/}) spec.require_paths = ["lib"] spec.add_dependency "gergich", "2.1.1" diff --git a/gems/dynamic_settings/dynamic_settings.gemspec b/gems/dynamic_settings/dynamic_settings.gemspec index fbb56a55f14..b2729a70b1a 100644 --- a/gems/dynamic_settings/dynamic_settings.gemspec +++ b/gems/dynamic_settings/dynamic_settings.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 5.0" diff --git a/gems/event_stream/event_stream.gemspec b/gems/event_stream/event_stream.gemspec index fc3b790c499..53b790e9344 100644 --- a/gems/event_stream/event_stream.gemspec +++ b/gems/event_stream/event_stream.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "bookmarked_collection" diff --git a/gems/event_stream/spec/event_stream/attr_config_spec.rb b/gems/event_stream/spec/event_stream/attr_config_spec.rb index c056d206406..9265b1e7c0d 100644 --- a/gems/event_stream/spec/event_stream/attr_config_spec.rb +++ b/gems/event_stream/spec/event_stream/attr_config_spec.rb @@ -40,7 +40,7 @@ describe EventStream::AttrConfig do value = double("value") obj = @class.new obj.field(value) - obj.field.== value + obj.field == value end it "errors on accessor with > 1 args" do @@ -55,7 +55,7 @@ describe EventStream::AttrConfig do value = double("value") @class.attr_config :field, default: value obj = @class.new - obj.field.== value + obj.field == value end it "casts values with type String" do @@ -64,7 +64,7 @@ describe EventStream::AttrConfig do value = double(to_s: string) obj = @class.new obj.field(value) - obj.field.== string + obj.field == string end it "casts values with type Integer" do @@ -73,7 +73,7 @@ describe EventStream::AttrConfig do value = double(to_i: integer) obj = @class.new obj.field(value) - obj.field.== integer + obj.field == integer end it "casts values with type Proc" do @@ -81,7 +81,7 @@ describe EventStream::AttrConfig do value = -> { "value" } obj = @class.new obj.field(value) - obj.field.== value + obj.field == value end it "errors when expecting a Proc" do @@ -113,7 +113,7 @@ describe EventStream::AttrConfig do value = double("value") obj = @class.new obj.field(value) - obj.field.== value + obj.field == value end it "casts defaults with type" do @@ -121,14 +121,14 @@ describe EventStream::AttrConfig do value = double(to_s: string) @class.attr_config :field, type: String, default: value obj = @class.new - obj.field.== string + obj.field == string end it "does not cast defaults with unknown type" do value = double("value") @class.attr_config :field, type: double("unknown"), default: value obj = @class.new - obj.field.== value + obj.field == value end it "requires setting non-defaulted fields before validation" do diff --git a/gems/google_drive/google_drive.gemspec b/gems/google_drive/google_drive.gemspec index 71d41d9b12c..39d642255fb 100644 --- a/gems/google_drive/google_drive.gemspec +++ b/gems/google_drive/google_drive.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "rails", ">= 3.2" diff --git a/gems/html_text_helper/html_text_helper.gemspec b/gems/html_text_helper/html_text_helper.gemspec index 556120de715..3ae5dec9a8e 100644 --- a/gems/html_text_helper/html_text_helper.gemspec +++ b/gems/html_text_helper/html_text_helper.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "canvas_text_helper" diff --git a/gems/i18n_extraction/i18n_extraction.gemspec b/gems/i18n_extraction/i18n_extraction.gemspec index 4b65bbfd697..46d1a7bf54c 100644 --- a/gems/i18n_extraction/i18n_extraction.gemspec +++ b/gems/i18n_extraction/i18n_extraction.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 3.2" diff --git a/gems/i18n_tasks/i18n_tasks.gemspec b/gems/i18n_tasks/i18n_tasks.gemspec index 185733cb5e6..14aa79dd152 100644 --- a/gems/i18n_tasks/i18n_tasks.gemspec +++ b/gems/i18n_tasks/i18n_tasks.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 6" diff --git a/gems/i18n_tasks/spec/i18n_tasks/extract_spec.rb b/gems/i18n_tasks/spec/i18n_tasks/extract_spec.rb index cc029f4ab6b..e0b22c62dfd 100644 --- a/gems/i18n_tasks/spec/i18n_tasks/extract_spec.rb +++ b/gems/i18n_tasks/spec/i18n_tasks/extract_spec.rb @@ -58,7 +58,7 @@ describe I18nTasks::Extract do it "removes Proc-like values" do expect( - subject(rb: { date: { nth: proc { |v| "1st" } } }) + subject(rb: { date: { nth: proc { "1st" } } }) ).to eq({ "date" => {} }) end diff --git a/gems/incoming_mail_processor/incoming_mail_processor.gemspec b/gems/incoming_mail_processor/incoming_mail_processor.gemspec index 7a638a5761f..0bc10627243 100644 --- a/gems/incoming_mail_processor/incoming_mail_processor.gemspec +++ b/gems/incoming_mail_processor/incoming_mail_processor.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 3.2" diff --git a/gems/json_token/json_token.gemspec b/gems/json_token/json_token.gemspec index 2073fc99dfb..6dfa70e695c 100644 --- a/gems/json_token/json_token.gemspec +++ b/gems/json_token/json_token.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") + %w[Rakefile] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "json" diff --git a/gems/linked_in/linked_in.gemspec b/gems/linked_in/linked_in.gemspec index 3ad8931fa74..1bd43c23132 100644 --- a/gems/linked_in/linked_in.gemspec +++ b/gems/linked_in/linked_in.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "nokogiri" diff --git a/gems/live_events/live_events.gemspec b/gems/live_events/live_events.gemspec index 56cc8d156b9..03abda648f4 100644 --- a/gems/live_events/live_events.gemspec +++ b/gems/live_events/live_events.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport" diff --git a/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb b/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb index c48dca252f7..8d951593861 100644 --- a/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb +++ b/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb @@ -71,9 +71,9 @@ module LtiAdvantage::Serializers "#{IMS_CLAIM_PREFIX}#{key}" elsif DEEP_LINKING_CLAIMS.include?(key) "#{DL_CLAIM_PREFIX}#{key}" - elsif NAMES_AND_ROLES_SERVICE_CLAIM == key + elsif key == NAMES_AND_ROLES_SERVICE_CLAIM NRPS_CLAIM_URL - elsif ASSIGNMENT_AND_GRADE_SERVICE_CLAIM == key + elsif key == ASSIGNMENT_AND_GRADE_SERVICE_CLAIM AGS_CLAIM_URL else key diff --git a/gems/lti_outbound/lib/lti_outbound/lti_model.rb b/gems/lti_outbound/lib/lti_outbound/lti_model.rb index c7135881ea5..2c73ed1b2e6 100644 --- a/gems/lti_outbound/lib/lti_outbound/lti_model.rb +++ b/gems/lti_outbound/lib/lti_outbound/lti_model.rb @@ -37,7 +37,7 @@ module LtiOutbound value = value.call instance_variable_set(variable_name, value) end - return value + value end end end diff --git a/gems/lti_outbound/lti_outbound.gemspec b/gems/lti_outbound/lti_outbound.gemspec index beba4b9511d..434fd225968 100644 --- a/gems/lti_outbound/lti_outbound.gemspec +++ b/gems/lti_outbound/lti_outbound.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE.txt Rakefile README.md test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport" diff --git a/gems/multipart/multipart.gemspec b/gems/multipart/multipart.gemspec index 82482f26b81..538113c313e 100644 --- a/gems/multipart/multipart.gemspec +++ b/gems/multipart/multipart.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "canvas_slug" diff --git a/gems/paginated_collection/paginated_collection.gemspec b/gems/paginated_collection/paginated_collection.gemspec index 524f22932b7..fe7b63950f2 100644 --- a/gems/paginated_collection/paginated_collection.gemspec +++ b/gems/paginated_collection/paginated_collection.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") + %w[Rakefile] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "folio-pagination", "~> 0.0.12" diff --git a/gems/plugins/academic_benchmark/academic_benchmark.gemspec b/gems/plugins/academic_benchmark/academic_benchmark.gemspec index ad5c661980c..dfc45d8049e 100644 --- a/gems/plugins/academic_benchmark/academic_benchmark.gemspec +++ b/gems/plugins/academic_benchmark/academic_benchmark.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.summary = "Academic Benchmark outcome importer" spec.files = Dir["{app,config,db,lib}/**/*"] - spec.test_files = Dir["spec_canvas/**/*"] spec.add_dependency "academic_benchmarks", "~> 1.1.0" spec.add_dependency "rails", ">= 3.2" diff --git a/gems/plugins/account_reports/account_reports.gemspec b/gems/plugins/account_reports/account_reports.gemspec index f56a28357c7..e2a6e92a476 100644 --- a/gems/plugins/account_reports/account_reports.gemspec +++ b/gems/plugins/account_reports/account_reports.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |spec| spec.summary = "Account Level Reports" spec.files = Dir["{app,config,db,lib}/**/*"] - spec.test_files = Dir["spec_canvas/**/*"] spec.add_dependency "rails", ">= 3.2" end diff --git a/gems/plugins/account_reports/lib/account_reports/report_helper.rb b/gems/plugins/account_reports/lib/account_reports/report_helper.rb index 54b0676d372..f1a912ca38d 100644 --- a/gems/plugins/account_reports/lib/account_reports/report_helper.rb +++ b/gems/plugins/account_reports/lib/account_reports/report_helper.rb @@ -384,7 +384,7 @@ module AccountReports::ReportHelper def number_of_items_per_runner(item_count, min: 25, max: 1000) # use 100 jobs for the report, but no fewer than 25, and no more than 1000 per job - [[item_count / 99.to_f.round(0), min].max, max].min + (item_count / 99.to_f).round(0).clamp(min, max) end def create_report_runners(ids, total, min: 25, max: 1000) diff --git a/gems/plugins/moodle_importer/moodle_importer.gemspec b/gems/plugins/moodle_importer/moodle_importer.gemspec index f2b897e0d08..a51573ac238 100644 --- a/gems/plugins/moodle_importer/moodle_importer.gemspec +++ b/gems/plugins/moodle_importer/moodle_importer.gemspec @@ -13,7 +13,6 @@ Gem::Specification.new do |s| s.description = "This enables importing Moodle 1.9 and 2.x .zip/.mbz files to Canvas." s.files = Dir["{lib}/**/*"] - s.test_files = Dir["spec_canvas/**/*"] s.add_dependency "moodle2cc", "0.2.41" s.add_dependency "rails", ">= 3.2" diff --git a/gems/plugins/qti_exporter/qti_exporter.gemspec b/gems/plugins/qti_exporter/qti_exporter.gemspec index c6166398234..8bd8541ee77 100644 --- a/gems/plugins/qti_exporter/qti_exporter.gemspec +++ b/gems/plugins/qti_exporter/qti_exporter.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |spec| spec.summary = "QTI Exporter" spec.files = Dir["{app,lib}/**/*"] - spec.test_files = Dir["spec_canvas/**/*"] spec.add_dependency "rails", ">= 3.2" end diff --git a/gems/plugins/respondus_soap_endpoint/respondus_soap_endpoint.gemspec b/gems/plugins/respondus_soap_endpoint/respondus_soap_endpoint.gemspec index 4ebff497be7..e0cf17333e6 100644 --- a/gems/plugins/respondus_soap_endpoint/respondus_soap_endpoint.gemspec +++ b/gems/plugins/respondus_soap_endpoint/respondus_soap_endpoint.gemspec @@ -12,7 +12,6 @@ Gem::Specification.new do |s| s.summary = "SOAP Endpoint for Respondus QTI uploads" s.files = Dir["{app,config,db,lib}/**/*"] - s.test_files = Dir["spec_canvas/**/*"] s.add_dependency "rails", ">= 3.2" s.add_dependency "soap4r-middleware", "0.8.7" diff --git a/gems/plugins/simply_versioned/simply_versioned.gemspec b/gems/plugins/simply_versioned/simply_versioned.gemspec index 4c5078da2cc..7112ce0eab9 100644 --- a/gems/plugins/simply_versioned/simply_versioned.gemspec +++ b/gems/plugins/simply_versioned/simply_versioned.gemspec @@ -12,7 +12,6 @@ Gem::Specification.new do |s| s.summary = "Instructure-maintained fork of simply_versioned" s.files = Dir["{app,config,db,lib}/**/*"] - s.test_files = Dir["spec_canvas/**/*"] s.add_dependency "rails", ">= 3.2" end diff --git a/gems/request_context/Gemfile b/gems/request_context/Gemfile index f0da061093f..4bd52ec8fec 100644 --- a/gems/request_context/Gemfile +++ b/gems/request_context/Gemfile @@ -4,9 +4,11 @@ source "https://rubygems.org" gemspec +# rubocop:disable Gemspec/DevelopmentDependencies path ".." do gem "canvas_cache" gem "canvas_security" gem "config_file" gem "dynamic_settings" end +# rubocop:enable Gemspec/DevelopmentDependencies diff --git a/gems/request_context/request_context.gemspec b/gems/request_context/request_context.gemspec index 03e6881f7b5..cd5df55e34b 100644 --- a/gems/request_context/request_context.gemspec +++ b/gems/request_context/request_context.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "actionpack" diff --git a/gems/rubocop-canvas/lib/rubocop_canvas/cops/specs/scope_includes.rb b/gems/rubocop-canvas/lib/rubocop_canvas/cops/specs/scope_includes.rb index f3081d54cc2..313ef0fe4d1 100644 --- a/gems/rubocop-canvas/lib/rubocop_canvas/cops/specs/scope_includes.rb +++ b/gems/rubocop-canvas/lib/rubocop_canvas/cops/specs/scope_includes.rb @@ -17,8 +17,6 @@ # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see . -# frozen_string_literal: true - module RuboCop module Cop module Specs diff --git a/gems/rubocop-canvas/lib/rubocop_canvas/cops/style/concat_array_literals.rb b/gems/rubocop-canvas/lib/rubocop_canvas/cops/style/concat_array_literals.rb index 2536afd9820..4776618e9ed 100644 --- a/gems/rubocop-canvas/lib/rubocop_canvas/cops/style/concat_array_literals.rb +++ b/gems/rubocop-canvas/lib/rubocop_canvas/cops/style/concat_array_literals.rb @@ -22,7 +22,7 @@ module RuboCop module Style module ConcatArrayLiteralsWithIgnoredReceivers def on_send(node) - return if node.receiver.type == :const && node.receiver.short_name == :BookmarkedCollection + return if node.receiver&.type == :const && node.receiver.short_name == :BookmarkedCollection super end diff --git a/gems/rubocop-canvas/rubocop-canvas.gemspec b/gems/rubocop-canvas/rubocop-canvas.gemspec index 7af85e284c5..cab4295c594 100644 --- a/gems/rubocop-canvas/rubocop-canvas.gemspec +++ b/gems/rubocop-canvas/rubocop-canvas.gemspec @@ -10,7 +10,6 @@ Gem::Specification.new do |spec| spec.summary = "custom cops for canvas" spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "activesupport", ">= 6.0" diff --git a/gems/stringify_ids/stringify_ids.gemspec b/gems/stringify_ids/stringify_ids.gemspec index 3a021b3e6a1..04e2e3263a7 100644 --- a/gems/stringify_ids/stringify_ids.gemspec +++ b/gems/stringify_ids/stringify_ids.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 2.2" diff --git a/gems/tatl_tael/spec/lib/tatl_tael/linters/copyright_linter_spec.rb b/gems/tatl_tael/spec/lib/tatl_tael/linters/copyright_linter_spec.rb index 7f9c3b8b1b7..673b86baec5 100644 --- a/gems/tatl_tael/spec/lib/tatl_tael/linters/copyright_linter_spec.rb +++ b/gems/tatl_tael/spec/lib/tatl_tael/linters/copyright_linter_spec.rb @@ -21,7 +21,6 @@ require_relative "./shared_constants" require_relative "./shared_linter_examples" # pp required for to make fakefs happy, see: # github.com/fakefs/fakefs#fakefs-----typeerror-superclass-mismatch-for-class-file -require "pp" require "fakefs/safe" require "timecop" diff --git a/gems/tatl_tael/tatl_tael.gemspec b/gems/tatl_tael/tatl_tael.gemspec index 541064c42d7..57b4253ea94 100644 --- a/gems/tatl_tael/tatl_tael.gemspec +++ b/gems/tatl_tael/tatl_tael.gemspec @@ -8,7 +8,6 @@ Gem::Specification.new do |spec| spec.summary = "Commit level linting." spec.files = Dir.glob("{lib,spec,bin}/**/*") - spec.test_files = spec.files.grep(%r{^spec/}) spec.require_paths = ["lib"] spec.add_development_dependency "fakefs", "~> 1.2" diff --git a/gems/twitter/twitter.gemspec b/gems/twitter/twitter.gemspec index 2f9d65637f3..bb75e3ae188 100644 --- a/gems/twitter/twitter.gemspec +++ b/gems/twitter/twitter.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "html_text_helper" diff --git a/gems/utf8_cleaner/utf8_cleaner.gemspec b/gems/utf8_cleaner/utf8_cleaner.gemspec index 67740acbce8..876bc2b8e76 100644 --- a/gems/utf8_cleaner/utf8_cleaner.gemspec +++ b/gems/utf8_cleaner/utf8_cleaner.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 2.2" diff --git a/gems/workflow/workflow.gemspec b/gems/workflow/workflow.gemspec index c4cf6442826..a3a7a4f0232 100644 --- a/gems/workflow/workflow.gemspec +++ b/gems/workflow/workflow.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.files = Dir.glob("{lib}/**/*") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "rails", ">= 3.2" diff --git a/lib/api.rb b/lib/api.rb index b780351a63e..3317f73fb79 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -383,7 +383,7 @@ module Api action = "#{controller.params[:controller]}##{controller.params[:action]}" per_page_requested = controller.params[:per_page] || options[:default] || per_page(action) max = options[:max] || max_per_page(action) - [[per_page_requested.to_i, 1].max, max.to_i].min + per_page_requested.to_i.clamp(1, max.to_i) end # Add [link HTTP Headers](http://www.w3.org/Protocols/9707-link-header.html) for pagination diff --git a/lib/api/v1/enrollment_term.rb b/lib/api/v1/enrollment_term.rb index f9847d8f7d0..2b24a4b4eb1 100644 --- a/lib/api/v1/enrollment_term.rb +++ b/lib/api/v1/enrollment_term.rb @@ -43,7 +43,9 @@ module Api::V1::EnrollmentTerm enrollment_terms.map { |t| enrollment_term_json(t, user, session, enrollments, includes, course_counts) } end - protected def date_overrides_json(term) + protected + + def date_overrides_json(term) term.enrollment_dates_overrides.select { |o| o.start_at || o.end_at }.each_with_object({}) do |override, json| json[override.enrollment_type] = override.attributes.slice("start_at", "end_at") end diff --git a/lib/canvas/migration/external_content/migrator.rb b/lib/canvas/migration/external_content/migrator.rb index 9a4ceb455da..22de8cd70fb 100644 --- a/lib/canvas/migration/external_content/migrator.rb +++ b/lib/canvas/migration/external_content/migrator.rb @@ -134,14 +134,6 @@ module Canvas::Migration::ExternalContent ensure_imports_completed(pending_imports) end - private def import_service_for(key) - if Lti::ContentMigrationService::KEY_REGEX.match?(key) - Lti::ContentMigrationService.importer_for(key) - else - registered_services[key] - end - end - def ensure_imports_completed(pending_imports) # keep pinging until they're all finished retry_block_for_each(pending_imports.keys) do |key| @@ -153,6 +145,16 @@ module Canvas::Migration::ExternalContent end end end + + private + + def import_service_for(key) + if Lti::ContentMigrationService::KEY_REGEX.match?(key) + Lti::ContentMigrationService.importer_for(key) + else + registered_services[key] + end + end end end end diff --git a/lib/i18n/backend/csv.rb b/lib/i18n/backend/csv.rb index 12beabeb366..f1af7436040 100644 --- a/lib/i18n/backend/csv.rb +++ b/lib/i18n/backend/csv.rb @@ -24,9 +24,9 @@ module I18n data = ::CSV.read(filename, headers: true) csv_locales = data.headers - ["key"] basename = File.basename(filename, ".*") - locale_data = csv_locales.to_h do |locale| - [locale, { basename => - data.to_h { |row| [row["key"].to_sym, row[locale]] } }] + locale_data = csv_locales.index_with do |locale| + { basename => + data.to_h { |row| [row["key"].to_sym, row[locale]] } } end [locale_data, false] end diff --git a/lib/microsoft_sync/syncer_steps.rb b/lib/microsoft_sync/syncer_steps.rb index 838abc548a8..4fd9850b766 100644 --- a/lib/microsoft_sync/syncer_steps.rb +++ b/lib/microsoft_sync/syncer_steps.rb @@ -56,7 +56,7 @@ module MicrosoftSync STATSD_NAME = "microsoft_sync.syncer_steps" STATSD_NAME_SKIPPED_BATCHES = "#{STATSD_NAME}.skipped_batches" STATSD_NAME_SKIPPED_TOTAL = "#{STATSD_NAME}.skipped_total" - STATSD_NAME_DELETED_MAPPINGS_FOR_MISSING_USERS = \ + STATSD_NAME_DELETED_MAPPINGS_FOR_MISSING_USERS = "#{STATSD_NAME}.deleted_mappings_for_missing_users" # Can happen when User disables sync on account-level when jobs are running: diff --git a/lib/user_merge.rb b/lib/user_merge.rb index e4d9e618b88..e734c61727c 100644 --- a/lib/user_merge.rb +++ b/lib/user_merge.rb @@ -458,9 +458,9 @@ class UserMerge target_cc.destroy_permanently! if from_user.shard != target_user.shard User.clone_communication_channel(source_cc, target_user, max_position) + # elsif (to_retire = source_cc) # rubocop:disable Layout/CommentIndentation + # retired, retired end - elsif (to_retire = source_cc) - # retired, retired end to_retire end diff --git a/script/rlint b/script/rlint index 2f5174aefe7..94c257984fe 100755 --- a/script/rlint +++ b/script/rlint @@ -54,7 +54,6 @@ OptionParser.new do |opts| linter_options[:comment_post_processing] = proc do |comments| grouped_comments = comments.group_by { |comment| comment[:rule] } - require "pp" pp grouped_comments.transform_values(&:length).to_a.sort_by(&:last).reverse.to_h exit 0 end diff --git a/script/tail_kinesis b/script/tail_kinesis index b7e04ef7154..1eb80c1e1f9 100755 --- a/script/tail_kinesis +++ b/script/tail_kinesis @@ -5,7 +5,6 @@ require File.expand_path("../config/boot", __dir__) require "aws-sdk-kinesis" require "json" -require "pp" ENDPOINT = ARGV[0] STREAM_NAME = ARGV[1] diff --git a/spec/graphql/loaders/course_outcome_alignment_stats_loader_spec.rb b/spec/graphql/loaders/course_outcome_alignment_stats_loader_spec.rb index b971a802ba3..8ba251eb45c 100644 --- a/spec/graphql/loaders/course_outcome_alignment_stats_loader_spec.rb +++ b/spec/graphql/loaders/course_outcome_alignment_stats_loader_spec.rb @@ -20,14 +20,14 @@ describe Loaders::CourseOutcomeAlignmentStatsLoader do def mock_os_aligned_outcomes(outcomes, associated_asset_id) - (outcomes || []).map do |o| + (outcomes || []).to_h do |o| [o.id.to_s, [{ artifact_type: "quizzes.quiz", artifact_id: "1", associated_asset_type: "canvas.assignment.quizzes", associated_asset_id: associated_asset_id.to_s }]] - end.to_h + end end context "with only direct alignments" do diff --git a/spec/initializers/active_record_query_trace_spec.rb b/spec/initializers/active_record_query_trace_spec.rb index 5f90e80561a..70f795044d9 100644 --- a/spec/initializers/active_record_query_trace_spec.rb +++ b/spec/initializers/active_record_query_trace_spec.rb @@ -47,7 +47,7 @@ describe "#configure!" do context "when Rails ENV is production" do before do allow(ENV).to receive(:[]).with("AR_QUERY_TRACE").and_return("true") - allow(Rails).to receive(:env) { "production".inquiry } + allow(Rails).to receive(:env) { "production".inquiry } # rubocop:disable Rails/Inquiry end it "does not enable AR query trace" do @@ -57,7 +57,7 @@ describe "#configure!" do context "when Rails ENV is development" do before do - allow(Rails).to receive(:env) { "development".inquiry } + allow(Rails).to receive(:env) { "development".inquiry } # rubocop:disable Rails/Inquiry end context "and AR_QUERY_TRACE is falsy" do diff --git a/spec/lib/api_spec.rb b/spec/lib/api_spec.rb index 07978bfe97b..5381b59ba44 100644 --- a/spec/lib/api_spec.rb +++ b/spec/lib/api_spec.rb @@ -574,8 +574,8 @@ describe Api do end it "handles user uuid" do - expect(Api.sis_parse_id("uuid:tExtjERcuxGKFLO6XxwIBCeXZvZXLdXzs8LV0gK0")).to \ - eq ["uuid", "tExtjERcuxGKFLO6XxwIBCeXZvZXLdXzs8LV0gK0"] + expect(Api.sis_parse_id("uuid:tExtjERcuxGKFLO6XxwIBCeXZvZXLdXzs8LV0gK0")) + .to eq ["uuid", "tExtjERcuxGKFLO6XxwIBCeXZvZXLdXzs8LV0gK0"] expect(Api.sis_parse_ids(["uuid:tExtjERcuxGKFLO6XxwIBCeXZvZXLdXzs8LV0gK0"], @lookups)).to \ eq({ "users.uuid" => { ids: ["tExtjERcuxGKFLO6XxwIBCeXZvZXLdXzs8LV0gK0"] } }) end diff --git a/spec/models/access_token_spec.rb b/spec/models/access_token_spec.rb index 3cbc89b4053..3e1e6f54771 100644 --- a/spec/models/access_token_spec.rb +++ b/spec/models/access_token_spec.rb @@ -586,9 +586,9 @@ describe AccessToken do describe "valid?" do it "validates character length maximum (255) for purpose column" do - lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ + lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud + exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit." at = AccessToken.new user: user_model, developer_key: DeveloperKey.default expect(at.save).to be true diff --git a/spec/models/context_external_tool_spec.rb b/spec/models/context_external_tool_spec.rb index 387b017c721..895dfab3f9f 100644 --- a/spec/models/context_external_tool_spec.rb +++ b/spec/models/context_external_tool_spec.rb @@ -185,7 +185,7 @@ describe ContextExternalTool do it { is_expected.to match_array [no_permission_required_tool, permission_required_tool] } end - context "when the current user does not have the required permission" do \ + context "when the current user does not have the required permission" do it { is_expected.to match_array [no_permission_required_tool] } end end diff --git a/spec/models/root_account_resolver_spec.rb b/spec/models/root_account_resolver_spec.rb index cbe938a9b2c..9f3150f1abd 100644 --- a/spec/models/root_account_resolver_spec.rb +++ b/spec/models/root_account_resolver_spec.rb @@ -47,6 +47,7 @@ describe RootAccountResolver do extend RootAccountResolver def initialize(root_account_id) + super() @root_account_id = root_account_id end diff --git a/spec/models/user_service_spec.rb b/spec/models/user_service_spec.rb index d7b7a53d342..800dadc983b 100644 --- a/spec/models/user_service_spec.rb +++ b/spec/models/user_service_spec.rb @@ -148,9 +148,9 @@ describe UserService do describe "valid?" do it "validates character length maximum (255) for user input fields" do - lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ + lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud + exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit." params = {} params[:service] = "diigo"