Commit d882fac5 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Rename `include_if_ee` to `include_mod_with`

parent 7914849d
......@@ -384,4 +384,4 @@ module GitlabRoutingHelper
end
end
GitlabRoutingHelper.include_if_ee('EE::GitlabRoutingHelper')
GitlabRoutingHelper.include_mod_with('EE::GitlabRoutingHelper')
......@@ -328,4 +328,4 @@ module SortingTitlesValuesHelper
end
end
SortingHelper.include_if_ee('::EE::SortingTitlesValuesHelper')
SortingHelper.include_mod_with('::EE::SortingTitlesValuesHelper')
......@@ -53,7 +53,7 @@ module ProtectedRefAccess
end
end
ProtectedRefAccess.include_if_ee('EE::ProtectedRefAccess::Scopes')
ProtectedRefAccess.include_mod_with('EE::ProtectedRefAccess::Scopes')
ProtectedRefAccess.prepend_mod_with('EE::ProtectedRefAccess')
# When using `prepend` (or `include` for that matter), the `ClassMethods`
......
......@@ -53,4 +53,4 @@ module MergeRequests
end
end
MergeRequests::CreateService.include_if_ee('EE::MergeRequests::CreateService')
MergeRequests::CreateService.include_mod_with('EE::MergeRequests::CreateService')
......@@ -508,4 +508,4 @@ module ObjectStorage
end
end
ObjectStorage::Concern.include_if_ee('::EE::ObjectStorage::Concern')
ObjectStorage::Concern.include_mod_with('::EE::ObjectStorage::Concern')
......@@ -17,7 +17,7 @@ module InjectEnterpriseEditionModule
&method(:extend))
end
def include_if_ee(constant_with_prefix, namespace: Object)
def include_mod_with(constant_with_prefix, namespace: Object)
each_extension_for(
constant_without_prefix(constant_with_prefix),
namespace,
......
......@@ -114,7 +114,7 @@ Vulnerabilities::Finding.prepend_ee_mod
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
by using `prepend_mod_with`, `extend_mod_with`, or `include_if_ee`. These methods take a
by using `prepend_mod_with`, `extend_mod_with`, or `include_mod_with`. These methods take a
_String_ containing the full module name as the argument, not the module itself, like so;
```ruby
......
......@@ -73,4 +73,4 @@ module EE
end
end
EE::MergeRequestPresenter.include_if_ee('::EE::ProjectsHelper')
EE::MergeRequestPresenter.include_mod_with('::EE::ProjectsHelper')
......@@ -56,4 +56,4 @@ class Vulnerabilities::FindingEntity < Grape::Entity
end
end
Vulnerabilities::FindingEntity.include_if_ee('::EE::ProjectsHelper')
Vulnerabilities::FindingEntity.include_mod_with('::EE::ProjectsHelper')
......@@ -9,12 +9,12 @@ module RuboCop
', outside of any class or module definitions'
DISALLOWED_METHOD =
'EE modules must be injected using `include_if_ee`, `extend_mod_with`, or `prepend_mod_with`'
'EE modules must be injected using `include_mod_with`, `extend_mod_with`, or `prepend_mod_with`'
INVALID_ARGUMENT = 'EE modules to inject must be specified as a String'
CHECK_LINE_METHODS =
Set.new(%i[include_if_ee extend_mod_with prepend_mod_with]).freeze
Set.new(%i[include_mod_with extend_mod_with prepend_mod_with]).freeze
DISALLOW_METHODS = Set.new(%i[include extend prepend]).freeze
......
......@@ -123,7 +123,7 @@ RSpec.describe InjectEnterpriseEditionModule do
it_behaves_like 'expand the extension with', :extend
end
describe '#include_if_ee' do
describe '#include_mod_with' do
it_behaves_like 'expand the extension with', :include
end
......
......@@ -68,19 +68,19 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
end
it 'flags the use of `include_if_ee EE` in the middle of a file' do
it 'flags the use of `include_mod_with EE` in the middle of a file' do
expect_offense(<<~SOURCE)
class Foo
include_if_ee 'EE::Foo'
include_mod_with 'EE::Foo'
^^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
end
SOURCE
end
it 'flags the use of `include_if_ee ::EE` in the middle of a file' do
it 'flags the use of `include_mod_with ::EE` in the middle of a file' do
expect_offense(<<~SOURCE)
class Foo
include_if_ee '::EE::Foo'
include_mod_with '::EE::Foo'
^^^^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
end
SOURCE
......@@ -115,7 +115,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
it 'does not flag including of regular modules' do
expect_no_offenses(<<~SOURCE)
class Foo
include_if_ee 'Foo'
include_mod_with 'Foo'
end
SOURCE
end
......@@ -137,12 +137,12 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
end
it 'does not flag the use of `include_if_ee EE` on the last line' do
it 'does not flag the use of `include_mod_with EE` on the last line' do
expect_no_offenses(<<~SOURCE)
class Foo
end
Foo.include_if_ee('EE::Foo')
Foo.include_mod_with('EE::Foo')
SOURCE
end
......@@ -161,7 +161,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
Foo.extend_mod_with('EE::Foo')
Foo.include_if_ee('EE::Foo')
Foo.include_mod_with('EE::Foo')
Foo.prepend_mod_with('EE::Foo')
SOURCE
end
......@@ -171,7 +171,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
class Foo
end
Foo.include_if_ee('EE::Foo')
Foo.include_mod_with('EE::Foo')
Foo.prepend_mod_with('EE::Foo')
Foo.include(Bar)
......@@ -185,14 +185,14 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
class Foo
prepend_mod_with 'EE::Foo'
^^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
include_if_ee 'Bar'
include_mod_with 'Bar'
end
SOURCE
expect_correction(<<~SOURCE)
class Foo
prepend_mod_with 'EE::Foo' # rubocop: disable Cop/InjectEnterpriseEditionModule
include_if_ee 'Bar'
include_mod_with 'Bar'
end
SOURCE
end
......@@ -203,7 +203,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
Foo.prepend(EE::Foo)
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_mod_with`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_mod_with`, `extend_mod_with`, or `prepend_mod_with`
SOURCE
end
......@@ -213,7 +213,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
Foo.prepend(QA::EE::Foo)
^^^^^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_mod_with`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_mod_with`, `extend_mod_with`, or `prepend_mod_with`
SOURCE
end
......@@ -223,7 +223,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
Foo.extend(EE::Foo)
^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_mod_with`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_mod_with`, `extend_mod_with`, or `prepend_mod_with`
SOURCE
end
......@@ -233,7 +233,7 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
end
Foo.include(EE::Foo)
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_mod_with`, or `prepend_mod_with`
^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_mod_with`, `extend_mod_with`, or `prepend_mod_with`
SOURCE
end
......@@ -247,12 +247,12 @@ RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
end
it 'disallows the use of include_if_ee without a String' do
it 'disallows the use of include_mod_with without a String' do
expect_offense(<<~SOURCE)
class Foo
end
Foo.include_if_ee(EE::Foo)
Foo.include_mod_with(EE::Foo)
^^^^^^^ EE modules to inject must be specified as a String
SOURCE
end
......
......@@ -71,4 +71,4 @@ module LdapHelpers
end
end
LdapHelpers.include_if_ee('EE::LdapHelpers')
LdapHelpers.include_mod_with('EE::LdapHelpers')
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