Commit 1305663c authored by Thong Kuah's avatar Thong Kuah

Auto-correct ee const_get offenses

parent 3a884228
...@@ -22,7 +22,7 @@ module EE ...@@ -22,7 +22,7 @@ module EE
validates :"#{type}_access_levels", length: { is: 1 }, if: -> { false } validates :"#{type}_access_levels", length: { is: 1 }, if: -> { false }
# Returns access levels that grant the specified access type to the given user / group. # Returns access levels that grant the specified access type to the given user / group.
access_level_class = const_get("#{type}_access_level".classify) access_level_class = const_get("#{type}_access_level".classify, false)
protected_type = self.model_name.singular protected_type = self.model_name.singular
scope( scope(
:"#{type}_access_by_user", :"#{type}_access_by_user",
......
...@@ -4,7 +4,7 @@ module EE ...@@ -4,7 +4,7 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
EE_CALLOUT_FAILURE_MESSAGES = const_get(:CALLOUT_FAILURE_MESSAGES).merge( EE_CALLOUT_FAILURE_MESSAGES = const_get(:CALLOUT_FAILURE_MESSAGES, false).merge(
protected_environment_failure: 'The environment this job is deploying to is protected. Only users with permission may successfully run this job.', protected_environment_failure: 'The environment this job is deploying to is protected. Only users with permission may successfully run this job.',
insufficient_bridge_permissions: 'This job could not be executed because of insufficient permissions to create a downstream pipeline.', insufficient_bridge_permissions: 'This job could not be executed because of insufficient permissions to create a downstream pipeline.',
insufficient_upstream_permissions: 'This job could not be executed because of insufficient permissions to track the upstream project.', insufficient_upstream_permissions: 'This job could not be executed because of insufficient permissions to track the upstream project.',
......
...@@ -7,7 +7,7 @@ module EE ...@@ -7,7 +7,7 @@ module EE
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
prepended do prepended do
EE_UPDATE_SERVICES = const_get(:UPDATE_SERVICES).merge( EE_UPDATE_SERVICES = const_get(:UPDATE_SERVICES, false).merge(
'Epic' => Epics::UpdateService 'Epic' => Epics::UpdateService
).freeze ).freeze
EE::Notes::QuickActionsService.private_constant :EE_UPDATE_SERVICES EE::Notes::QuickActionsService.private_constant :EE_UPDATE_SERVICES
......
...@@ -9,7 +9,7 @@ module EE ...@@ -9,7 +9,7 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
EE_TYPES = const_get(:TYPES) + [::EE::Gitlab::Ci::Config::Entry::Bridge] EE_TYPES = const_get(:TYPES, false) + [::EE::Gitlab::Ci::Config::Entry::Bridge]
end end
class_methods do class_methods do
......
...@@ -9,7 +9,7 @@ module EE ...@@ -9,7 +9,7 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
EE_REASONS = const_get(:REASONS).merge( EE_REASONS = const_get(:REASONS, false).merge(
protected_environment_failure: 'protected environment failure', protected_environment_failure: 'protected environment failure',
invalid_bridge_trigger: 'downstream pipeline trigger definition is invalid', invalid_bridge_trigger: 'downstream pipeline trigger definition is invalid',
downstream_bridge_project_not_found: 'downstream project could not be found', downstream_bridge_project_not_found: 'downstream project could not be found',
......
...@@ -9,7 +9,7 @@ module Elastic ...@@ -9,7 +9,7 @@ module Elastic
def initialize(target) def initialize(target)
super(target) super(target)
config = version_namespace.const_get('Config') config = version_namespace.const_get('Config', false)
@index_name = config.index_name @index_name = config.index_name
@document_type = config.document_type @document_type = config.document_type
......
...@@ -9,7 +9,7 @@ module Elastic ...@@ -9,7 +9,7 @@ module Elastic
def initialize(target) def initialize(target)
super(target) super(target)
config = version_namespace.const_get('Config') config = version_namespace.const_get('Config', false)
@index_name = config.index_name @index_name = config.index_name
@document_type = config.document_type @document_type = config.document_type
......
...@@ -12,8 +12,8 @@ module Elastic ...@@ -12,8 +12,8 @@ module Elastic
# @params version [String, Module] can be a string "V12p1" or module (Elastic::V12p1) # @params version [String, Module] can be a string "V12p1" or module (Elastic::V12p1)
def version(version) def version(version)
version = Elastic.const_get(version) if version.is_a?(String) version = Elastic.const_get(version, false) if version.is_a?(String)
version.const_get(proxy_class_name).new(data_target) version.const_get(proxy_class_name, false).new(data_target)
end end
private private
......
...@@ -159,7 +159,7 @@ describe 'GlobalSearch', :elastic do ...@@ -159,7 +159,7 @@ describe 'GlobalSearch', :elastic do
# access_level can be :disabled, :enabled or :private # access_level can be :disabled, :enabled or :private
def feature_settings(access_level) def feature_settings(access_level)
Hash[features.collect { |k| ["#{k}_access_level", ProjectFeature.const_get(access_level.to_s.upcase)] }] Hash[features.collect { |k| ["#{k}_access_level", ProjectFeature.const_get(access_level.to_s.upcase, false)] }]
end end
def expect_no_items_to_be_found(user) def expect_no_items_to_be_found(user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment