Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7914849d
Commit
7914849d
authored
May 05, 2021
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `extend_if_ee` to `extend_mod_with`
parent
52685fea
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
26 additions
and
26 deletions
+26
-26
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+1
-1
app/helpers/auth_helper.rb
app/helpers/auth_helper.rb
+1
-1
app/helpers/services_helper.rb
app/helpers/services_helper.rb
+1
-1
app/helpers/system_note_helper.rb
app/helpers/system_note_helper.rb
+1
-1
config/initializers/0_inject_enterprise_edition_module.rb
config/initializers/0_inject_enterprise_edition_module.rb
+1
-1
doc/development/ee_features.md
doc/development/ee_features.md
+1
-1
ee/app/services/ee/system_note_service.rb
ee/app/services/ee/system_note_service.rb
+1
-1
qa/qa/runtime/env.rb
qa/qa/runtime/env.rb
+1
-1
rubocop/cop/inject_enterprise_edition_module.rb
rubocop/cop/inject_enterprise_edition_module.rb
+2
-2
spec/config/inject_enterprise_edition_module_spec.rb
spec/config/inject_enterprise_edition_module_spec.rb
+1
-1
spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
+14
-14
spec/support/helpers/test_env.rb
spec/support/helpers/test_env.rb
+1
-1
No files found.
app/helpers/application_settings_helper.rb
View file @
7914849d
...
@@ -442,4 +442,4 @@ ApplicationSettingsHelper.prepend_mod_with('EE::ApplicationSettingsHelper')
...
@@ -442,4 +442,4 @@ ApplicationSettingsHelper.prepend_mod_with('EE::ApplicationSettingsHelper')
# The methods in `EE::ApplicationSettingsHelper` should be available as both
# The methods in `EE::ApplicationSettingsHelper` should be available as both
# instance and class methods.
# instance and class methods.
ApplicationSettingsHelper
.
extend_
if_ee
(
'EE::ApplicationSettingsHelper'
)
ApplicationSettingsHelper
.
extend_
mod_with
(
'EE::ApplicationSettingsHelper'
)
app/helpers/auth_helper.rb
View file @
7914849d
...
@@ -195,4 +195,4 @@ AuthHelper.prepend_mod_with('EE::AuthHelper')
...
@@ -195,4 +195,4 @@ AuthHelper.prepend_mod_with('EE::AuthHelper')
# The methods added in EE should be available as both class and instance
# The methods added in EE should be available as both class and instance
# methods, just like the methods provided by `AuthHelper` itself.
# methods, just like the methods provided by `AuthHelper` itself.
AuthHelper
.
extend_
if_ee
(
'EE::AuthHelper'
)
AuthHelper
.
extend_
mod_with
(
'EE::AuthHelper'
)
app/helpers/services_helper.rb
View file @
7914849d
...
@@ -182,4 +182,4 @@ ServicesHelper.prepend_mod_with('EE::ServicesHelper')
...
@@ -182,4 +182,4 @@ ServicesHelper.prepend_mod_with('EE::ServicesHelper')
# The methods in `EE::ServicesHelper` should be available as both instance and
# The methods in `EE::ServicesHelper` should be available as both instance and
# class methods.
# class methods.
ServicesHelper
.
extend_
if_ee
(
'EE::ServicesHelper'
)
ServicesHelper
.
extend_
mod_with
(
'EE::ServicesHelper'
)
app/helpers/system_note_helper.rb
View file @
7914849d
...
@@ -58,4 +58,4 @@ SystemNoteHelper.prepend_mod_with('EE::SystemNoteHelper')
...
@@ -58,4 +58,4 @@ SystemNoteHelper.prepend_mod_with('EE::SystemNoteHelper')
# The methods in `EE::SystemNoteHelper` should be available as both instance and
# The methods in `EE::SystemNoteHelper` should be available as both instance and
# class methods.
# class methods.
SystemNoteHelper
.
extend_
if_ee
(
'EE::SystemNoteHelper'
)
SystemNoteHelper
.
extend_
mod_with
(
'EE::SystemNoteHelper'
)
config/initializers/0_inject_enterprise_edition_module.rb
View file @
7914849d
...
@@ -10,7 +10,7 @@ module InjectEnterpriseEditionModule
...
@@ -10,7 +10,7 @@ module InjectEnterpriseEditionModule
with_descendants:
with_descendants
)
with_descendants:
with_descendants
)
end
end
def
extend_
if_ee
(
constant_with_prefix
,
namespace:
Object
)
def
extend_
mod_with
(
constant_with_prefix
,
namespace:
Object
)
each_extension_for
(
each_extension_for
(
constant_without_prefix
(
constant_with_prefix
),
constant_without_prefix
(
constant_with_prefix
),
namespace
,
namespace
,
...
...
doc/development/ee_features.md
View file @
7914849d
...
@@ -114,7 +114,7 @@ Vulnerabilities::Finding.prepend_ee_mod
...
@@ -114,7 +114,7 @@ Vulnerabilities::Finding.prepend_ee_mod
will prepend the module named
`::EE::Vulnerabilities::Finding`
.
will prepend the module named
`::EE::Vulnerabilities::Finding`
.
If the extending module does not follow this naming convention, you can also provide the module name
If the extending module does not follow this naming convention, you can also provide the module name
by using
`prepend_mod_with`
,
`extend_
if_ee
`
, or
`include_if_ee`
. These methods take a
by using
`prepend_mod_with`
,
`extend_
mod_with
`
, or
`include_if_ee`
. These methods take a
_String_
containing the full module name as the argument, not the module itself, like so;
_String_
containing the full module name as the argument, not the module itself, like so;
```
ruby
```
ruby
...
...
ee/app/services/ee/system_note_service.rb
View file @
7914849d
...
@@ -13,7 +13,7 @@ module EE
...
@@ -13,7 +13,7 @@ module EE
# ::SystemNoteService wants the methods to be available as both class and
# ::SystemNoteService wants the methods to be available as both class and
# instance methods. This removes the need for having to both `include` and
# instance methods. This removes the need for having to both `include` and
# `extend` this module everywhere it is used.
# `extend` this module everywhere it is used.
extend_
if_ee
(
'EE::SystemNoteService'
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
extend_
mod_with
(
'EE::SystemNoteService'
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
end
end
def
epic_issue
(
epic
,
issue
,
user
,
type
)
def
epic_issue
(
epic
,
issue
,
user
,
type
)
...
...
qa/qa/runtime/env.rb
View file @
7914849d
...
@@ -403,4 +403,4 @@ module QA
...
@@ -403,4 +403,4 @@ module QA
end
end
end
end
QA
::
Runtime
::
Env
.
extend_
if_ee
(
'Runtime::Env'
,
namespace:
QA
)
QA
::
Runtime
::
Env
.
extend_
mod_with
(
'Runtime::Env'
,
namespace:
QA
)
rubocop/cop/inject_enterprise_edition_module.rb
View file @
7914849d
...
@@ -9,12 +9,12 @@ module RuboCop
...
@@ -9,12 +9,12 @@ module RuboCop
', outside of any class or module definitions'
', outside of any class or module definitions'
DISALLOWED_METHOD
=
DISALLOWED_METHOD
=
'EE modules must be injected using `include_if_ee`, `extend_
if_ee
`, or `prepend_mod_with`'
'EE modules must be injected using `include_if_ee`, `extend_
mod_with
`, or `prepend_mod_with`'
INVALID_ARGUMENT
=
'EE modules to inject must be specified as a String'
INVALID_ARGUMENT
=
'EE modules to inject must be specified as a String'
CHECK_LINE_METHODS
=
CHECK_LINE_METHODS
=
Set
.
new
(
%i[include_if_ee extend_
if_ee
prepend_mod_with]
).
freeze
Set
.
new
(
%i[include_if_ee extend_
mod_with
prepend_mod_with]
).
freeze
DISALLOW_METHODS
=
Set
.
new
(
%i[include extend prepend]
).
freeze
DISALLOW_METHODS
=
Set
.
new
(
%i[include extend prepend]
).
freeze
...
...
spec/config/inject_enterprise_edition_module_spec.rb
View file @
7914849d
...
@@ -119,7 +119,7 @@ RSpec.describe InjectEnterpriseEditionModule do
...
@@ -119,7 +119,7 @@ RSpec.describe InjectEnterpriseEditionModule do
it_behaves_like
'expand the extension with'
,
:prepend
it_behaves_like
'expand the extension with'
,
:prepend
end
end
describe
'#extend_
if_ee
'
do
describe
'#extend_
mod_with
'
do
it_behaves_like
'expand the extension with'
,
:extend
it_behaves_like
'expand the extension with'
,
:extend
end
end
...
...
spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
View file @
7914849d
...
@@ -86,19 +86,19 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -86,19 +86,19 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
SOURCE
end
end
it
'flags the use of `extend_
if_ee
EE` in the middle of a file'
do
it
'flags the use of `extend_
mod_with
EE` in the middle of a file'
do
expect_offense
(
<<~
SOURCE
)
expect_offense
(
<<~
SOURCE
)
class Foo
class Foo
extend_
if_ee
'EE::Foo'
extend_
mod_with
'EE::Foo'
^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
end
end
SOURCE
SOURCE
end
end
it
'flags the use of `extend_
if_ee
::EE` in the middle of a file'
do
it
'flags the use of `extend_
mod_with
::EE` in the middle of a file'
do
expect_offense
(
<<~
SOURCE
)
expect_offense
(
<<~
SOURCE
)
class Foo
class Foo
extend_
if_ee
'::EE::Foo'
extend_
mod_with
'::EE::Foo'
^^^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
^^^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
end
end
SOURCE
SOURCE
...
@@ -123,7 +123,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -123,7 +123,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
it
'does not flag extending using regular modules'
do
it
'does not flag extending using regular modules'
do
expect_no_offenses
(
<<~
SOURCE
)
expect_no_offenses
(
<<~
SOURCE
)
class Foo
class Foo
extend_
if_ee
'Foo'
extend_
mod_with
'Foo'
end
end
SOURCE
SOURCE
end
end
...
@@ -146,12 +146,12 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -146,12 +146,12 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
SOURCE
end
end
it
'does not flag the use of `extend_
if_ee
EE` on the last line'
do
it
'does not flag the use of `extend_
mod_with
EE` on the last line'
do
expect_no_offenses
(
<<~
SOURCE
)
expect_no_offenses
(
<<~
SOURCE
)
class Foo
class Foo
end
end
Foo.extend_
if_ee
('EE::Foo')
Foo.extend_
mod_with
('EE::Foo')
SOURCE
SOURCE
end
end
...
@@ -160,7 +160,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -160,7 +160,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
class Foo
class Foo
end
end
Foo.extend_
if_ee
('EE::Foo')
Foo.extend_
mod_with
('EE::Foo')
Foo.include_if_ee('EE::Foo')
Foo.include_if_ee('EE::Foo')
Foo.prepend_mod_with('EE::Foo')
Foo.prepend_mod_with('EE::Foo')
SOURCE
SOURCE
...
@@ -203,7 +203,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -203,7 +203,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
end
Foo.prepend(EE::Foo)
Foo.prepend(EE::Foo)
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
if_ee
`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
mod_with
`, or `prepend_mod_with`
SOURCE
SOURCE
end
end
...
@@ -213,7 +213,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -213,7 +213,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
end
Foo.prepend(QA::EE::Foo)
Foo.prepend(QA::EE::Foo)
^^^^^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
if_ee
`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
mod_with
`, or `prepend_mod_with`
SOURCE
SOURCE
end
end
...
@@ -223,7 +223,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -223,7 +223,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
end
Foo.extend(EE::Foo)
Foo.extend(EE::Foo)
^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
if_ee
`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
mod_with
`, or `prepend_mod_with`
SOURCE
SOURCE
end
end
...
@@ -233,7 +233,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -233,7 +233,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
end
Foo.include(EE::Foo)
Foo.include(EE::Foo)
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
if_ee
`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_
mod_with
`, or `prepend_mod_with`
SOURCE
SOURCE
end
end
...
@@ -257,12 +257,12 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
...
@@ -257,12 +257,12 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
SOURCE
end
end
it
'disallows the use of extend_
if_ee
without a String'
do
it
'disallows the use of extend_
mod_with
without a String'
do
expect_offense
(
<<~
SOURCE
)
expect_offense
(
<<~
SOURCE
)
class Foo
class Foo
end
end
Foo.extend_
if_ee
(EE::Foo)
Foo.extend_
mod_with
(EE::Foo)
^^^^^^^ EE modules to inject must be specified as a String
^^^^^^^ EE modules to inject must be specified as a String
SOURCE
SOURCE
end
end
...
...
spec/support/helpers/test_env.rb
View file @
7914849d
...
@@ -613,4 +613,4 @@ end
...
@@ -613,4 +613,4 @@ end
require_relative
(
'../../../ee/spec/support/helpers/ee/test_env'
)
if
Gitlab
.
ee?
require_relative
(
'../../../ee/spec/support/helpers/ee/test_env'
)
if
Gitlab
.
ee?
::
TestEnv
.
prepend_mod_with
(
'::EE::TestEnv'
)
::
TestEnv
.
prepend_mod_with
(
'::EE::TestEnv'
)
::
TestEnv
.
extend_
if_ee
(
'::EE::TestEnv'
)
::
TestEnv
.
extend_
mod_with
(
'::EE::TestEnv'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment