Открыть боковую панель
nt_test121
nt_project_9da4a5yt9x4b
Коммиты
9ff86452
Коммит
9ff86452
создал
Май 20, 2019
по автору
Thong Kuah
Просмотр файлов
Address ConstGetInheritFalse violations
There should be no cases where we need to inherit=true.
владелец
df3c259d
Изменения
38
Скрыть пробелы
Построчно
Рядом
app/models/clusters/concerns/application_version.rb
Просмотр файла @
9ff86452
...
...
@@ -8,13 +8,13 @@ module ApplicationVersion
included
do
state_machine
:status
do
before_transition
any
=>
[
:installed
,
:updated
]
do
|
application
|
application
.
version
=
application
.
class
.
const_get
(
:VERSION
)
application
.
version
=
application
.
class
.
const_get
(
:VERSION
,
false
)
end
end
end
def
update_available?
version
!=
self
.
class
.
const_get
(
:VERSION
)
version
!=
self
.
class
.
const_get
(
:VERSION
,
false
)
end
end
end
...
...
app/models/concerns/prometheus_adapter.rb
Просмотр файла @
9ff86452
...
...
@@ -42,7 +42,7 @@ def calculate_reactive_cache(query_class_name, *args)
end
def
query_klass_for
(
query_name
)
Gitlab
::
Prometheus
::
Queries
.
const_get
(
"
#{
query_name
.
to_s
.
classify
}
Query"
)
Gitlab
::
Prometheus
::
Queries
.
const_get
(
"
#{
query_name
.
to_s
.
classify
}
Query"
,
false
)
end
def
build_query_args
(
*
args
)
...
...
app/models/note.rb
Просмотр файла @
9ff86452
...
...
@@ -25,7 +25,7 @@ module SpecialRole
class
<<
self
def
values
constants
.
map
{
|
const
|
self
.
const_get
(
const
)}
constants
.
map
{
|
const
|
self
.
const_get
(
const
,
false
)}
end
def
value?
(
val
)
...
...
app/models/upload.rb
Просмотр файла @
9ff86452
...
...
@@ -114,7 +114,7 @@ def relative_path?
end
def
uploader_class
Object
.
const_get
(
uploader
)
Object
.
const_get
(
uploader
,
false
)
end
def
identifier
...
...
config/initializers/fog_core_patch.rb
Просмотр файла @
9ff86452
...
...
@@ -34,6 +34,7 @@ module ServicesMixin
# Gems that have not yet updated with the new fog-core namespace
LEGACY_FOG_PROVIDERS
=
%w(google rackspace aliyun)
.
freeze
# rubocop:disable Cop/ConstGetInheritFalse
def
service_provider_constant
(
service_name
,
provider_name
)
args
=
service_provider_search_args
(
service_name
,
provider_name
)
Fog
.
const_get
(
args
.
first
).
const_get
(
*
const_get_args
(
args
.
second
))
...
...
@@ -48,5 +49,6 @@ def service_provider_search_args(service_name, provider_name)
[
provider_name
,
service_name
]
end
end
# rubocop:enable Cop/ConstGetInheritFalse
end
end
config/initializers/zz_metrics.rb
Просмотр файла @
9ff86452
...
...
@@ -13,7 +13,7 @@ def instrument_classes(instrumentation)
instrumentation
.
instrument_methods
(
Gitlab
::
Git
)
Gitlab
::
Git
.
constants
.
each
do
|
name
|
const
=
Gitlab
::
Git
.
const_get
(
name
)
const
=
Gitlab
::
Git
.
const_get
(
name
,
false
)
next
unless
const
.
is_a?
(
Module
)
...
...
@@ -75,7 +75,7 @@ def instrument_classes(instrumentation)
instrumentation
.
instrument_instance_methods
(
Rouge
::
Formatters
::
HTMLGitlab
)
[
:XML
,
:HTML
].
each
do
|
namespace
|
namespace_mod
=
Nokogiri
.
const_get
(
namespace
)
namespace_mod
=
Nokogiri
.
const_get
(
namespace
,
false
)
instrumentation
.
instrument_methods
(
namespace_mod
)
instrumentation
.
instrument_methods
(
namespace_mod
::
Document
)
...
...
config/settings.rb
Просмотр файла @
9ff86452
...
...
@@ -104,10 +104,10 @@ def verify_constant_array(modul, current, default)
# check that `current` (string or integer) is a contant in `modul`.
def
verify_constant
(
modul
,
current
,
default
)
constant
=
modul
.
constants
.
find
{
|
name
|
modul
.
const_get
(
name
)
==
current
}
value
=
constant
.
nil?
?
default
:
modul
.
const_get
(
constant
)
constant
=
modul
.
constants
.
find
{
|
name
|
modul
.
const_get
(
name
,
false
)
==
current
}
value
=
constant
.
nil?
?
default
:
modul
.
const_get
(
constant
,
false
)
if
current
.
is_a?
String
value
=
modul
.
const_get
(
current
.
upcase
)
rescue
default
value
=
modul
.
const_get
(
current
.
upcase
,
false
)
rescue
default
end
value
...
...
lib/api/entities.rb
Просмотр файла @
9ff86452
...
...
@@ -978,7 +978,7 @@ class Todo < Grape::Entity
expose
:created_at
def
todo_target_class
(
target_type
)
::
API
::
Entities
.
const_get
(
target_type
)
::
API
::
Entities
.
const_get
(
target_type
,
false
)
end
end
...
...
lib/api/notes.rb
Просмотр файла @
9ff86452
...
...
@@ -80,7 +80,7 @@ class Notes < Grape::API
note
=
create_note
(
noteable
,
opts
)
if
note
.
valid?
present
note
,
with:
Entities
.
const_get
(
note
.
class
.
name
)
present
note
,
with:
Entities
.
const_get
(
note
.
class
.
name
,
false
)
else
bad_request!
(
"Note
#{
note
.
errors
.
messages
}
"
)
end
...
...
lib/api/todos.rb
Просмотр файла @
9ff86452
...
...
@@ -49,7 +49,7 @@ def find_todos
resource
:todos
do
helpers
do
def
issuable_and_awardable?
(
type
)
obj_type
=
Object
.
const_get
(
type
)
obj_type
=
Object
.
const_get
(
type
,
false
)
(
obj_type
<
Issuable
)
&&
(
obj_type
<
Awardable
)
rescue
NameError
...
...
lib/banzai/filter.rb
Просмотр файла @
9ff86452
...
...
@@ -3,7 +3,7 @@
module
Banzai
module
Filter
def
self
.
[]
(
name
)
const_get
(
"
#{
name
.
to_s
.
camelize
}
Filter"
)
const_get
(
"
#{
name
.
to_s
.
camelize
}
Filter"
,
false
)
end
end
end
lib/banzai/pipeline.rb
Просмотр файла @
9ff86452
...
...
@@ -4,7 +4,7 @@ module Banzai
module
Pipeline
def
self
.
[]
(
name
)
name
||=
:full
const_get
(
"
#{
name
.
to_s
.
camelize
}
Pipeline"
)
const_get
(
"
#{
name
.
to_s
.
camelize
}
Pipeline"
,
false
)
end
end
end
lib/banzai/reference_parser.rb
Просмотр файла @
9ff86452
...
...
@@ -10,7 +10,7 @@ module ReferenceParser
#
# This would return the `Banzai::ReferenceParser::IssueParser` class.
def
self
.
[]
(
name
)
const_get
(
"
#{
name
.
to_s
.
camelize
}
Parser"
)
const_get
(
"
#{
name
.
to_s
.
camelize
}
Parser"
,
false
)
end
end
end
lib/bitbucket/page.rb
Просмотр файла @
9ff86452
...
...
@@ -30,7 +30,7 @@ def parse_values(raw, bitbucket_rep_class)
end
def
representation_class
(
type
)
Bitbucket
::
Representation
.
const_get
(
type
.
to_s
.
camelize
)
Bitbucket
::
Representation
.
const_get
(
type
.
to_s
.
camelize
,
false
)
end
end
end
lib/bitbucket_server/page.rb
Просмотр файла @
9ff86452
...
...
@@ -30,7 +30,7 @@ def parse_values(raw, bitbucket_rep_class)
end
def
representation_class
(
type
)
BitbucketServer
::
Representation
.
const_get
(
type
.
to_s
.
camelize
)
BitbucketServer
::
Representation
.
const_get
(
type
.
to_s
.
camelize
,
false
)
end
end
end
lib/gitlab/background_migration.rb
Просмотр файла @
9ff86452
...
...
@@ -78,7 +78,7 @@ def self.retrying_jobs?(migration_class)
end
def
self
.
migration_class_for
(
class_name
)
const_get
(
class_name
)
const_get
(
class_name
,
false
)
end
def
self
.
enqueued_job?
(
queues
,
migration_class
)
...
...
lib/gitlab/cache/request_cache.rb
Просмотр файла @
9ff86452
...
...
@@ -23,7 +23,7 @@ def request_cache_key(&block)
end
def
request_cache
(
method_name
,
&
method_key_block
)
const_get
(
:RequestCacheExtension
).
module_eval
do
const_get
(
:RequestCacheExtension
,
false
).
module_eval
do
cache_key_method_name
=
"
#{
method_name
}
_cache_key"
define_method
(
method_name
)
do
|*
args
|
...
...
lib/gitlab/ci/build/policy.rb
Просмотр файла @
9ff86452
...
...
@@ -6,7 +6,7 @@ module Build
module
Policy
def
self
.
fabricate
(
specs
)
specifications
=
specs
.
to_h
.
map
do
|
spec
,
value
|
self
.
const_get
(
spec
.
to_s
.
camelize
).
new
(
value
)
self
.
const_get
(
spec
.
to_s
.
camelize
,
false
).
new
(
value
)
end
specifications
.
compact
...
...
lib/gitlab/ci/status/factory.rb
Просмотр файла @
9ff86452
...
...
@@ -20,7 +20,7 @@ def fabricate!
def
core_status
Gitlab
::
Ci
::
Status
.
const_get
(
@status
.
capitalize
)
.
const_get
(
@status
.
capitalize
,
false
)
.
new
(
@subject
,
@user
)
.
extend
(
self
.
class
.
common_helpers
)
end
...
...
lib/gitlab/config/entry/simplifiable.rb
Просмотр файла @
9ff86452
...
...
@@ -37,7 +37,7 @@ def self.strategies
def
self
.
entry_class
(
strategy
)
if
strategy
.
present?
self
.
const_get
(
strategy
.
name
)
self
.
const_get
(
strategy
.
name
,
false
)
else
self
::
UnknownStrategy
end
...
...
Пред
1
2
След
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать