RuboCop: Lint/MissingSuper

all manual

Change-Id: Ibc71a5265c81359925c7819ea694f3cb7cc3e542
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277540
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-11-05 10:07:58 -06:00
parent 78ab4aa3ab
commit 7e7bc924b7
55 changed files with 57 additions and 17 deletions

View File

@ -59,6 +59,8 @@ Lint/DuplicateMethods:
Severity: error
Lint/EmptyBlock:
Severity: error
Lint/MissingSuper:
Severity: error
Lint/NonDeterministicRequireOrder:
Severity: error
Lint/ParenthesesAsGroupedExpression:

View File

@ -19,6 +19,7 @@
class UnreadCommentCountLoader < GraphQL::Batch::Loader
def initialize(current_user)
super()
@current_user = current_user
end

View File

@ -20,6 +20,7 @@
class Loaders::ApiContentAttachmentLoader < GraphQL::Batch::Loader
def initialize(context)
super()
@context = context
end

View File

@ -20,6 +20,7 @@
class Loaders::AssessmentRequestLoader < GraphQL::Batch::Loader
def initialize(current_user:)
super()
@current_user = current_user
end

View File

@ -20,6 +20,7 @@
class Loaders::AssociationCountLoader < GraphQL::Batch::Loader
def initialize(model, association)
super()
@model = model
@association = association
end

View File

@ -20,6 +20,7 @@
class Loaders::CourseRoleLoader < GraphQL::Batch::Loader
def initialize(course_id:, role_types: nil, built_in_only: false)
super()
@course_id = course_id
@role_types = role_types
@built_in_only = built_in_only

View File

@ -22,6 +22,7 @@
# Canvas analytics plugin
class Loaders::CourseStudentAnalyticsLoader < GraphQL::Batch::Loader
def initialize(course_id, current_user:, session:)
super()
@course_id = course_id
@current_user = current_user
@session = session

View File

@ -22,6 +22,7 @@
# or root_discussion_entries,
class Loaders::DiscussionEntryCountsLoader < GraphQL::Batch::Loader
def initialize(current_user:)
super()
@current_user = current_user
end

View File

@ -20,6 +20,7 @@
class Loaders::DiscussionEntryLoader < GraphQL::Batch::Loader
def initialize(current_user:, search_term: nil, sort_order: :desc, filter: nil, root_entries: false, relative_entry_id: nil, before_relative_entry: true, include_relative_entry: true)
super()
@current_user = current_user
@search_term = search_term
@sort_order = sort_order

View File

@ -20,6 +20,7 @@
class Loaders::EntryParticipantLoader < GraphQL::Batch::Loader
def initialize(current_user:)
super()
@current_user = current_user
end

View File

@ -34,6 +34,7 @@ class Loaders::ForeignKeyLoader < GraphQL::Batch::Loader
#
# +fk+ is the column you want to load by
def initialize(scope, fk)
super()
@scope = scope
@column = fk
end

View File

@ -34,6 +34,7 @@
class Loaders::IDLoader < GraphQL::Batch::Loader
# +scope+ is any ActiveRecord scope
def initialize(scope)
super()
@scope = scope
end

View File

@ -20,6 +20,7 @@
class Loaders::MentionableUserLoader < GraphQL::Batch::Loader
def initialize(current_user:, search_term: nil)
super()
@curent_user = current_user
@search_term = search_term
end

View File

@ -24,6 +24,7 @@ class Loaders::OutcomeFriendlyDescriptionLoader < GraphQL::Batch::Loader
VALID_CONTEXT_TYPES = ['Course', 'Account'].freeze
def initialize(context_id, context_type)
super()
@context_id = context_id
@context_type = context_type
end

View File

@ -22,6 +22,7 @@
# CoursePermissionType)
class Loaders::PermissionsLoader < GraphQL::Batch::Loader
def initialize(record, current_user:, session:)
super()
@record = record
@current_user = current_user
@session = session

View File

@ -31,6 +31,7 @@
class Loaders::SISIDLoader < GraphQL::Batch::Loader
# +scope+ is any ActiveRecord scope
def initialize(scope)
super()
@scope = scope
end

View File

@ -136,6 +136,7 @@ module Types
class OverrideAssignmentLoader < GraphQL::Batch::Loader
def initialize(current_user)
super()
@current_user = current_user
end

View File

@ -31,6 +31,7 @@ module Types
class ImportedLoader < GraphQL::Batch::Loader
def initialize(target_context_id, target_context_type)
super()
@target_context_id = target_context_id
@target_context_type = target_context_type.downcase.capitalize
end

View File

@ -21,6 +21,7 @@
class ModuleProgressionVisibleLoader < GraphQL::Batch::Loader
def initialize(user)
super()
@user = user
end

View File

@ -20,6 +20,7 @@
class ModuleItemsVisibleLoader < GraphQL::Batch::Loader
def initialize(user)
super()
@user = user
end

View File

@ -19,6 +19,7 @@
#
class SubmissionCommentReadLoader < GraphQL::Batch::Loader
def initialize(current_user)
super()
@current_user = current_user
end

View File

@ -72,6 +72,7 @@ module Importers
end
def initialize(hash, context, migration, item)
super()
self.options = DiscussionTopicOptions.new(hash)
self.context = context
self.migration = migration

View File

@ -31,6 +31,7 @@ module Lti
# which is called as a delayed job during a course copy or export.
class Exporter < Lti::ContentMigrationService::Migrator
def initialize(course, tool, options)
super()
@course = course
@tool = tool
@options = options

View File

@ -32,6 +32,7 @@ module Lti
attr_reader :original_tool_id
def initialize(original_tool_id)
super()
@original_tool_id = original_tool_id
end

View File

@ -407,8 +407,7 @@ class PageView < ActiveRecord::Base
# if you interrupt and re-start the migrator, start_at cannot be changed,
# since it's saved in cassandra to persist the migration state
def initialize(skip_deleted_accounts = true, start_at = nil)
self.start_at = start_at || 52.weeks.ago
self.logger = Rails.logger
super(start_at || 52.weeks.ago, Rails.logger)
if skip_deleted_accounts
account_ids = Set.new(Account.root_accounts.active.pluck(:id))

View File

@ -34,6 +34,8 @@ class Quizzes::QuizQuestion::Base
type_name = klass.question_type
raise("question type #{type_name} already exists") if question_types.key?(type_name)
super
# because this is where subclass registration happens, we need this to be populated
# before we start trying to load any question data.
# This is taken care of by the Quizzes::Preloader

View File

@ -19,11 +19,6 @@
#
class Submission::AnonymousUploadPresenter < Submission::UploadPresenter
def initialize(course, assignment)
@course = course
@assignment = assignment
end
def file_download_href(comment, file)
context_url(
@course,

View File

@ -31,6 +31,7 @@ class ArgumentView < HashView
DEFAULT_DESC = "no description"
def initialize(line, http_verb = "get", path_variables = [], deprecated: false)
super()
@deprecated = deprecated
@deprecated_date_key = :NOTICE
@effective_date_key = :EFFECTIVE

View File

@ -23,6 +23,7 @@ require 'controller_view'
class ControllerListView < HashView
def initialize(name, controllers)
super()
@controllers = controllers.map do |ctrl|
ControllerView.new(ctrl)
end

View File

@ -26,6 +26,7 @@ class ControllerView < HashView
attr_reader :controller
def initialize(controller)
super()
@controller = controller
end

View File

@ -27,6 +27,7 @@ class DeprecatedMethodView < HashView
attr_reader :description, :effective_date, :notice_date
def initialize(tag)
super()
@deprecated_date_key = :NOTICE
@effective_date_key = :EFFECTIVE
@tag_declaration_line = tag.text

View File

@ -27,6 +27,7 @@ require 'deprecated_method_view'
class MethodView < HashView
def initialize(method)
super()
@method = method
end

View File

@ -25,6 +25,7 @@ class ModelView < HashView
attr_reader :name, :properties, :description, :required
def initialize(name, properties, description = "", required = [], deprecated: false, deprecation_description: '')
super()
@name = name
@properties = properties
@description = description

View File

@ -27,6 +27,7 @@ class ObjectPartView < HashView
# 'part' is a hash of name/example pairs, e.g.
# { "name": "Sheldon Cooper", "email": "sheldon@caltech.example.com" }
def initialize(name, part)
super()
@name = name
@part = part
end

View File

@ -32,6 +32,7 @@ class ObjectView < HashView
# returns the full JSON text of the @object being described by the API docs.
# It's possible that 'object' has multiple JSON parts.
def initialize(object)
super()
@object = object
end

View File

@ -27,6 +27,7 @@ class ResponseFieldView < HashView
attr_reader :types, :effective_date, :notice_date
def initialize(tag)
super()
line = tag.text
@deprecated = tag.tag_name == 'deprecated_response_field'
@deprecated_date_key = :NOTICE

View File

@ -41,6 +41,7 @@ end
class ReturnView < ReturnViewNull
def initialize(line)
super()
if line
@line = line.gsub(/\s+/m, " ").strip
else

View File

@ -24,6 +24,7 @@ class RouteView < HashView
attr_reader :raw_route, :method_view
def initialize(raw_route, method_view)
super()
@raw_route = raw_route
@method_view = method_view
end

View File

@ -24,6 +24,7 @@ class BookmarkedCollection::Collection < Array
FIRST_TOKEN = "first"
def initialize(bookmarker)
super()
@bookmarker = bookmarker
end

View File

@ -69,11 +69,7 @@ module CanvasCassandra
# private Struct used to store batch information
class Batch < Struct.new(:statements, :args, :counter_statements, :counter_args, :execute_options)
def initialize
self.statements = []
self.args = []
self.counter_statements = []
self.counter_args = []
self.execute_options = {}
super([], [], [], [], {})
end
def to_cql_ary(field = nil)

View File

@ -38,6 +38,8 @@ module CanvasQuizStatistics::Analyzers
class Base
def self.inherited(klass)
super
namespace = CanvasQuizStatistics::Analyzers
namespace.available_analyzers ||= {}
namespace.available_analyzers[klass.question_type] = klass

View File

@ -25,6 +25,7 @@ module CanvasSecurity
ALG = 'RS256'.freeze
SIZE = 2048
def initialize(use: 'sig')
super()
@alg = ALG
@use = use
@private_key = OpenSSL::PKey::RSA.new SIZE

View File

@ -7,6 +7,7 @@ module TatlTael
class BaseLinter
class << self
def inherited(subclass)
super
Linters.linters << subclass unless subclass.name =~ /SimpleLinter/
end
end

View File

@ -27,6 +27,7 @@ module AddressBook
# cache.
class Base
def self.inherited(derived)
super
return unless derived.superclass == AddressBook::Base
derived.prepend(AddressBook::Caching)

View File

@ -291,6 +291,7 @@ module Canvas
attr_accessor :error_count
def initialize(error_count)
super()
@error_count = error_count
end
end

View File

@ -22,8 +22,7 @@ module Canvas::OAuth
class ClientCredentialsProvider < Provider
def initialize(client_id, host, scopes = nil, protocol = 'http://')
@client_id = client_id
@scopes = scopes || []
super(client_id, nil, scopes || [])
@expected_aud = Rails.application.routes.url_helpers.oauth2_token_url(
host: host,
protocol: protocol

View File

@ -22,7 +22,7 @@ require_relative "../client_credentials_provider"
module Canvas::OAuth
module GrantTypes
class ClientCredentials < BaseType
def initialize(opts, host, protocol = nil)
def initialize(opts, host, protocol = nil) # rubocop:disable Lint/MissingSuper
if opts[:client_assertion_type] == 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
raw_jwt = opts.fetch(:client_assertion)
@provider = Canvas::OAuth::AsymmetricClientCredentialsProvider.new(raw_jwt, host, scopes_from_opts(opts), protocol)

View File

@ -69,6 +69,7 @@ module Canvas::OAuth
}.freeze
def initialize(message)
super()
@message = message
end

View File

@ -19,7 +19,7 @@
module CC::Exporter::WebZip
class ZipPackage < CC::Exporter::Epub::FilesDirectory
def initialize(exporter, course, user, progress_key)
def initialize(exporter, course, user, progress_key) # rubocop:disable Lint/MissingSuper
@global_identifiers = exporter.global_identifiers
@files = exporter.unsupported_files + exporter.cartridge_json[:files]
@pages = exporter.cartridge_json[:pages]

View File

@ -75,6 +75,7 @@ module MicrosoftSync
attr_reader :wrapped_exception
def initialize(wrapped_exception)
super()
@wrapped_exception = wrapped_exception
end
end

View File

@ -62,6 +62,7 @@ module MicrosoftSync
attr_reader :cause
def initialize(cause)
super()
@cause = cause
end
end

View File

@ -47,6 +47,7 @@ module ErrorContext
end
def self.inherited(klass)
super
::RSpec::Core::Formatters.register klass,
:example_started,
:example_failed,

View File

@ -86,6 +86,7 @@ module MicrosoftSync
class StateMachineJobTestSteps2 < StateMachineJobTestStepsBase
def initialize(step_initial_retries, step_second_delay_amounts = [1, 2, 3])
super()
@step_initial_retries = step_initial_retries
@step_second_delay_amounts = step_second_delay_amounts
end

View File

@ -233,6 +233,7 @@ module SeleniumExtensions
class ReloadableCollection < ::Array
def initialize(collection, finder_proc)
super()
@finder_proc = finder_proc
replace collection
end

View File

@ -21,7 +21,7 @@ module SpecTimeLimit
class Error < ::Timeout::Error
# #initialize and #to_s are overwritten here to prevent Timeout.timeout
# overwriting the error message to "execution expired"
def initialize(message)
def initialize(message) # rubocop:disable Lint/MissingSuper
@message = message
end