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 <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2023-04-04 15:26:44 -07:00
parent 2082e77a77
commit 1d3d9ed499
113 changed files with 122 additions and 176 deletions

2
.irbrc
View File

@ -1 +1,3 @@
# frozen_string_literal: true
IRB.conf[:USE_AUTOCOMPLETE] = false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ module LtiOutbound
value = value.call
instance_variable_set(variable_name, value)
end
return value
value
end
end
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,8 +17,6 @@
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# frozen_string_literal: true
module RuboCop
module Cop
module Specs

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More