RuboCop: Style/RedundantFreeze

[skip-stages=Flakey]

auto-corrected

Change-Id: Id1b8bafdd744219a4797e6e1ba5891cd7ce4bccd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277888
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-10 12:05:31 -07:00
parent b2d5e59698
commit cf213ee24b
101 changed files with 268 additions and 267 deletions

View File

@ -140,6 +140,8 @@ Style/PerlBackrefs:
Enabled: false # Regexp.last_match(1) is far worse than $1
Style/RedundantInterpolation:
Severity: error
Style/RedundantFreeze:
Severity: error
Style/RedundantParentheses:
Severity: error
Style/SpecialGlobalVars:

View File

@ -32,7 +32,7 @@ module Lti
before_action :verify_target_developer_key, only: [:create, :update]
MIME_TYPE = 'application/vnd.canvas.contextexternaltools+json'.freeze
MIME_TYPE = 'application/vnd.canvas.contextexternaltools+json'
ACTION_SCOPE_MATCHERS = {
create: all_of(TokenScopes::LTI_CREATE_ACCOUNT_EXTERNAL_TOOLS_SCOPE),

View File

@ -67,7 +67,7 @@ module Lti
include ::Lti::IMS::Concerns::AdvantageServices
include Api::V1::Account
MIME_TYPE = 'application/vnd.canvas.accountlookup+json'.freeze
MIME_TYPE = 'application/vnd.canvas.accountlookup+json'
# @API Get account
# Retrieve information on an individual account, given by local or global ID.

View File

@ -78,7 +78,7 @@ module Lti
#
class DataServicesController < ApplicationController
include ::Lti::IMS::Concerns::AdvantageServices
MIME_TYPE = 'application/vnd.canvas.dataservices+json'.freeze
MIME_TYPE = 'application/vnd.canvas.dataservices+json'
ACTION_SCOPE_MATCHERS = {
create: all_of(TokenScopes::LTI_CREATE_DATA_SERVICE_SUBSCRIPTION_SCOPE),

View File

@ -43,7 +43,7 @@ module Lti
#
class FeatureFlagsController < ApplicationController
include ::Lti::IMS::Concerns::AdvantageServices
MIME_TYPE = 'application/vnd.canvas.featureflags+json'.freeze
MIME_TYPE = 'application/vnd.canvas.featureflags+json'
ACTION_SCOPE_MATCHERS = {
show: all_of(TokenScopes::LTI_SHOW_FEATURE_FLAG_SCOPE),

View File

@ -38,7 +38,7 @@ module Lti
scope
].freeze
OPTIONAL_PARAMS = ['state'].freeze
SCOPE = 'openid'.freeze
SCOPE = 'openid'
skip_before_action :load_user, only: :authorize_redirect
skip_before_action :verify_authenticity_token, only: :authorize_redirect

View File

@ -73,8 +73,8 @@ module Lti
].freeze
class InvalidGrant < RuntimeError; end
JWT_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:jwt-bearer'.freeze
AUTHORIZATION_CODE_GRANT_TYPE = 'authorization_code'.freeze
JWT_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:jwt-bearer'
AUTHORIZATION_CODE_GRANT_TYPE = 'authorization_code'
GRANT_TYPES = [JWT_GRANT_TYPE, AUTHORIZATION_CODE_GRANT_TYPE].freeze
rescue_from JSON::JWS::VerificationFailed,

View File

@ -21,7 +21,7 @@ module Lti::IMS::Concerns
module DeepLinkingServices
extend ActiveSupport::Concern
CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti-dl/claim/'.freeze
CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti-dl/claim/'
def validate_jwt
render_error(deep_linking_jwt.errors) and return unless deep_linking_jwt.valid?

View File

@ -22,7 +22,7 @@ module Lti::IMS::Concerns
extend ActiveSupport::Concern
UNIVERSAL_GRANT_HOST = Canvas::Security.config['lti_grant_host'] ||
'canvas.instructure.com'.freeze
'canvas.instructure.com'
class AccessToken
def initialize(raw_jwt_str)

View File

@ -80,8 +80,8 @@ module Lti
index: any_of(TokenScopes::LTI_AGS_LINE_ITEM_SCOPE, TokenScopes::LTI_AGS_LINE_ITEM_READ_ONLY_SCOPE)
}.with_indifferent_access.freeze
MIME_TYPE = 'application/vnd.ims.lis.v2.lineitem+json'.freeze
CONTAINER_MIME_TYPE = 'application/vnd.ims.lis.v2.lineitemcontainer+json'.freeze
MIME_TYPE = 'application/vnd.ims.lis.v2.lineitem+json'
CONTAINER_MIME_TYPE = 'application/vnd.ims.lis.v2.lineitemcontainer+json'
rescue_from ActionController::BadRequest do |e|
unless Rails.env.production?

View File

@ -261,7 +261,7 @@ module Lti::IMS
class NamesAndRolesController < ApplicationController
include Concerns::AdvantageServices
MIME_TYPE = 'application/vnd.ims.lti-nrps.v2.membershipcontainer+json'.freeze
MIME_TYPE = 'application/vnd.ims.lti-nrps.v2.membershipcontainer+json'
# @API List Course Memberships
# Return active NamesAndRoleMemberships in the given course.

View File

@ -64,7 +64,7 @@ module Lti::IMS
before_action :verify_line_item_in_context
before_action :verify_result_in_line_item, only: %i[show]
MIME_TYPE = 'application/vnd.ims.lis.v2.resultcontainer+json'.freeze
MIME_TYPE = 'application/vnd.ims.lis.v2.resultcontainer+json'
# @API Show a collection of Results
#

View File

@ -78,7 +78,7 @@ module Lti::IMS
:verify_attempts_for_online_upload,
)
MIME_TYPE = 'application/vnd.ims.lis.v1.score+json'.freeze
MIME_TYPE = 'application/vnd.ims.lis.v1.score+json'
# @API Create a Score
#
@ -219,7 +219,7 @@ module Lti::IMS
content_items: %i[type url title]
].freeze
SCORE_SUBMISSION_TYPES = %w[none basic_lti_launch online_text_entry online_url external_tool online_upload].freeze
DEFAULT_SUBMISSION_TYPE = 'external_tool'.freeze
DEFAULT_SUBMISSION_TYPE = 'external_tool'
def scopes_matcher
self.class.all_of(TokenScopes::LTI_AGS_SCORE_SCOPE)

View File

@ -23,7 +23,7 @@ module Lti
class ToolConsumerProfileController < ApplicationController
include Lti::IMS::AccessTokenHelper
TOOL_CONSUMER_PROFILE_SERVICE = 'ToolConsumerProfile'.freeze
TOOL_CONSUMER_PROFILE_SERVICE = 'ToolConsumerProfile'
before_action :require_context
skip_before_action :load_user

View File

@ -24,8 +24,8 @@ module Lti
include Lti::ApiServiceHelper
include Lti::IMS::AccessTokenHelper
TOOL_PROXY_COLLECTION = 'ToolProxy.collection'.freeze
TOOL_PROXY_ITEM = 'ToolProxy.item'.freeze
TOOL_PROXY_COLLECTION = 'ToolProxy.collection'
TOOL_PROXY_ITEM = 'ToolProxy.item'
SERVICE_DEFINITIONS = [
{

View File

@ -33,9 +33,9 @@ module Lti
}, status: :not_found
end
TOOL_SETTINGS_SERVICE = 'ToolProxySettings'.freeze
TOOL_PROXY_BINDING_SERVICE = 'ToolProxyBindingSettings'.freeze
LTI_LINK_SETTINGS = 'LtiLinkSettings'.freeze
TOOL_SETTINGS_SERVICE = 'ToolProxySettings'
TOOL_PROXY_BINDING_SERVICE = 'ToolProxyBindingSettings'
LTI_LINK_SETTINGS = 'LtiLinkSettings'
skip_before_action :load_user
before_action :authenticate_api_call

View File

@ -113,7 +113,7 @@ module Lti
class OriginalityReportsApiController < ApplicationController
include Lti::IMS::AccessTokenHelper
ORIGINALITY_REPORT_SERVICE = 'vnd.Canvas.OriginalityReport'.freeze
ORIGINALITY_REPORT_SERVICE = 'vnd.Canvas.OriginalityReport'
SERVICE_DEFINITIONS = [
{

View File

@ -67,7 +67,7 @@ module Lti
skip_before_action :load_user
before_action :authorized_lti2_tool, :tool_proxy_related_to_assignment?, :user_related_to_assignment?
ASSIGNMENT_SERVICE = 'vnd.Canvas.Assignment'.freeze
ASSIGNMENT_SERVICE = 'vnd.Canvas.Assignment'
SERVICE_DEFINITIONS = [
{
id: ASSIGNMENT_SERVICE,

View File

@ -136,7 +136,7 @@ module Lti
include ::Lti::IMS::Concerns::LtiServices
include Api::V1::DeveloperKey
MIME_TYPE = 'application/vnd.ims.lis.v2.publicjwk+json'.freeze
MIME_TYPE = 'application/vnd.ims.lis.v2.publicjwk+json'
ACTION_SCOPE_MATCHERS = {
update: all_of(TokenScopes::LTI_UPDATE_PUBLIC_JWK_SCOPE)

View File

@ -46,7 +46,7 @@ module Lti
class SubscriptionsApiController < ApplicationController
include Lti::IMS::AccessTokenHelper
WEBHOOK_SUBSCRIPTION_SERVICE = 'vnd.Canvas.webhooksSubscription'.freeze
WEBHOOK_SUBSCRIPTION_SERVICE = 'vnd.Canvas.webhooksSubscription'
SERVICE_DEFINITIONS = [
{

View File

@ -29,8 +29,8 @@ module Lti
before_action :user_in_context, only: :show
before_action :tool_in_context, only: :group_index
USER_SERVICE = 'vnd.Canvas.User'.freeze
GROUP_INDEX_SERVICE = 'vnd.Canvas.GroupIndex'.freeze
USER_SERVICE = 'vnd.Canvas.User'
GROUP_INDEX_SERVICE = 'vnd.Canvas.GroupIndex'
SERVICE_DEFINITIONS = [
{
id: USER_SERVICE,

View File

@ -312,12 +312,12 @@ class SisApiController < ApplicationController
GRADE_EXPORT_NOT_ENABLED_ERROR = {
code: 'not_enabled',
error: 'A SIS integration is not configured and the bulk SIS Grade Export feature is not enabled'.freeze
error: 'A SIS integration is not configured and the bulk SIS Grade Export feature is not enabled'
}.freeze
COURSE_NOT_PUBLISHED_ERROR = {
code: 'unpublished_course',
error: 'Grade data is not available for non-published courses'.freeze
error: 'Grade data is not available for non-published courses'
}.freeze
# @API Retrieve assignments enabled for grade export to SIS

View File

@ -45,7 +45,7 @@ class Assignment < ActiveRecord::Base
ALLOWED_GRADING_TYPES = %w(points percent letter_grade gpa_scale pass_fail not_graded).freeze
OFFLINE_SUBMISSION_TYPES = %i(on_paper external_tool none not_graded wiki_page).freeze
SUBMITTABLE_TYPES = %w(online_quiz discussion_topic wiki_page).freeze
LTI_EULA_SERVICE = 'vnd.Canvas.Eula'.freeze
LTI_EULA_SERVICE = 'vnd.Canvas.Eula'
AUDITABLE_ATTRIBUTES = %w[
muted
due_at

View File

@ -22,8 +22,8 @@ class Assignment
class GradeError < StandardError
attr_accessor :status_code, :error_code
PROVISIONAL_GRADE_INVALID_SCORE = "PROVISIONAL_GRADE_INVALID_SCORE".freeze
PROVISIONAL_GRADE_MODIFY_SELECTED = "PROVISIONAL_GRADE_MODIFY_SELECTED".freeze
PROVISIONAL_GRADE_INVALID_SCORE = "PROVISIONAL_GRADE_INVALID_SCORE"
PROVISIONAL_GRADE_MODIFY_SELECTED = "PROVISIONAL_GRADE_MODIFY_SELECTED"
# The following parameters are all optional, and allow for different behavior
# depending on the type of error.

View File

@ -24,7 +24,7 @@ class AssignmentOverride < ActiveRecord::Base
NOOP_MASTERY_PATHS = 1
SET_TYPE_NOOP = 'Noop'.freeze
SET_TYPE_NOOP = 'Noop'
simply_versioned :keep => 10

View File

@ -43,7 +43,7 @@ class Attachment < ActiveRecord::Base
EXCLUDED_COPY_ATTRIBUTES = %w{id root_attachment_id uuid folder_id user_id
filename namespace workflow_state root_account_id}
CLONING_ERROR_TYPE = 'attachment_clone_url'.freeze
CLONING_ERROR_TYPE = 'attachment_clone_url'
include HasContentTags
include ContextModuleItem

View File

@ -43,7 +43,7 @@ class AuthenticationProvider::Apple < AuthenticationProvider::OpenIDConnect
end
def self.login_attributes
['sub'.freeze, 'email'.freeze].freeze
['sub', 'email'].freeze
end
validates :login_attribute, inclusion: login_attributes
@ -53,10 +53,10 @@ class AuthenticationProvider::Apple < AuthenticationProvider::OpenIDConnect
def self.recognized_federated_attributes
[
'email'.freeze,
'firstName'.freeze,
'lastName'.freeze,
'sub'.freeze,
'email',
'firstName',
'lastName',
'sub',
].freeze
end

View File

@ -22,7 +22,7 @@ require 'casclient'
class AuthenticationProvider::CAS < AuthenticationProvider::Delegated
def self.sti_name
'cas'.freeze
'cas'
end
def self.recognized_params

View File

@ -32,19 +32,19 @@ class AuthenticationProvider::Clever < AuthenticationProvider::OAuth2
end
def self.login_attributes
['id'.freeze, 'sis_id'.freeze, 'email'.freeze, 'student_number'.freeze, 'teacher_number'.freeze, 'state_id'.freeze, 'district_username'.freeze].freeze
['id', 'sis_id', 'email', 'student_number', 'teacher_number', 'state_id', 'district_username'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
(login_attributes + ['first_name'.freeze, 'last_name'.freeze, 'home_language'.freeze]).freeze
(login_attributes + ['first_name', 'last_name', 'home_language']).freeze
end
# Rename db field
alias_attribute :district_id, :auth_filter
def login_attribute
super || 'id'.freeze
super || 'id'
end
def unique_id(token)
@ -81,9 +81,9 @@ class AuthenticationProvider::Clever < AuthenticationProvider::OAuth2
def client_options
{
site: 'https://api.clever.com'.freeze,
site: 'https://api.clever.com',
authorize_url: 'https://clever.com/oauth/authorize',
token_url: 'https://clever.com/oauth/tokens'.freeze,
token_url: 'https://clever.com/oauth/tokens',
auth_scheme: :basic_auth,
}
end

View File

@ -42,23 +42,23 @@ class AuthenticationProvider::Facebook < AuthenticationProvider::OAuth2
end
def self.login_attributes
['id'.freeze, 'email'.freeze].freeze
['id', 'email'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
[
'email'.freeze,
'first_name'.freeze,
'id'.freeze,
'last_name'.freeze,
'locale'.freeze,
'name'.freeze,
'email',
'first_name',
'id',
'last_name',
'locale',
'name',
].freeze
end
def login_attribute
super || 'id'.freeze
super || 'id'
end
def unique_id(token)
@ -81,7 +81,7 @@ class AuthenticationProvider::Facebook < AuthenticationProvider::OAuth2
def authorize_options
if login_attribute == 'email' || federated_attributes.any? { |(_k, v)| v['attribute'] == 'email' }
{ scope: 'email'.freeze }.freeze
{ scope: 'email' }.freeze
else
{}.freeze
end
@ -89,9 +89,9 @@ class AuthenticationProvider::Facebook < AuthenticationProvider::OAuth2
def client_options
{
site: 'https://graph.facebook.com'.freeze,
authorize_url: 'https://www.facebook.com/dialog/oauth'.freeze,
token_url: 'oauth/access_token'.freeze
site: 'https://graph.facebook.com',
authorize_url: 'https://www.facebook.com/dialog/oauth',
token_url: 'oauth/access_token'
}
end
end

View File

@ -24,7 +24,7 @@ class AuthenticationProvider::GitHub < AuthenticationProvider::OAuth2
plugin_settings :domain, :client_id, client_secret: :client_secret_dec
def self.sti_name
'github'.freeze
'github'
end
def self.recognized_params
@ -32,16 +32,16 @@ class AuthenticationProvider::GitHub < AuthenticationProvider::OAuth2
end
def self.login_attributes
['id'.freeze, 'email'.freeze, 'login'.freeze].freeze
['id', 'email', 'login'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
[
'email'.freeze,
'id'.freeze,
'login'.freeze,
'name'.freeze
'email',
'id',
'login',
'name'
].freeze
end
@ -57,7 +57,7 @@ class AuthenticationProvider::GitHub < AuthenticationProvider::OAuth2
end
def login_attribute
super || 'id'.freeze
super || 'id'
end
protected
@ -81,13 +81,13 @@ class AuthenticationProvider::GitHub < AuthenticationProvider::OAuth2
def client_options
{
site: domain.present? ? "https://#{domain}/api/v3" : 'https://api.github.com'.freeze,
site: domain.present? ? "https://#{domain}/api/v3" : 'https://api.github.com',
authorize_url: "https://#{inferred_domain}/login/oauth/authorize",
token_url: "https://#{inferred_domain}/login/oauth/access_token"
}
end
def inferred_domain
domain.presence || 'github.com'.freeze
domain.presence || 'github.com'
end
end

View File

@ -39,18 +39,18 @@ class AuthenticationProvider::Google < AuthenticationProvider::OpenIDConnect
end
def self.login_attributes
['sub'.freeze, 'email'.freeze].freeze
['sub', 'email'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
[
'email'.freeze,
'family_name'.freeze,
'given_name'.freeze,
'locale'.freeze,
'name'.freeze,
'sub'.freeze,
'email',
'family_name',
'given_name',
'locale',
'name',
'sub',
].freeze
end
@ -72,7 +72,7 @@ class AuthenticationProvider::Google < AuthenticationProvider::OpenIDConnect
protected
def userinfo_endpoint
"https://www.googleapis.com/oauth2/v3/userinfo".freeze
"https://www.googleapis.com/oauth2/v3/userinfo"
end
def client_options
@ -91,7 +91,7 @@ class AuthenticationProvider::Google < AuthenticationProvider::OpenIDConnect
def scope
scopes = []
scopes << 'email' if login_attribute == 'email'.freeze ||
scopes << 'email' if login_attribute == 'email' ||
hosted_domain ||
federated_attributes.any? { |(_k, v)| v['attribute'] == 'email' }
scopes << 'profile' if federated_attributes.any? { |(_k, v)| v['attribute'] == 'name' }
@ -99,11 +99,11 @@ class AuthenticationProvider::Google < AuthenticationProvider::OpenIDConnect
end
def authorize_url
'https://accounts.google.com/o/oauth2/auth'.freeze
'https://accounts.google.com/o/oauth2/auth'
end
def token_url
'https://accounts.google.com/o/oauth2/token'.freeze
'https://accounts.google.com/o/oauth2/token'
end
def hosted_domains

View File

@ -20,7 +20,7 @@
class AuthenticationProvider::LDAP < AuthenticationProvider
def self.sti_name
'ldap'.freeze
'ldap'
end
# if the config changes, clear out last_timeout_failure so another attempt can be made immediately

View File

@ -24,7 +24,7 @@ class AuthenticationProvider::LinkedIn < AuthenticationProvider::OAuth2
plugin_settings :client_id, client_secret: :client_secret_dec
def self.sti_name
'linkedin'.freeze
'linkedin'
end
def self.recognized_params
@ -32,21 +32,21 @@ class AuthenticationProvider::LinkedIn < AuthenticationProvider::OAuth2
end
def self.login_attributes
['id'.freeze, 'emailAddress'.freeze].freeze
['id', 'emailAddress'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
[
'emailAddress'.freeze,
'firstName'.freeze,
'id'.freeze,
'lastName'.freeze,
'emailAddress',
'firstName',
'id',
'lastName',
].freeze
end
def login_attribute
super || 'id'.freeze
super || 'id'
end
def unique_id(token)
@ -87,13 +87,13 @@ class AuthenticationProvider::LinkedIn < AuthenticationProvider::OAuth2
end
def email_required?
login_attribute == 'emailAddress'.freeze ||
login_attribute == 'emailAddress' ||
federated_attributes.any? { |(_k, v)| v['attribute'] == 'emailAddress' }
end
def client_options
{
site: 'https://api.linkedin.com'.freeze,
site: 'https://api.linkedin.com',
authorize_url: 'https://www.linkedin.com/uas/oauth2/authorization',
token_url: 'https://www.linkedin.com/uas/oauth2/accessToken'
}
@ -105,9 +105,9 @@ class AuthenticationProvider::LinkedIn < AuthenticationProvider::OAuth2
def scope
if email_required?
'r_liteprofile r_emailaddress'.freeze
'r_liteprofile r_emailaddress'
else
'r_liteprofile'.freeze
'r_liteprofile'
end
end
end

View File

@ -55,22 +55,22 @@ class AuthenticationProvider::Microsoft < AuthenticationProvider::OpenIDConnect
end
def self.login_attributes
['sub'.freeze, 'email'.freeze, 'oid'.freeze, 'preferred_username'.freeze].freeze
['sub', 'email', 'oid', 'preferred_username'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
[
'email'.freeze,
'name'.freeze,
'preferred_username'.freeze,
'oid'.freeze,
'sub'.freeze,
'email',
'name',
'preferred_username',
'oid',
'sub',
].freeze
end
def login_attribute
super || 'id'.freeze
super || 'id'
end
protected

View File

@ -22,11 +22,11 @@ class AuthenticationProvider::OpenIDConnect < AuthenticationProvider::OAuth2
attr_accessor :instance_debugging
def self.sti_name
self == OpenIDConnect ? 'openid_connect'.freeze : super
self == OpenIDConnect ? 'openid_connect' : super
end
def self.display_name
self == OpenIDConnect ? 'OpenID Connect'.freeze : super
self == OpenIDConnect ? 'OpenID Connect' : super
end
def self.open_id_connect_params
@ -79,7 +79,7 @@ class AuthenticationProvider::OpenIDConnect < AuthenticationProvider::OAuth2
end
def login_attribute
super.presence || 'sub'.freeze
super.presence || 'sub'
end
def unique_id(token)
@ -148,9 +148,9 @@ class AuthenticationProvider::OpenIDConnect < AuthenticationProvider::OAuth2
PROFILE_CLAIMS = ['name', 'family_name', 'given_name', 'middle_name', 'nickname', 'preferred_username',
'profile', 'picture', 'website', 'gender', 'birthdate', 'zoneinfo', 'locale', 'updated_at'].freeze
def scope_for_options
result = (scope || ''.freeze).split(' '.freeze)
result = (scope || '').split(' ')
result.unshift('openid'.freeze)
result.unshift('openid')
claims = requested_claims
# see http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
result << 'profile' unless (claims & PROFILE_CLAIMS).empty?
@ -159,6 +159,6 @@ class AuthenticationProvider::OpenIDConnect < AuthenticationProvider::OAuth2
result << 'phone' if claims.include?('phone_number') || claims.include?('phone_number_verified')
result.uniq!
result.join(' '.freeze)
result.join(' ')
end
end

View File

@ -22,7 +22,7 @@ require 'saml2'
class AuthenticationProvider::SAML < AuthenticationProvider::Delegated
def self.sti_name
'saml'.freeze
'saml'
end
def self.enabled?(_account = nil)

View File

@ -21,7 +21,7 @@
require 'saml2'
class AuthenticationProvider::SAML::InCommon < AuthenticationProvider::SAML::Federation
URN = 'urn:mace:incommon'.freeze
URN = 'urn:mace:incommon'
class << self
def endpoint

View File

@ -21,7 +21,7 @@
require 'saml2'
class AuthenticationProvider::SAML::UKFederation < AuthenticationProvider::SAML::Federation
URN = 'http://ukfederation.org.uk'.freeze
URN = 'http://ukfederation.org.uk'
class << self
def endpoint

View File

@ -28,21 +28,21 @@ class AuthenticationProvider::Twitter < AuthenticationProvider::OAuth
end
def self.login_attributes
['user_id'.freeze, 'screen_name'.freeze].freeze
['user_id', 'screen_name'].freeze
end
validates :login_attribute, inclusion: login_attributes
def self.recognized_federated_attributes
[
'name'.freeze,
'screen_name'.freeze,
'time_zone'.freeze,
'user_id'.freeze,
'name',
'screen_name',
'time_zone',
'user_id',
].freeze
end
def login_attribute
super || 'user_id'.freeze
super || 'user_id'
end
def unique_id(token)
@ -61,8 +61,8 @@ class AuthenticationProvider::Twitter < AuthenticationProvider::OAuth
def consumer_options
{
site: 'https://api.twitter.com'.freeze,
authorize_path: '/oauth/authenticate'.freeze
site: 'https://api.twitter.com',
authorize_path: '/oauth/authenticate'
}
end
end

View File

@ -41,13 +41,13 @@ class ContentExport < ActiveRecord::Base
before_create :set_global_identifiers
# export types
COMMON_CARTRIDGE = 'common_cartridge'.freeze
COURSE_COPY = 'course_copy'.freeze
MASTER_COURSE_COPY = 'master_course_copy'.freeze
QTI = 'qti'.freeze
USER_DATA = 'user_data'.freeze
ZIP = 'zip'.freeze
QUIZZES2 = 'quizzes2'.freeze
COMMON_CARTRIDGE = 'common_cartridge'
COURSE_COPY = 'course_copy'
MASTER_COURSE_COPY = 'master_course_copy'
QTI = 'qti'
USER_DATA = 'user_data'
ZIP = 'zip'
QUIZZES2 = 'quizzes2'
CC_EXPORT_TYPES = [COMMON_CARTRIDGE, COURSE_COPY, MASTER_COURSE_COPY, QTI, QUIZZES2].freeze
workflow do

View File

@ -57,11 +57,11 @@ class ContextExternalTool < ActiveRecord::Base
:editor_button => [:use_tray].freeze
}.freeze
DISABLED_STATE = 'disabled'.freeze
QUIZ_LTI = 'Quizzes 2'.freeze
ANALYTICS_2 = 'fd75124a-140e-470f-944c-114d2d93bb40'.freeze
DISABLED_STATE = 'disabled'
QUIZ_LTI = 'Quizzes 2'
ANALYTICS_2 = 'fd75124a-140e-470f-944c-114d2d93bb40'
TOOL_FEATURE_MAPPING = { ANALYTICS_2 => :analytics_2 }.freeze
PREFERRED_LTI_VERSION = '1_3'.freeze
PREFERRED_LTI_VERSION = '1_3'
workflow do
state :anonymous

View File

@ -315,7 +315,7 @@ class Course < ActiveRecord::Base
# A hard limit on the number of graders (excluding the moderator) a moderated
# assignment can have.
MODERATED_GRADING_GRADER_LIMIT = 10.freeze
MODERATED_GRADING_GRADER_LIMIT = 10
def [](attr)
attr.to_s == 'asset_string' ? self.asset_string : super

View File

@ -128,7 +128,7 @@ module Csp::AccountHelper
domains.uniq.sort
end
ACCOUNT_TOOL_CACHE_KEY_PREFIX = "account_tool_domains".freeze
ACCOUNT_TOOL_CACHE_KEY_PREFIX = "account_tool_domains"
def cached_tool_domains
@cached_tool_domains ||= Rails.cache.fetch([ACCOUNT_TOOL_CACHE_KEY_PREFIX, self.global_id].cache_key) do
get_account_tool_domains

View File

@ -41,7 +41,7 @@ class ErrorReport < ActiveRecord::Base
end
class Reporter
IGNORED_CATEGORIES = "404,ActionDispatch::RemoteIp::IpSpoofAttackError,Turnitin::Errors::SubmissionNotScoredError".freeze
IGNORED_CATEGORIES = "404,ActionDispatch::RemoteIp::IpSpoofAttackError,Turnitin::Errors::SubmissionNotScoredError"
def ignored_categories
Setting.get('ignored_error_report_categories', IGNORED_CATEGORIES).split(',')

View File

@ -21,7 +21,7 @@ require 'English'
module Exporters
class Quizzes2Exporter
GROUP_NAME = 'Migrated Quizzes'.freeze
GROUP_NAME = 'Migrated Quizzes'
attr_accessor :course, :quiz

View File

@ -20,10 +20,10 @@
module Lti
module ContentMigrationService
class Migrator
FAILED_STATUS = 'failed'.freeze
FAILED_STATUS = 'failed'
JWT_LIFETIME = 30.seconds
SUCCESSFUL_STATUS = 'completed'.freeze
JSON_FORMAT = 'json'.freeze
SUCCESSFUL_STATUS = 'completed'
JSON_FORMAT = 'json'
private_constant :FAILED_STATUS, :JWT_LIFETIME, :SUCCESSFUL_STATUS, :JSON_FORMAT
private

View File

@ -48,7 +48,7 @@ class Lti::LineItem < ApplicationRecord
before_destroy :destroy_resource_link, if: :assignment_line_item? # assignment will destroy all the other line_items of a resourceLink
before_destroy :destroy_assignment
AGS_EXT_SUBMISSION_TYPE = 'https://canvas.instructure.com/lti/submission_type'.freeze
AGS_EXT_SUBMISSION_TYPE = 'https://canvas.instructure.com/lti/submission_type'
def assignment_line_item?
assignment.line_items.order(:created_at).first.id == self.id

View File

@ -20,8 +20,8 @@
module Lti
class MessageHandler < ActiveRecord::Base
BASIC_LTI_LAUNCH_REQUEST = 'basic-lti-launch-request'.freeze
TOOL_PROXY_REREGISTRATION_REQUEST = 'ToolProxyRegistrationRequest'.freeze
BASIC_LTI_LAUNCH_REQUEST = 'basic-lti-launch-request'
TOOL_PROXY_REREGISTRATION_REQUEST = 'ToolProxyRegistrationRequest'
attr_readonly :created_at

View File

@ -29,7 +29,7 @@ module Lti
POST_GRADES = 'post_grades'
RESOURCE_SELECTION = 'resource_selection'
SIMILARITY_DETECTION = 'similarity_detection'
GLOBAL_NAVIGATION = 'global_navigation'.freeze
GLOBAL_NAVIGATION = 'global_navigation'
SIMILARITY_DETECTION_LTI2 = 'Canvas.placements.similarityDetection'

View File

@ -25,7 +25,7 @@ class Lti::Result < ApplicationRecord
ACCEPT_GIVEN_SCORE_TYPES = %w[FullyGraded PendingManual].freeze
ACTIVITY_PROGRESS_TYPES = %w[Initialized Started InProgress Submitted Completed].freeze
AGS_EXT_SUBMISSION = 'https://canvas.instructure.com/lti/submission'.freeze
AGS_EXT_SUBMISSION = 'https://canvas.instructure.com/lti/submission'
self.record_timestamps = false

View File

@ -19,8 +19,8 @@
module Lti
class ToolConfiguration < ActiveRecord::Base
CANVAS_EXTENSION_LABEL = 'canvas.instructure.com'.freeze
DEFAULT_PRIVACY_LEVEL = 'anonymous'.freeze
CANVAS_EXTENSION_LABEL = 'canvas.instructure.com'
DEFAULT_PRIVACY_LEVEL = 'anonymous'
belongs_to :developer_key

View File

@ -27,9 +27,9 @@ module Lti
serialize :services
serialize :capabilities
DEFAULT_TCP_UUID = "339b6700-e4cb-47c5-a54f-3ee0064921a9".freeze
DEFAULT_TCP_UUID = "339b6700-e4cb-47c5-a54f-3ee0064921a9"
WEBHOOK_GRANT_ALL_CAPABILITY = 'vnd.instructure.webhooks.root_account.all'.freeze
WEBHOOK_GRANT_ALL_CAPABILITY = 'vnd.instructure.webhooks.root_account.all'
WEBHOOK_SUBSCRIPTION_CAPABILITIES = {
all: [WEBHOOK_GRANT_ALL_CAPABILITY].freeze,
quiz_submitted: %w(vnd.instructure.webhooks.root_account.quiz_submitted

View File

@ -31,7 +31,7 @@ module MasterCourses
CONTENT_TYPES_FOR_DELETIONS = (ALLOWED_CONTENT_TYPES - ['Wiki']).freeze
CONTENT_TYPES_FOR_UNSYNCED_CHANGES = (ALLOWED_CONTENT_TYPES - ['ContentTag', 'Wiki'] + ['Folder']).freeze
MIGRATION_ID_PREFIX = "mastercourse_".freeze
MIGRATION_ID_PREFIX = "mastercourse_"
LOCK_TYPES = [:content, :settings, :points, :due_dates, :availability_dates, :state].freeze

View File

@ -32,7 +32,6 @@ module Quizzes::LogAuditing
AND attempt = :attempt
AND event_type = '#{EVENT_TYPE}'
SQL
.freeze
# Main API. Extract, optimize, and persist an answer event from a given
# submission data construct.

View File

@ -23,10 +23,10 @@ class Quizzes::QuizSubmissionEvent < ActiveRecord::Base
include CanvasPartman::Concerns::Partitioned
# An event describing the student choosing an answer to a question.
EVT_QUESTION_ANSWERED = "question_answered".freeze
EVT_QUESTION_FLAGGED = "question_flagged".freeze
EVT_QUESTION_ANSWERED = "question_answered"
EVT_QUESTION_FLAGGED = "question_flagged"
# An event for every new submission created
EVT_SUBMISSION_CREATED = "submission_created".freeze
EVT_SUBMISSION_CREATED = "submission_created"
belongs_to :quiz_submission, class_name: 'Quizzes::QuizSubmission'
resolves_root_account through: :quiz_submission

View File

@ -1582,7 +1582,7 @@ class RoleOverride < ActiveRecord::Base
}
)
ACCESS_TOKEN_SCOPE_PREFIX = 'https://api.instructure.com/auth/canvas'.freeze
ACCESS_TOKEN_SCOPE_PREFIX = 'https://api.instructure.com/auth/canvas'
def self.permissions
Permissions.retrieve

View File

@ -19,7 +19,7 @@
#
class Setting < Switchman::UnshardedRecord
SITE_ADMIN_ACCESS_TO_NEW_DEV_KEY_FEATURES = 'site_admin_access_to_new_dev_key_features'.freeze
SITE_ADMIN_ACCESS_TO_NEW_DEV_KEY_FEATURES = 'site_admin_access_to_new_dev_key_features'
def self.skip_cache
@skip_cache, old_enabled = true, @skip_cache

View File

@ -30,7 +30,7 @@ class UserPreferenceValue < ActiveRecord::Base
# this means that the preference value is no longer stored on the user object
# and is in it's own record in the db
EXTERNAL = :external.freeze
EXTERNAL = :external
def self.add_user_preference(key, use_sub_keys: false)
# set use_sub_keys if we were previously storing a big ol' Hash but only getting/setting one value at a time

View File

@ -30,7 +30,7 @@ module TimeZoneFormImprovements
unfriendly_zone = "".html_safe
unfriendly_zone.safe_concat options_for_select([["#{selected} (#{zone.formatted_offset})", selected]], selected)
unfriendly_zone.safe_concat content_tag("option".freeze, '-------------', value: '', disabled: true)
unfriendly_zone.safe_concat content_tag("option", '-------------', value: '', disabled: true)
unfriendly_zone.safe_concat "\n"
unfriendly_zone.safe_concat result
result = unfriendly_zone

View File

@ -18,5 +18,5 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
module Audits
VERSION = '0.1.0'.freeze
VERSION = '0.1.0'
end

View File

@ -38,8 +38,8 @@ module CanvasQuizStatistics::Analyzers
inherit :responses, :full_credit, from: :essay
inherit :correct, :incorrect, from: :fill_in_multiple_blanks
RANGE_ANSWER = 'range_answer'.freeze
PRECISION_ANSWER = 'precision_answer'.freeze
RANGE_ANSWER = 'range_answer'
PRECISION_ANSWER = 'precision_answer'
# Statistics for the pre-defined answers.
#

View File

@ -20,9 +20,9 @@
module CanvasSecurity
class KeyStorage
PAST = 'jwk-past.json'.freeze
PRESENT = 'jwk-present.json'.freeze
FUTURE = 'jwk-future.json'.freeze
PAST = 'jwk-past.json'
PRESENT = 'jwk-present.json'
FUTURE = 'jwk-future.json'
MAX_CACHE_AGE = 10.days.to_i
MIN_ROTATION_PERIOD = 1.hour

View File

@ -21,8 +21,8 @@ require 'openssl'
module CanvasSecurity
class RSAKeyPair < JWKKeyPair
KTY = 'RSA'.freeze
ALG = 'RS256'.freeze
KTY = 'RSA'
ALG = 'RS256'
SIZE = 2048
def initialize(use: 'sig')
super()

View File

@ -19,10 +19,10 @@
module LtiAdvantage::Serializers
class JwtMessageSerializer
IMS_CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti/claim/'.freeze
DL_CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti-dl/claim/'.freeze
NRPS_CLAIM_URL = 'https://purl.imsglobal.org/spec/lti-nrps/claim/namesroleservice'.freeze
AGS_CLAIM_URL = 'https://purl.imsglobal.org/spec/lti-ags/claim/endpoint'.freeze
IMS_CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti/claim/'
DL_CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti-dl/claim/'
NRPS_CLAIM_URL = 'https://purl.imsglobal.org/spec/lti-nrps/claim/namesroleservice'
AGS_CLAIM_URL = 'https://purl.imsglobal.org/spec/lti-ags/claim/endpoint'
STANDARD_IMS_CLAIMS = %w(
context
@ -46,8 +46,8 @@ module LtiAdvantage::Serializers
content_items
).freeze
NAMES_AND_ROLES_SERVICE_CLAIM = 'names_and_roles_service'.freeze
ASSIGNMENT_AND_GRADE_SERVICE_CLAIM = 'assignment_and_grade_service'.freeze
NAMES_AND_ROLES_SERVICE_CLAIM = 'names_and_roles_service'
ASSIGNMENT_AND_GRADE_SERVICE_CLAIM = 'assignment_and_grade_service'
def initialize(object)
@object = object

View File

@ -23,7 +23,7 @@ module RuboCop
class NoDisableImplicitWait < Cop
MSG = "Avoid using disable_implicit_wait.\n" \
"Look through custom_selenium_rspec_matchers.rb" \
" and custom_wait_methods.rb.".freeze
" and custom_wait_methods.rb."
METHOD = :disable_implicit_wait

View File

@ -27,9 +27,9 @@ module RuboCop
" Selenium::WebDriver::Error::NoSuchElementError" \
" (just like find_element, etc).\n" \
"Look through custom_selenium_rspec_matchers.rb" \
" and custom_wait_methods.rb.".freeze
" and custom_wait_methods.rb."
BAD_CONST = "Selenium::WebDriver::Wait".freeze
BAD_CONST = "Selenium::WebDriver::Wait"
BAD_CONST_MATCHER = BAD_CONST.split("::")
.map { |name| ":#{name})" }
.join(" ")

View File

@ -24,7 +24,7 @@ module RuboCop
module Specs
class NoSkipWithoutTicket < Cop
MSG = "Reference a ticket if skipping."\
" Example: skip('time bomb on saturdays CNVS-123456').".freeze
" Example: skip('time bomb on saturdays CNVS-123456')."
METHOD = :skip

View File

@ -23,7 +23,7 @@ module RuboCop
class NoWaitForNoSuchElement < Cop
MSG = "Avoid using wait_for_no_such_element. Instead, use"\
" not_to contain_css/contain_link.\n"\
"e.g. expect(f('#courses')).not_to contain_css('#course_123')".freeze
"e.g. expect(f('#courses')).not_to contain_css('#course_123')"
METHOD = :wait_for_no_such_element

View File

@ -1,23 +1,23 @@
# frozen_string_literal: true
module Consts
APP_COFFEE_PATH = "app/coffeescripts/calendar/CalendarEvent.coffee".freeze
APP_COFFEE_BUNDLE_PATH = "app/coffeescripts/bundles/authentication_providers.coffee".freeze
COFFEE_SPEC_PATH = "spec/coffeescripts/calendar/CalendarSpec.coffee".freeze
APP_COFFEE_PATH = "app/coffeescripts/calendar/CalendarEvent.coffee"
APP_COFFEE_BUNDLE_PATH = "app/coffeescripts/bundles/authentication_providers.coffee"
COFFEE_SPEC_PATH = "spec/coffeescripts/calendar/CalendarSpec.coffee"
APP_JSX_PATH = "app/jsx/dashboard_card/DashboardCardAction.js".freeze
JSX_SPEC_PATH = "spec/javascripts/jsx/dashboard_card/DashboardCardActionSpec.coffee".freeze
APP_JSX_PATH = "app/jsx/dashboard_card/DashboardCardAction.js"
JSX_SPEC_PATH = "spec/javascripts/jsx/dashboard_card/DashboardCardActionSpec.coffee"
APP_RB_PATH = "app/controllers/accounts_controller.rb".freeze
APP_RB_SPEC_PATH = "spec/controllers/accounts_controller_spec.rb".freeze
LIB_RB_PATH = "lib/reporting/counts_report.rb".freeze
LIB_RB_SPEC_PATH = "spec/lib/reporting/counts_report_spec.rb".freeze
APP_RB_PATH = "app/controllers/accounts_controller.rb"
APP_RB_SPEC_PATH = "spec/controllers/accounts_controller_spec.rb"
LIB_RB_PATH = "lib/reporting/counts_report.rb"
LIB_RB_SPEC_PATH = "spec/lib/reporting/counts_report_spec.rb"
APP_ERB_PATH = "app/views/announcements/index.html.erb".freeze
OTHER_ERB_PATH = "spec/formatters/error_context/html_page_formatter/template.html.erb".freeze
PUBLIC_JS_PATH = "public/javascripts/account_statistics.js".freeze
PUBLIC_JS_SPEC_PATH = "spec/javascripts/jsx/eportfolios/eportfolioSectionSpec.jsx".freeze
APP_ERB_PATH = "app/views/announcements/index.html.erb"
OTHER_ERB_PATH = "spec/formatters/error_context/html_page_formatter/template.html.erb"
PUBLIC_JS_PATH = "public/javascripts/account_statistics.js"
PUBLIC_JS_SPEC_PATH = "spec/javascripts/jsx/eportfolios/eportfolioSectionSpec.jsx"
PUBLIC_VENDOR_JS_PATH = "public/javascripts/vendor/bootstrap/bootstrap-dropdown.js".freeze
SELENIUM_SPEC_PATH = "spec/selenium/announcements/announcements_student_spec.rb".freeze
PUBLIC_VENDOR_JS_PATH = "public/javascripts/vendor/bootstrap/bootstrap-dropdown.js"
SELENIUM_SPEC_PATH = "spec/selenium/announcements/announcements_student_spec.rb"
end

View File

@ -45,7 +45,7 @@ describe Utf8Cleaner do
end
it "strips out invalid characters from frozen strings" do
frozen = "\x7Fohai".freeze
frozen = "\x7Fohai"
expect(Utf8Cleaner.strip_invalid_utf8(frozen)).to eql("ohai")
end

View File

@ -25,7 +25,7 @@ module BrandableCSS
APP_ROOT = (defined?(Rails) && Rails.root) || Pathname.pwd
CONFIG = YAML.load_file(APP_ROOT.join('config/brandable_css.yml')).freeze
BRANDABLE_VARIABLES = JSON.parse(File.read(APP_ROOT.join(CONFIG['paths']['brandable_variables_json']))).freeze
MIGRATION_NAME = 'RegenerateBrandFilesBasedOnNewDefaults'.freeze
MIGRATION_NAME = 'RegenerateBrandFilesBasedOnNewDefaults'
VARIABLE_HUMAN_NAMES = {
"ic-brand-primary" => lambda { I18n.t("Primary Brand Color") },

View File

@ -28,7 +28,7 @@ module Canvas
# that puts a call to `fetch_without_expiration` in the rescue
# clause
module FallbackExpirationCache
KEY_SUFFIX = '__no_expire'.freeze
KEY_SUFFIX = '__no_expire'
def fetch(*, expires_in: nil, race_condition_ttl: nil)
return yield if expires_in == 0

View File

@ -99,7 +99,7 @@ module Canvas::Migration::ExternalContent
end
end
NOT_FOUND = "$OBJECT_NOT_FOUND".freeze
NOT_FOUND = "$OBJECT_NOT_FOUND"
def get_canvas_id_from_migration_id(obj_class, migration_id)
return NOT_FOUND if migration_id == NOT_FOUND

View File

@ -20,7 +20,7 @@
require 'vault'
module Canvas::Vault
CACHE_KEY_PREFIX = 'vault/'.freeze
CACHE_KEY_PREFIX = 'vault/'
class MissingVaultSecret < StandardError; end
class << self

View File

@ -17,7 +17,7 @@
# 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/>.
class CSVWithI18n < CSV
BYTE_ORDER_MARK = "\xEF\xBB\xBF".freeze
BYTE_ORDER_MARK = "\xEF\xBB\xBF"
def initialize(data, **options)
@include_bom = options.delete(:include_bom)

View File

@ -96,7 +96,7 @@ module DataFixup
end
# sanity safety check
KEY_VALUE_PATTERN = '\s*"\d+"\s*:\s*"[0-9a-f-]+"\s*'.freeze
KEY_VALUE_PATTERN = '\s*"\d+"\s*:\s*"[0-9a-f-]+"\s*'
JSON_LINE_PATTERN = /^\s*{#{KEY_VALUE_PATTERN}(?:,#{KEY_VALUE_PATTERN})*}\s*$/.freeze
def valid_import_json?(line)
line =~ JSON_LINE_PATTERN

View File

@ -20,7 +20,7 @@
module DataFixup
class InitAccountIndexForCourseAuditLog
LAST_BATCH_TABLE = 'courses_index_last_batch'.freeze
LAST_BATCH_TABLE = 'courses_index_last_batch'
def self.run
fixup = new
@ -57,11 +57,11 @@ module DataFixup
FROM courses
WHERE token(id) > token(?)
LIMIT ?
}.freeze
}
UPDATE_CQL = %{
UPDATE courses SET account_id = ? WHERE id = ?
}.freeze
}
ResultStruct = Struct.new(:index, :record, :key)

View File

@ -24,13 +24,13 @@ module DataFixup
new.build_indexes
end
LAST_BATCH_TABLE = 'grade_changes_index_last_batch'.freeze
LAST_BATCH_TABLE = 'grade_changes_index_last_batch'
SEARCH_CQL = %{
SELECT id, created_at, context_id, assignment_id, grader_id, student_id
FROM grade_changes
WHERE token(id) > token(?)
LIMIT ?
}.freeze
}
INDEX_METHODS = [
:add_course_assignment_index,
:add_course_assignment_grader_index,

View File

@ -19,7 +19,7 @@
#
module DataFixup::Lti::UpdateCustomParams
LOGGER_PREFIX = "Lti::UpdateCustomParams => ".freeze
LOGGER_PREFIX = "Lti::UpdateCustomParams => "
# This script will update all specified instances of LTI tools within Canvas,
# it is intended to be copied and pasted into a Canvas console

View File

@ -18,7 +18,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
module DataFixup::RebuildQuizSubmissionsFromQuizSubmissionEvents
LOG_PREFIX = "RebuildingQuizSubmissions - ".freeze
LOG_PREFIX = "RebuildingQuizSubmissions - "
SQL_SEARCH_STRING = <<-SQL
select

View File

@ -18,7 +18,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
module DataFixup::RebuildQuizSubmissionsFromQuizSubmissionVersions
LOG_PREFIX = "RebuildingQuizSubmissions - ".freeze
LOG_PREFIX = "RebuildingQuizSubmissions - "
class << self
def run(submission_id, timestamp = Time.zone.now)

View File

@ -36,7 +36,7 @@ module DataFixup
# submitted in the time range will have events
# retriggered.
class ResendPlagiarismEvents
EVENT_NAME = 'plagiarism_resubmit'.freeze
EVENT_NAME = 'plagiarism_resubmit'
def self.run(start_time: 3.months.ago, end_time: Time.zone.now, only_errors: false)
limit, = Setting.get('trigger_plagiarism_resubmit', '100,180').split(',').map(&:to_i)

View File

@ -33,8 +33,8 @@ module DataFixup::SetActlContextTypeForCourseLevelToolProxies
end
class ProductFamilyFixer
COURSE_CONTEXT_TYPE = 'Course'.freeze
ACCOUNT_CONTEXT_TYPE = 'Account'.freeze
COURSE_CONTEXT_TYPE = 'Course'
ACCOUNT_CONTEXT_TYPE = 'Account'
attr_reader :product_family

View File

@ -68,7 +68,7 @@ class DueDateCacher
self.executing_users.last
end
INFER_SUBMISSION_WORKFLOW_STATE_SQL = <<~SQL_FRAGMENT.freeze
INFER_SUBMISSION_WORKFLOW_STATE_SQL = <<~SQL_FRAGMENT
CASE
WHEN grade IS NOT NULL OR excused IS TRUE THEN
'graded'

View File

@ -28,7 +28,7 @@ module Lti
'default' => { template: 'lti/framed_launch' }.freeze,
'full_width_in_context' => { template: 'lti/full_width_in_context' }.freeze,
}.freeze
BLACKLIST_WILDCARD = '*'.freeze # to set up 'deny all' rules
BLACKLIST_WILDCARD = '*' # to set up 'deny all' rules
def self.display_template(display_type = nil, display_override: nil)
unless TOOL_DISPLAY_TEMPLATES.key?(display_type)

View File

@ -36,7 +36,7 @@ module Lti::Messages
# Canvas, please see the inline documentation of
# app/models/lti/lti_advantage_adapter.rb.
class JwtMessage
EXTENSION_PREFIX = 'https://www.instructure.com/'.freeze
EXTENSION_PREFIX = 'https://www.instructure.com/'
def initialize(tool:, context:, user:, expander:, return_url:, opts: {})
@tool = tool

View File

@ -22,7 +22,7 @@ module Lti
class AccessToken
private_class_method :new
ISS = 'Canvas'.freeze
ISS = 'Canvas'
attr_reader :aud, :sub, :reg_key, :shard_id

View File

@ -24,7 +24,7 @@ module Lti
class PlagiarismSubscriptionError < StandardError
end
SUBMISSION_EVENT_ID = 'vnd.Canvas.SubmissionEvent'.freeze
SUBMISSION_EVENT_ID = 'vnd.Canvas.SubmissionEvent'
EVENT_TYPES = %w(submission_created
plagiarism_resubmit
submission_updated

View File

@ -19,7 +19,7 @@
module Lti
class ReRegConstraint
RE_REG_HEADER = 'VND-IMS-CONFIRM-URL'.freeze
RE_REG_HEADER = 'VND-IMS-CONFIRM-URL'
def matches?(request)
request.headers[RE_REG_HEADER].present? &&

View File

@ -19,8 +19,8 @@
module Lti::RedisMessageClient
TTL = 5.minutes
LTI_1_3_PREFIX = 'external_tool:id_token:'.freeze
SESSIONLESS_LAUNCH_PREFIX = 'external_tool:sessionless_launch:'.freeze
LTI_1_3_PREFIX = 'external_tool:id_token:'
SESSIONLESS_LAUNCH_PREFIX = 'external_tool:sessionless_launch:'
def cache_launch(launch, context, prefix: LTI_1_3_PREFIX)
return unless Canvas.redis_enabled?

View File

@ -103,7 +103,7 @@ module Lti
values.each { |value| memo[value] += [key] }
end.reverse_merge({}).freeze
LIS_V2_LTI_ADVANTAGE_ROLE_NONE = 'http://purl.imsglobal.org/vocab/lis/v2/system/person#None'.freeze
LIS_V2_LTI_ADVANTAGE_ROLE_NONE = 'http://purl.imsglobal.org/vocab/lis/v2/system/person#None'
def initialize(context, root_account, user, tool = nil)
@context = context

View File

@ -511,7 +511,7 @@ module SIS
ERRORS_TO_REASONS = {
'unique_id is invalid' => "Invalid login_id: '%{login_id}'",
}.freeze
DEFAULT_REASON = 'Unknown reason: %{message}'.freeze
DEFAULT_REASON = 'Unknown reason: %{message}'
def generate_readable_error_message(options)
response = ERRORS_TO_REASONS.fetch(options[:message]) { DEFAULT_REASON }

View File

@ -45,7 +45,7 @@ module SupportHelpers
end
def like_error
"turnitin_data LIKE '%error%'".freeze
"turnitin_data LIKE '%error%'"
end
def object_type
@ -73,7 +73,7 @@ module SupportHelpers
end
def like_error
"turnitin_settings LIKE '%2305%'".freeze
"turnitin_settings LIKE '%2305%'"
end
def object_type
@ -93,7 +93,7 @@ module SupportHelpers
end
def like_error
"turnitin_settings LIKE '%MD5 not authenticated%'".freeze
"turnitin_settings LIKE '%MD5 not authenticated%'"
end
end
@ -269,7 +269,7 @@ module SupportHelpers
private
def like_error
"turnitin_data LIKE '--- \n:last_processed_attempt: _\n' OR turnitin_data LIKE '--- \n:last_processed_attempt: _\nattachment_________: \n :status: pending\n'".freeze
"turnitin_data LIKE '--- \n:last_processed_attempt: _\n' OR turnitin_data LIKE '--- \n:last_processed_attempt: _\nattachment_________: \n :status: pending\n'"
end
def load_broken_objects
@ -296,7 +296,7 @@ module SupportHelpers
end
def like_error
'turnitin_data LIKE E\'%:status: pending\n:status: error\n:assignment_error: !ruby/hash:ActiveSupport::HashWithIndifferentAccess\n error_code: 217%\''.freeze
'turnitin_data LIKE E\'%:status: pending\n:status: error\n:assignment_error: !ruby/hash:ActiveSupport::HashWithIndifferentAccess\n error_code: 217%\''
end
end
end

View File

@ -18,7 +18,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
class TokenScopes
OAUTH2_SCOPE_NAMESPACE = '/auth/'.freeze
OAUTH2_SCOPE_NAMESPACE = '/auth/'
USER_INFO_SCOPE = {
resource: :oauth2,
verb: "GET",
@ -28,28 +28,28 @@ class TokenScopes
CD2_SCOPE = {
resource: :peer_services,
verb: "GET",
scope: "cd2".freeze
scope: "cd2"
}.freeze
LTI_AGS_LINE_ITEM_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/lineitem".freeze
LTI_AGS_LINE_ITEM_READ_ONLY_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/lineitem.readonly".freeze
LTI_AGS_RESULT_READ_ONLY_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly".freeze
LTI_AGS_SCORE_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/score".freeze
LTI_AGS_SHOW_PROGRESS_SCOPE = "https://canvas.instructure.com/lti-ags/progress/scope/show".freeze
LTI_NRPS_V2_SCOPE = "https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly".freeze
LTI_UPDATE_PUBLIC_JWK_SCOPE = "https://canvas.instructure.com/lti/public_jwk/scope/update".freeze
LTI_ACCOUNT_LOOKUP_SCOPE = "https://canvas.instructure.com/lti/account_lookup/scope/show".freeze
LTI_CREATE_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/create".freeze
LTI_SHOW_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/show".freeze
LTI_UPDATE_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/update".freeze
LTI_LIST_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/list".freeze
LTI_DESTROY_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/destroy".freeze
LTI_LIST_EVENT_TYPES_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/list_event_types".freeze
LTI_SHOW_FEATURE_FLAG_SCOPE = "https://canvas.instructure.com/lti/feature_flags/scope/show".freeze
LTI_CREATE_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/create".freeze
LTI_DESTROY_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/destroy".freeze
LTI_LIST_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/list".freeze
LTI_SHOW_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/show".freeze
LTI_UPDATE_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/update".freeze
LTI_AGS_LINE_ITEM_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/lineitem"
LTI_AGS_LINE_ITEM_READ_ONLY_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/lineitem.readonly"
LTI_AGS_RESULT_READ_ONLY_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly"
LTI_AGS_SCORE_SCOPE = "https://purl.imsglobal.org/spec/lti-ags/scope/score"
LTI_AGS_SHOW_PROGRESS_SCOPE = "https://canvas.instructure.com/lti-ags/progress/scope/show"
LTI_NRPS_V2_SCOPE = "https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly"
LTI_UPDATE_PUBLIC_JWK_SCOPE = "https://canvas.instructure.com/lti/public_jwk/scope/update"
LTI_ACCOUNT_LOOKUP_SCOPE = "https://canvas.instructure.com/lti/account_lookup/scope/show"
LTI_CREATE_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/create"
LTI_SHOW_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/show"
LTI_UPDATE_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/update"
LTI_LIST_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/list"
LTI_DESTROY_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/destroy"
LTI_LIST_EVENT_TYPES_DATA_SERVICE_SUBSCRIPTION_SCOPE = "https://canvas.instructure.com/lti/data_services/scope/list_event_types"
LTI_SHOW_FEATURE_FLAG_SCOPE = "https://canvas.instructure.com/lti/feature_flags/scope/show"
LTI_CREATE_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/create"
LTI_DESTROY_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/destroy"
LTI_LIST_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/list"
LTI_SHOW_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/show"
LTI_UPDATE_ACCOUNT_EXTERNAL_TOOLS_SCOPE = "https://canvas.instructure.com/lti/account_external_tools/scope/update"
LTI_SCOPES = {
LTI_AGS_LINE_ITEM_SCOPE => I18n.t("Can create and view assignment data in the gradebook associated with the tool."),
LTI_AGS_LINE_ITEM_READ_ONLY_SCOPE => I18n.t("Can view assignment data in the gradebook associated with the tool."),

View File

@ -18,8 +18,8 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
class PactApiConsumerProxy
AUTH_HEADER = 'HTTP_AUTHORIZATION'.freeze
USER_HEADER = 'HTTP_AUTH_USER'.freeze
AUTH_HEADER = 'HTTP_AUTHORIZATION'
USER_HEADER = 'HTTP_AUTH_USER'
def call(env)
# Users calling the API will know the user name of the

View File

@ -19,7 +19,7 @@
module Factories
class GradingPeriodGroupHelper
TITLE = "Example Grading Period Group".freeze
TITLE = "Example Grading Period Group"
def valid_attributes(attr = {})
{

View File

@ -25,20 +25,20 @@ module Gradebook
extend SeleniumDependencies
# Student Headings
STUDENT_COLUMN_MENU_SELECTOR = '.container_0 .Gradebook__ColumnHeaderAction'.freeze
STUDENT_COLUMN_MENU_SELECTOR = '.container_0 .Gradebook__ColumnHeaderAction'
# Gradebook Menu
GRADEBOOK_MENU_SELECTOR = '[data-component="GradebookMenu"]'.freeze
INDIVIDUAL_VIEW_ITEM_SELECTOR = 'individual-gradebook'.freeze
GRADE_HISTORY_ITEM_SELECTOR = 'gradebook-history'.freeze
LEARING_MASTERY_ITEM_SELECTOR = 'learning-mastery'.freeze
GRADEBOOK_MENU_SELECTOR = '[data-component="GradebookMenu"]'
INDIVIDUAL_VIEW_ITEM_SELECTOR = 'individual-gradebook'
GRADE_HISTORY_ITEM_SELECTOR = 'gradebook-history'
LEARING_MASTERY_ITEM_SELECTOR = 'learning-mastery'
# Action Menu
ACTION_MENU_SELECTOR = '[data-component="ActionMenu"]'.freeze
ACTION_MENU_ITEM_SELECTOR = 'body [data-menu-id="%s"]'.freeze
ACTION_MENU_SELECTOR = '[data-component="ActionMenu"]'
ACTION_MENU_ITEM_SELECTOR = 'body [data-menu-id="%s"]'
# Menu Items
MENU_ITEM_SELECTOR = 'span[data-menu-item-id="%s"]'.freeze
MENU_ITEM_SELECTOR = 'span[data-menu-item-id="%s"]'
def self.gradebook_settings_cog
f('#gradebook-settings-button')

View File

@ -20,12 +20,12 @@
require_relative '../common'
module AdminSettingsCommon
SIS_SYNC_ID = "#account_settings_sis_syncing_value".freeze
SIS_IMPORT_ID = "#account_allow_sis_import".freeze
DUE_DATE_REQUIRED_CHECKBOX_ID = "#account_settings_sis_require_assignment_due_date_value".freeze
NAME_LENGTH_ID = "#account_settings_sis_assignment_name_length_value".freeze
NAME_LENGTH_VALUE_ID = "#account_settings_sis_assignment_name_length_input_value".freeze
DEFAULT_SIS = "#account_settings_sis_default_grade_export_value".freeze
SIS_SYNC_ID = "#account_settings_sis_syncing_value"
SIS_IMPORT_ID = "#account_allow_sis_import"
DUE_DATE_REQUIRED_CHECKBOX_ID = "#account_settings_sis_require_assignment_due_date_value"
NAME_LENGTH_ID = "#account_settings_sis_assignment_name_length_value"
NAME_LENGTH_VALUE_ID = "#account_settings_sis_assignment_name_length_input_value"
DEFAULT_SIS = "#account_settings_sis_default_grade_export_value"
def turn_on_sis_settings(account)
account.set_feature_flag! 'post_grades', 'on'

View File

@ -21,9 +21,9 @@ module DifferentiatedAssignments
module HomeworkAssignee
module Group
BASE = 'Group'
GROUP_X = "#{BASE} A".freeze
GROUP_Y = "#{BASE} B".freeze
GROUP_Z = "#{BASE} C".freeze
GROUP_X = "#{BASE} A"
GROUP_Y = "#{BASE} B"
GROUP_Z = "#{BASE} C"
ALL = Group.constants.map { |c| Group.const_get(c) }
.reject { |c| c == Group::BASE }
.freeze
@ -31,9 +31,9 @@ module DifferentiatedAssignments
module Section
BASE = 'Section'
SECTION_A = "#{BASE} A".freeze
SECTION_B = "#{BASE} B".freeze
SECTION_C = "#{BASE} C".freeze
SECTION_A = "#{BASE} A"
SECTION_B = "#{BASE} B"
SECTION_C = "#{BASE} C"
ALL = Section.constants.map { |c| Section.const_get(c) }
.reject { |c| c == Section::BASE }
.freeze
@ -41,16 +41,16 @@ module DifferentiatedAssignments
module Student
BASE = 'Student'
FIRST_STUDENT = "#{BASE} 1".freeze
SECOND_STUDENT = "#{BASE} 2".freeze
THIRD_STUDENT = "#{BASE} 3".freeze
FOURTH_STUDENT = "#{BASE} 4".freeze
FIRST_STUDENT = "#{BASE} 1"
SECOND_STUDENT = "#{BASE} 2"
THIRD_STUDENT = "#{BASE} 3"
FOURTH_STUDENT = "#{BASE} 4"
ALL = Student.constants.map { |c| Student.const_get(c) }
.reject { |c| c == Student::BASE }
.freeze
end
EVERYONE = 'Everyone'.freeze
EVERYONE = 'Everyone'
ALL = HomeworkAssignee.constants.map { |c| HomeworkAssignee.const_get(c) }
ASSIGNEES = [

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