Commit eeb999fb authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ee-fix-rubocop-ee-module-injection-detection' into 'master'

EE: Fix detecting nested EE constants in RuboCop

See merge request gitlab-org/gitlab-ee!9189
parents 21a5744c 22819272
......@@ -4,7 +4,7 @@
#
# Automatically sets the layout and ensures an administrator is logged in
class Admin::ApplicationController < ApplicationController
prepend EE::Admin::ApplicationController
prepend EE::Admin::ApplicationController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :authenticate_admin!
layout 'admin'
......
# frozen_string_literal: true
class Admin::DashboardController < Admin::ApplicationController
prepend ::EE::Admin::DashboardController
prepend ::EE::Admin::DashboardController # rubocop: disable Cop/InjectEnterpriseEditionModule
include CountHelper
......
# frozen_string_literal: true
class Admin::ProjectsController < Admin::ApplicationController
prepend EE::Admin::ProjectsController
prepend EE::Admin::ProjectsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include MembersPresentation
before_action :project, only: [:show, :transfer, :repository_check]
......
......@@ -2,7 +2,7 @@
module Boards
class ListsController < Boards::ApplicationController
prepend ::EE::Boards::ListsController
prepend ::EE::Boards::ListsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include BoardsResponses
......
# frozen_string_literal: true
class Import::GithubController < Import::BaseController
prepend ::EE::Import::GithubController
prepend ::EE::Import::GithubController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :verify_import_enabled
before_action :provider_auth, only: [:status, :jobs, :create]
......
# frozen_string_literal: true
class Projects::AutocompleteSourcesController < Projects::ApplicationController
prepend EE::Projects::AutocompleteSourcesController
prepend EE::Projects::AutocompleteSourcesController # rubocop: disable Cop/InjectEnterpriseEditionModule
def members
render json: ::Projects::ParticipantsService.new(@project, current_user).execute(target)
......
......@@ -15,7 +15,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
push_frontend_feature_flag(:area_chart, project)
end
prepend ::EE::Projects::EnvironmentsController
prepend ::EE::Projects::EnvironmentsController # rubocop: disable Cop/InjectEnterpriseEditionModule
def index
@environments = project.environments
......
......@@ -5,7 +5,7 @@
class Projects::GitHttpClientController < Projects::ApplicationController
include ActionController::HttpAuthentication::Basic
include KerberosSpnegoHelper
prepend ::EE::Projects::GitHttpClientController
prepend ::EE::Projects::GitHttpClientController # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :authentication_result, :redirected_path
......
......@@ -2,7 +2,7 @@
class Projects::GitHttpController < Projects::GitHttpClientController
include WorkhorseRequest
prepend ::EE::Projects::GitHttpController
prepend ::EE::Projects::GitHttpController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :access_check
......
......@@ -9,7 +9,7 @@ class Projects::IssuesController < Projects::ApplicationController
include IssuesCalendar
include SpammableActions
prepend ::EE::Projects::IssuesController
prepend ::EE::Projects::IssuesController # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.issue_except_actions
%i[index calendar new create bulk_update import_csv]
......
# frozen_string_literal: true
class Projects::MergeRequests::ApplicationController < Projects::ApplicationController
prepend ::EE::Projects::MergeRequests::ApplicationController
prepend ::EE::Projects::MergeRequests::ApplicationController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :check_merge_requests_available!
before_action :merge_request
......
# frozen_string_literal: true
class Projects::MergeRequests::DiffsController < Projects::MergeRequests::ApplicationController
prepend ::EE::Projects::MergeRequests::DiffsController
prepend ::EE::Projects::MergeRequests::DiffsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include DiffForPath
include DiffHelper
......
......@@ -8,7 +8,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
include ToggleAwardEmoji
include IssuableCollections
prepend ::EE::Projects::MergeRequestsController
prepend ::EE::Projects::MergeRequestsController # rubocop: disable Cop/InjectEnterpriseEditionModule
skip_before_action :merge_request, only: [:index, :bulk_update]
before_action :whitelist_query_limiting, only: [:assign_related_issues, :update]
......
# frozen_string_literal: true
class Projects::PipelinesController < Projects::ApplicationController
prepend ::EE::Projects::PipelinesController
prepend ::EE::Projects::PipelinesController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :whitelist_query_limiting, only: [:create, :retry]
before_action :pipeline, except: [:index, :new, :create, :charts]
......
......@@ -6,7 +6,7 @@ module Projects
before_action :authorize_admin_pipeline!
before_action :define_variables
prepend ::EE::Projects::Settings::CiCdController
prepend ::EE::Projects::Settings::CiCdController # rubocop: disable Cop/InjectEnterpriseEditionModule
def show
end
......
......@@ -6,7 +6,7 @@ module Projects
before_action :authorize_admin_project!
before_action :remote_mirror, only: [:show]
prepend ::EE::Projects::Settings::RepositoryController
prepend ::EE::Projects::Settings::RepositoryController # rubocop: disable Cop/InjectEnterpriseEditionModule
def show
render_show
......
# frozen_string_literal: true
class Projects::VariablesController < Projects::ApplicationController
prepend ::EE::Projects::VariablesController
prepend ::EE::Projects::VariablesController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :authorize_admin_build!
......
......@@ -51,7 +51,7 @@ module ProtectedRefAccess
end
end
ProtectedRefAccess.include(EE::ProtectedRefAccess::Scopes)
ProtectedRefAccess.include(EE::ProtectedRefAccess::Scopes) # rubocop: disable Cop/InjectEnterpriseEditionModule
ProtectedRefAccess.prepend(EE::ProtectedRefAccess) # rubocop: disable Cop/InjectEnterpriseEditionModule
# When using `prepend` (or `include` for that matter), the `ClassMethods`
......
......@@ -2,7 +2,7 @@
module ChatMessage
class MergeMessage < BaseMessage
prepend ::EE::ChatMessage::MergeMessage
prepend ::EE::ChatMessage::MergeMessage # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :merge_request_iid
attr_reader :source_branch
......
......@@ -2,7 +2,7 @@
module Applications
class CreateService
prepend ::EE::Applications::CreateService
prepend ::EE::Applications::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
# rubocop: disable CodeReuse/ActiveRecord
def initialize(current_user, params)
......
......@@ -3,7 +3,7 @@
module Boards
module Issues
class CreateService < Boards::BaseService
prepend ::EE::Boards::Issues::CreateService
prepend ::EE::Boards::Issues::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_accessor :project
......
......@@ -3,7 +3,7 @@
module Boards
module Lists
class ListService < Boards::BaseService
prepend ::EE::Boards::Lists::ListService
prepend ::EE::Boards::Lists::ListService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(board)
board.lists.create(list_type: :backlog) unless board.lists.backlog.exists?
......
......@@ -2,7 +2,7 @@
module Emails
class CreateService < ::Emails::BaseService
prepend ::EE::Emails::CreateService
prepend ::EE::Emails::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(extra_params = {})
skip_confirmation = @params.delete(:skip_confirmation)
......
......@@ -2,7 +2,7 @@
module Emails
class DestroyService < ::Emails::BaseService
prepend ::EE::Emails::DestroyService
prepend ::EE::Emails::DestroyService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(email)
email.destroy && update_secondary_emails!
......
......@@ -2,7 +2,7 @@
module Groups
class CreateService < Groups::BaseService
prepend ::EE::Groups::CreateService
prepend ::EE::Groups::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def initialize(user, params = {})
@current_user, @params = user, params.dup
......
......@@ -2,7 +2,7 @@
module Groups
class DestroyService < Groups::BaseService
prepend ::EE::Groups::DestroyService
prepend ::EE::Groups::DestroyService # rubocop: disable Cop/InjectEnterpriseEditionModule
DestroyError = Class.new(StandardError)
......
......@@ -3,7 +3,7 @@
module Groups
class UpdateService < Groups::BaseService
include UpdateVisibilityLevel
prepend ::EE::Groups::UpdateService
prepend ::EE::Groups::UpdateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute
reject_parent_id!
......
......@@ -3,7 +3,7 @@
module Issues
class BuildService < Issues::BaseService
include ResolveDiscussions
prepend ::EE::Issues::BuildService
prepend ::EE::Issues::BuildService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute
filter_resolve_discussion_params
......
......@@ -2,7 +2,7 @@
module Issues
class MoveService < Issuable::Clone::BaseService
prepend ::EE::Issues::MoveService
prepend ::EE::Issues::MoveService # rubocop: disable Cop/InjectEnterpriseEditionModule
MoveError = Class.new(StandardError)
......
......@@ -2,7 +2,7 @@
module MergeRequests
class UpdateService < MergeRequests::BaseService
prepend ::EE::MergeRequests::UpdateService
prepend ::EE::MergeRequests::UpdateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(merge_request)
# We don't allow change of source/target projects and source branch
......
......@@ -2,7 +2,7 @@
module Notes
class BuildService < ::BaseService
prepend ::EE::Notes::BuildService
prepend ::EE::Notes::BuildService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute
should_resolve = false
......
......@@ -242,7 +242,7 @@ module NotificationRecipientService
end
class Default < Base
prepend ::EE::NotificationRecipientBuilders::Default
prepend ::EE::NotificationRecipientBuilders::Default # rubocop: disable Cop/InjectEnterpriseEditionModule
MENTION_TYPE_ACTIONS = [:new_issue, :new_merge_request].freeze
......
......@@ -12,7 +12,7 @@ module Projects
#
# Projects::AfterRenameService.new(project).execute
class AfterRenameService
prepend ::EE::Projects::AfterRenameService
prepend ::EE::Projects::AfterRenameService # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :project, :full_path_before, :full_path_after, :path_before
......
......@@ -2,7 +2,7 @@
module Projects
class AutocompleteService < BaseService
prepend EE::Projects::AutocompleteService
prepend EE::Projects::AutocompleteService # rubocop: disable Cop/InjectEnterpriseEditionModule
include LabelsAsHash
def issues
......
......@@ -2,7 +2,7 @@
module Projects
class CreateFromTemplateService < BaseService
prepend ::EE::Projects::CreateFromTemplateService
prepend ::EE::Projects::CreateFromTemplateService # rubocop: disable Cop/InjectEnterpriseEditionModule
include Gitlab::Utils::StrongMemoize
def initialize(user, params)
......
......@@ -2,7 +2,7 @@
module Projects
class CreateService < BaseService
prepend ::EE::Projects::CreateService
prepend ::EE::Projects::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def initialize(user, params)
@current_user, @params = user, params.dup
......
......@@ -3,7 +3,7 @@
module Projects
class DestroyService < BaseService
include Gitlab::ShellAdapter
prepend ::EE::Projects::DestroyService
prepend ::EE::Projects::DestroyService # rubocop: disable Cop/InjectEnterpriseEditionModule
DestroyError = Class.new(StandardError)
......
......@@ -5,7 +5,7 @@
# The latter will under the hood just import an archive supplied by GitLab.
module Projects
class GitlabProjectsImportService
prepend ::EE::Projects::GitlabProjectsImportService
prepend ::EE::Projects::GitlabProjectsImportService # rubocop: disable Cop/InjectEnterpriseEditionModule
include Gitlab::Utils::StrongMemoize
include Gitlab::TemplateHelper
......
......@@ -3,7 +3,7 @@
module Projects
module GroupLinks
class CreateService < BaseService
prepend ::EE::Projects::GroupLinks::CreateService
prepend ::EE::Projects::GroupLinks::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(group)
return false unless group
......
......@@ -3,7 +3,7 @@
module Projects
module GroupLinks
class DestroyService < BaseService
prepend ::EE::Projects::GroupLinks::DestroyService
prepend ::EE::Projects::GroupLinks::DestroyService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(group_link)
return false unless group_link
......
......@@ -7,7 +7,7 @@ module Projects
class MigrateAttachmentsService < BaseService
attr_reader :logger, :old_disk_path, :new_disk_path
prepend ::EE::Projects::HashedStorage::MigrateAttachmentsService
prepend ::EE::Projects::HashedStorage::MigrateAttachmentsService # rubocop: disable Cop/InjectEnterpriseEditionModule
def initialize(project, old_disk_path, logger: nil)
@project = project
......
......@@ -7,7 +7,7 @@ module Projects
class MigrateRepositoryService < BaseService
include Gitlab::ShellAdapter
prepend ::EE::Projects::HashedStorage::MigrateRepositoryService
prepend ::EE::Projects::HashedStorage::MigrateRepositoryService # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :old_disk_path, :new_disk_path, :old_wiki_disk_path, :old_storage_version, :logger, :move_wiki
......
......@@ -13,7 +13,7 @@ module Projects
include Gitlab::ShellAdapter
TransferError = Class.new(StandardError)
prepend ::EE::Projects::TransferService
prepend ::EE::Projects::TransferService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(new_namespace)
@new_namespace = new_namespace
......
......@@ -4,7 +4,7 @@ module Projects
class UpdateService < BaseService
include UpdateVisibilityLevel
prepend ::EE::Projects::UpdateService
prepend ::EE::Projects::UpdateService # rubocop: disable Cop/InjectEnterpriseEditionModule
ValidationError = Class.new(StandardError)
......
......@@ -2,7 +2,7 @@
module Users
class BuildService < BaseService
prepend ::EE::Users::BuildService
prepend ::EE::Users::BuildService # rubocop: disable Cop/InjectEnterpriseEditionModule
delegate :user_default_internal_regex_enabled?,
:user_default_internal_regex_instance,
......
......@@ -2,7 +2,7 @@
module Users
class DestroyService
prepend ::EE::Users::DestroyService
prepend ::EE::Users::DestroyService # rubocop: disable Cop/InjectEnterpriseEditionModule
DestroyError = Class.new(StandardError)
......
......@@ -137,7 +137,7 @@ module ObjectStorage
included do |base|
base.include(ObjectStorage)
include ::EE::ObjectStorage::Concern
include ::EE::ObjectStorage::Concern # rubocop: disable Cop/InjectEnterpriseEditionModule
after :migrate, :delete_migrated_file
end
......
......@@ -2,7 +2,7 @@
module RepositoryCheck
class BatchWorker
prepend ::EE::RepositoryCheck::BatchWorker
prepend ::EE::RepositoryCheck::BatchWorker # rubocop: disable Cop/InjectEnterpriseEditionModule
include ApplicationWorker
include RepositoryCheckQueue
......
......@@ -5,7 +5,7 @@ module RepositoryCheck
include ApplicationWorker
include RepositoryCheckQueue
prepend ::EE::RepositoryCheck::SingleRepositoryWorker
prepend ::EE::RepositoryCheck::SingleRepositoryWorker # rubocop: disable Cop/InjectEnterpriseEditionModule
def perform(project_id)
project = Project.find(project_id)
......
......@@ -43,7 +43,7 @@ class Rack::Attack
end
class Request
prepend ::EE::Gitlab::Rack::Attack::Request
prepend ::EE::Gitlab::Rack::Attack::Request # rubocop: disable Cop/InjectEnterpriseEditionModule
def unauthenticated?
!authenticated_user_id([:api, :rss, :ics])
......
......@@ -2,7 +2,7 @@
module EE
module ConfirmationsController
include EE::Audit::Changes
include EE::Audit::Changes # rubocop: disable Cop/InjectEnterpriseEditionModule
extend ::Gitlab::Utils::Override
protected
......
......@@ -3,7 +3,7 @@
module EE
module Emails
module CreateService
include ::EE::Emails::BaseService
include ::EE::Emails::BaseService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(*args, &blk)
super.tap do |email|
......
......@@ -3,7 +3,7 @@
module EE
module Emails
module DestroyService
include ::EE::Emails::BaseService
include ::EE::Emails::BaseService # rubocop: disable Cop/InjectEnterpriseEditionModule
def execute(*args, &blk)
super.tap do
......
......@@ -3,7 +3,7 @@
module EE
module Users
module UpdateService
include EE::Audit::Changes
include EE::Audit::Changes # rubocop: disable Cop/InjectEnterpriseEditionModule
private
......
......@@ -6,7 +6,7 @@ module EE
include ::API::PaginationParams
include ::API::BoardsResponses
prepend EE::API::BoardsResponses
prepend EE::API::BoardsResponses # rubocop: disable Cop/InjectEnterpriseEditionModule
before { authenticate! }
......
......@@ -6,7 +6,7 @@ module EE
include ::API::PaginationParams
include ::API::BoardsResponses
prepend EE::API::BoardsResponses
prepend EE::API::BoardsResponses # rubocop: disable Cop/InjectEnterpriseEditionModule
before do
authenticate!
......
......@@ -41,7 +41,7 @@ module API
# Helper Methods for Grape Endpoint
module HelperMethods
prepend EE::API::APIGuard::HelperMethods
prepend EE::API::APIGuard::HelperMethods # rubocop: disable Cop/InjectEnterpriseEditionModule
include Gitlab::Auth::UserAuthFinders
def find_current_user!
......
......@@ -5,7 +5,7 @@ module API
include BoardsResponses
include PaginationParams
prepend EE::API::BoardsResponses
prepend EE::API::BoardsResponses # rubocop: disable Cop/InjectEnterpriseEditionModule
before { authenticate! }
......
......@@ -5,7 +5,7 @@ module API
include BoardsResponses
include PaginationParams
prepend EE::API::BoardsResponses
prepend EE::API::BoardsResponses # rubocop: disable Cop/InjectEnterpriseEditionModule
before do
authenticate!
......
......@@ -2,7 +2,7 @@
module API
module Helpers
prepend EE::API::Helpers
prepend EE::API::Helpers # rubocop: disable Cop/InjectEnterpriseEditionModule
include Gitlab::Utils
include Gitlab::Utils::StrongMemoize
......
......@@ -3,7 +3,7 @@
module API
module Helpers
module NotesHelpers
prepend EE::API::Helpers::NotesHelpers
prepend EE::API::Helpers::NotesHelpers # rubocop: disable Cop/InjectEnterpriseEditionModule
def update_note(noteable, note_id)
note = noteable.notes.find(params[:note_id])
......
......@@ -3,7 +3,7 @@
module API
module Helpers
module ProjectSnapshotsHelpers
prepend ::EE::API::Helpers::ProjectSnapshotsHelpers
prepend ::EE::API::Helpers::ProjectSnapshotsHelpers # rubocop: disable Cop/InjectEnterpriseEditionModule
def authorize_read_git_snapshot!
authenticated_with_full_private_access!
......
......@@ -3,7 +3,7 @@
module API
module Helpers
module Runner
prepend EE::API::Helpers::Runner
prepend EE::API::Helpers::Runner # rubocop: disable Cop/InjectEnterpriseEditionModule
JOB_TOKEN_HEADER = 'HTTP_JOB_TOKEN'.freeze
JOB_TOKEN_PARAM = :token
......
......@@ -17,7 +17,7 @@ module API
end
end
prepend EE::API::Issues
prepend EE::API::Issues # rubocop: disable Cop/InjectEnterpriseEditionModule
helpers do
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -11,7 +11,7 @@ module API
end
end
prepend EE::API::JobArtifacts
prepend EE::API::JobArtifacts # rubocop: disable Cop/InjectEnterpriseEditionModule
params do
requires :id, type: String, desc: 'The ID of a project'
......
......@@ -29,7 +29,7 @@ module API
]
end
prepend EE::API::MergeRequests
prepend EE::API::MergeRequests # rubocop: disable Cop/InjectEnterpriseEditionModule
helpers do
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -17,7 +17,7 @@ module API
end
end
prepend EE::API::Namespaces
prepend EE::API::Namespaces # rubocop: disable Cop/InjectEnterpriseEditionModule
resource :namespaces do
desc 'Get a namespaces list' do
......
......@@ -16,7 +16,7 @@ module API
end
end
prepend EE::API::ProjectClusters
prepend EE::API::ProjectClusters # rubocop: disable Cop/InjectEnterpriseEditionModule
params do
requires :id, type: String, desc: 'The ID of the project'
......
......@@ -32,7 +32,7 @@ module API
end
end
prepend EE::API::Projects
prepend EE::API::Projects # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.update_params_at_least_one_of
[
......
......@@ -3,7 +3,7 @@
module API
class Todos < Grape::API
include PaginationParams
prepend EE::API::Todos
prepend EE::API::Todos # rubocop: disable Cop/InjectEnterpriseEditionModule
before { authenticate! }
......
......@@ -4,7 +4,7 @@ module Banzai
module Filter
# The actual filter is implemented in the EE mixin
class EpicReferenceFilter < IssuableReferenceFilter
prepend EE::Banzai::Filter::EpicReferenceFilter
prepend EE::Banzai::Filter::EpicReferenceFilter # rubocop: disable Cop/InjectEnterpriseEditionModule
self.reference_type = :epic
......
......@@ -9,7 +9,7 @@ module Banzai
# so we can avoid N+1 queries problem
class IssuableExtractor
prepend EE::Banzai::IssuableExtractor
prepend EE::Banzai::IssuableExtractor # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :context
......
......@@ -3,7 +3,7 @@
module Banzai
module Pipeline
class GfmPipeline < BasePipeline
prepend EE::Banzai::Pipeline::GfmPipeline
prepend EE::Banzai::Pipeline::GfmPipeline # rubocop: disable Cop/InjectEnterpriseEditionModule
# These filters convert GitLab Flavored Markdown (GFM) to HTML.
# The handlers defined in app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
......
......@@ -3,7 +3,7 @@
module Banzai
module Pipeline
class PostProcessPipeline < BasePipeline
prepend EE::Banzai::Pipeline::PostProcessPipeline
prepend EE::Banzai::Pipeline::PostProcessPipeline # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.filters
@filters ||= FilterArray[
......
......@@ -3,7 +3,7 @@
module Banzai
module Pipeline
class SingleLinePipeline < GfmPipeline
prepend EE::Banzai::Pipeline::SingleLinePipeline
prepend EE::Banzai::Pipeline::SingleLinePipeline # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.filters
@filters ||= FilterArray[
......
......@@ -4,7 +4,7 @@ module Banzai
module ReferenceParser
# The actual parser is implemented in the EE mixin
class EpicParser < IssuableParser
prepend ::EE::Banzai::ReferenceParser::EpicParser
prepend ::EE::Banzai::ReferenceParser::EpicParser # rubocop: disable Cop/InjectEnterpriseEditionModule
self.reference_type = :epic
......
......@@ -7,7 +7,7 @@
#
module Gitlab
module Access
extend ::EE::Gitlab::Access
extend ::EE::Gitlab::Access # rubocop: disable Cop/InjectEnterpriseEditionModule
AccessDeniedError = Class.new(StandardError)
......
......@@ -16,7 +16,7 @@ module Gitlab
DEFAULT_SCOPES = [:api].freeze
class << self
prepend EE::Gitlab::Auth
prepend EE::Gitlab::Auth # rubocop: disable Cop/InjectEnterpriseEditionModule
def omniauth_enabled?
Gitlab.config.omniauth.enabled
......
......@@ -8,7 +8,7 @@ module Gitlab
module Auth
module LDAP
class Access
prepend ::EE::Gitlab::Auth::LDAP::Access
prepend ::EE::Gitlab::Auth::LDAP::Access # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :provider, :user, :ldap_identity
......
......@@ -4,7 +4,7 @@ module Gitlab
module Auth
module LDAP
class Adapter
prepend ::EE::Gitlab::Auth::LDAP::Adapter
prepend ::EE::Gitlab::Auth::LDAP::Adapter # rubocop: disable Cop/InjectEnterpriseEditionModule
SEARCH_RETRY_FACTOR = [1, 1, 2, 3].freeze
MAX_SEARCH_RETRIES = Rails.env.test? ? 1 : SEARCH_RETRY_FACTOR.size.freeze
......
......@@ -5,7 +5,7 @@ module Gitlab
module Auth
module LDAP
class Config
prepend ::EE::Gitlab::Auth::LDAP::Config
prepend ::EE::Gitlab::Auth::LDAP::Config # rubocop: disable Cop/InjectEnterpriseEditionModule
NET_LDAP_ENCRYPTION_METHOD = {
simple_tls: :simple_tls,
......
......@@ -4,7 +4,7 @@ module Gitlab
module Auth
module LDAP
class Person
prepend ::EE::Gitlab::Auth::LDAP::Person
prepend ::EE::Gitlab::Auth::LDAP::Person # rubocop: disable Cop/InjectEnterpriseEditionModule
# Active Directory-specific LDAP filter that checks if bit 2 of the
# userAccountControl attribute is set.
......
......@@ -11,7 +11,7 @@ module Gitlab
module LDAP
class User < Gitlab::Auth::OAuth::User
extend ::Gitlab::Utils::Override
prepend ::EE::Gitlab::Auth::LDAP::User
prepend ::EE::Gitlab::Auth::LDAP::User # rubocop: disable Cop/InjectEnterpriseEditionModule
class << self
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -6,7 +6,7 @@ module Gitlab
module Auth
module OAuth
class AuthHash
prepend ::EE::Gitlab::Auth::OAuth::AuthHash
prepend ::EE::Gitlab::Auth::OAuth::AuthHash # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :auth_hash
def initialize(auth_hash)
......
......@@ -9,7 +9,7 @@ module Gitlab
module Auth
module OAuth
class User
prepend ::EE::Gitlab::Auth::OAuth::User
prepend ::EE::Gitlab::Auth::OAuth::User # rubocop: disable Cop/InjectEnterpriseEditionModule
SignupDisabledError = Class.new(StandardError)
SigninDisabledForProviderError = Class.new(StandardError)
......
......@@ -4,7 +4,7 @@
module Gitlab
module Auth
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
prepend ::EE::Gitlab::Auth::Result
prepend ::EE::Gitlab::Auth::Result # rubocop: disable Cop/InjectEnterpriseEditionModule
def ci?(for_project)
type == :ci &&
......
......@@ -4,7 +4,7 @@ module Gitlab
module Auth
module Saml
class Config
prepend ::EE::Gitlab::Auth::Saml::Config
prepend ::EE::Gitlab::Auth::Saml::Config # rubocop: disable Cop/InjectEnterpriseEditionModule
class << self
def options
......
......@@ -9,7 +9,7 @@ module Gitlab
module Auth
module Saml
class User < Gitlab::Auth::OAuth::User
prepend ::EE::Gitlab::Auth::Saml::User
prepend ::EE::Gitlab::Auth::Saml::User # rubocop: disable Cop/InjectEnterpriseEditionModule
extend ::Gitlab::Utils::Override
......
......@@ -18,7 +18,7 @@ module Gitlab
end
module UserAuthFinders
prepend ::EE::Gitlab::Auth::UserAuthFinders
prepend ::EE::Gitlab::Auth::UserAuthFinders # rubocop: disable Cop/InjectEnterpriseEditionModule
include Gitlab::Utils::StrongMemoize
......
......@@ -6,7 +6,7 @@ require_relative 'redact_links/redactable'
module Gitlab
module BackgroundMigration
class RedactLinks
prepend EE::Gitlab::BackgroundMigration::RedactLinks
prepend EE::Gitlab::BackgroundMigration::RedactLinks # rubocop: disable Cop/InjectEnterpriseEditionModule
class Note < ActiveRecord::Base
include EachBatch
......
......@@ -3,7 +3,7 @@
module Gitlab
module Checks
class BaseChecker
prepend EE::Gitlab::Checks::BaseChecker
prepend EE::Gitlab::Checks::BaseChecker # rubocop: disable Cop/InjectEnterpriseEditionModule
include Gitlab::Utils::StrongMemoize
attr_reader :change_access
......
......@@ -3,7 +3,7 @@
module Gitlab
module Checks
class ChangeAccess
prepend EE::Gitlab::Checks::ChangeAccess
prepend EE::Gitlab::Checks::ChangeAccess # rubocop: disable Cop/InjectEnterpriseEditionModule
ATTRIBUTES = %i[user_access project skip_authorization
skip_lfs_integrity_check protocol oldrev newrev ref
......
......@@ -4,7 +4,7 @@ module Gitlab
module Checks
class DiffCheck < BaseChecker
include Gitlab::Utils::StrongMemoize
prepend EE::Gitlab::Checks::DiffCheck
prepend EE::Gitlab::Checks::DiffCheck # rubocop: disable Cop/InjectEnterpriseEditionModule
LOG_MESSAGES = {
validate_file_paths: "Validating diffs' file paths...",
......
......@@ -3,7 +3,7 @@
module Gitlab
module Ci
module Parsers
prepend ::EE::Gitlab::Ci::Parsers
prepend ::EE::Gitlab::Ci::Parsers # rubocop: disable Cop/InjectEnterpriseEditionModule
ParserNotFoundError = Class.new(ParserError)
......
......@@ -20,7 +20,7 @@ module Gitlab
private_constant :REASONS
prepend ::EE::Gitlab::Ci::Status::Build::Failed
prepend ::EE::Gitlab::Ci::Status::Build::Failed # rubocop: disable Cop/InjectEnterpriseEditionModule
def status_tooltip
base_message
......
......@@ -12,7 +12,7 @@ module Gitlab
MAX_TIMESTAMP_VALUE = Time.at((1 << 31) - 1).freeze
class << self
prepend EE::Gitlab::Database
prepend EE::Gitlab::Database # rubocop: disable Cop/InjectEnterpriseEditionModule
end
def self.config
......
......@@ -3,7 +3,7 @@
module Gitlab
module Email
module Handler
prepend ::EE::Gitlab::Email::Handler
prepend ::EE::Gitlab::Email::Handler # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.handlers
@handlers ||= load_handlers
......
......@@ -3,7 +3,7 @@
module Gitlab
module EtagCaching
class Router
prepend EE::Gitlab::EtagCaching::Router
prepend EE::Gitlab::EtagCaching::Router # rubocop: disable Cop/InjectEnterpriseEditionModule
Route = Struct.new(:regexp, :name)
# We enable an ETag for every request matching the regex.
......
......@@ -4,7 +4,7 @@
# class return an instance of `GitlabAccessStatus`
module Gitlab
class GitAccess
prepend ::EE::Gitlab::GitAccess
prepend ::EE::Gitlab::GitAccess # rubocop: disable Cop/InjectEnterpriseEditionModule
include ActionView::Helpers::SanitizeHelper
include PathLocksHelper
include Gitlab::Utils::StrongMemoize
......
......@@ -2,7 +2,7 @@
module Gitlab
class GitAccessWiki < GitAccess
prepend EE::Gitlab::GitAccessWiki
prepend EE::Gitlab::GitAccessWiki # rubocop: disable Cop/InjectEnterpriseEditionModule
ERROR_MESSAGES = {
read_only: "You can't push code to a read-only GitLab instance.",
......
......@@ -5,7 +5,7 @@ module Gitlab
# The ParallelImporter schedules the importing of a GitHub project using
# Sidekiq.
class ParallelImporter
prepend ::EE::Gitlab::GithubImport::ParallelImporter
prepend ::EE::Gitlab::GithubImport::ParallelImporter # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :project
......
......@@ -3,7 +3,7 @@
module Gitlab
module HookData
class IssueBuilder < BaseBuilder
prepend ::EE::Gitlab::HookData::IssueBuilder
prepend ::EE::Gitlab::HookData::IssueBuilder # rubocop: disable Cop/InjectEnterpriseEditionModule
SAFE_HOOK_RELATIONS = %i[
assignees
......
......@@ -3,7 +3,7 @@
module Gitlab
module ImportExport
class RelationFactory
prepend ::EE::Gitlab::ImportExport::RelationFactory
prepend ::EE::Gitlab::ImportExport::RelationFactory # rubocop: disable Cop/InjectEnterpriseEditionModule
OVERRIDES = { snippets: :project_snippets,
ci_pipelines: 'Ci::Pipeline',
......
......@@ -24,7 +24,7 @@ module Gitlab
].freeze
class << self
prepend EE::Gitlab::ImportSources
prepend EE::Gitlab::ImportSources # rubocop: disable Cop/InjectEnterpriseEditionModule
def options
Hash[import_table.map { |importer| [importer.title, importer.name] }]
......
......@@ -4,7 +4,7 @@ module Gitlab
module Middleware
class ReadOnly
class Controller
prepend EE::Gitlab::Middleware::ReadOnly::Controller
prepend EE::Gitlab::Middleware::ReadOnly::Controller # rubocop: disable Cop/InjectEnterpriseEditionModule
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE).freeze
APPLICATION_JSON = 'application/json'.freeze
......
......@@ -2,7 +2,7 @@
module Gitlab
class OmniauthInitializer
prepend ::EE::Gitlab::OmniauthInitializer
prepend ::EE::Gitlab::OmniauthInitializer # rubocop: disable Cop/InjectEnterpriseEditionModule
def initialize(devise_config)
@devise_config = devise_config
......
......@@ -5,7 +5,7 @@
module Gitlab
module Patch
module DrawRoute
prepend EE::Gitlab::Patch::DrawRoute
prepend EE::Gitlab::Patch::DrawRoute # rubocop: disable Cop/InjectEnterpriseEditionModule
RoutesNotFound = Class.new(StandardError)
......
......@@ -3,7 +3,7 @@
module Gitlab
module Prometheus
class MetricGroup
prepend EE::Gitlab::Prometheus::MetricGroup
prepend EE::Gitlab::Prometheus::MetricGroup # rubocop: disable Cop/InjectEnterpriseEditionModule
include ActiveModel::Model
attr_accessor :name, :priority, :metrics
......
......@@ -4,7 +4,7 @@ module Gitlab
module Prometheus
module Queries
module QueryAdditionalMetrics
prepend EE::Gitlab::Prometheus::Queries::QueryAdditionalMetrics
prepend EE::Gitlab::Prometheus::Queries::QueryAdditionalMetrics # rubocop: disable Cop/InjectEnterpriseEditionModule
def query_metrics(project, environment, query_context)
matched_metrics(project).map(&query_group(query_context))
......
......@@ -3,7 +3,7 @@
module Gitlab
module Regex
extend self
extend EE::Gitlab::Regex
extend EE::Gitlab::Regex # rubocop: disable Cop/InjectEnterpriseEditionModule
def namespace_name_regex
@namespace_name_regex ||= /\A[\p{Alnum}\p{Pd}_\. ]*\z/.freeze
......
......@@ -3,7 +3,7 @@
module Gitlab
module Search
class ParsedQuery
prepend EE::Gitlab::Search::ParsedQuery
prepend EE::Gitlab::Search::ParsedQuery # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :term, :filters
......
......@@ -3,7 +3,7 @@
module Gitlab
module SlashCommands
class Command < BaseCommand
prepend EE::Gitlab::SlashCommands::Command
prepend EE::Gitlab::SlashCommands::Command # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.commands
[
......
......@@ -4,7 +4,7 @@ module Gitlab
module SlashCommands
module Presenters
module IssueBase
prepend EE::Gitlab::SlashCommands::Presenters::IssueBase
prepend EE::Gitlab::SlashCommands::Presenters::IssueBase # rubocop: disable Cop/InjectEnterpriseEditionModule
def color(issuable)
issuable.open? ? '#38ae67' : '#d22852'
......
......@@ -2,7 +2,7 @@
module Gitlab
class TreeSummary
prepend ::EE::Gitlab::TreeSummary
prepend ::EE::Gitlab::TreeSummary # rubocop: disable Cop/InjectEnterpriseEditionModule
include ::Gitlab::Utils::StrongMemoize
......
......@@ -5,7 +5,7 @@ module Gitlab
APPROXIMATE_COUNT_MODELS = [Label, MergeRequest, Note, Todo].freeze
class << self
prepend EE::Gitlab::UsageData
prepend EE::Gitlab::UsageData # rubocop: disable Cop/InjectEnterpriseEditionModule
def data(force_refresh: false)
Rails.cache.fetch('usage_data', force: force_refresh, expires_in: 2.weeks) { uncached_data }
......
......@@ -4,7 +4,7 @@ module QA
module Page
module Admin
class Menu < Page::Base
prepend EE::Page::Admin::Menu
prepend EE::Page::Admin::Menu # rubocop: disable Cop/InjectEnterpriseEditionModule
view 'app/views/layouts/nav/sidebar/_admin.html.haml' do
element :admin_sidebar
......
......@@ -3,7 +3,7 @@ module QA
module Project
class New < Page::Base
include Page::Component::Select2
prepend EE::Page::Project::New
prepend EE::Page::Project::New # rubocop: disable Cop/InjectEnterpriseEditionModule
view 'app/views/projects/new.html.haml' do
element :project_create_from_template_tab
......
......@@ -5,7 +5,7 @@ module QA
module Project
module Settings
class MirroringRepositories < Page::Base
prepend EE::Page::Project::Settings::MirroringRepositories
prepend EE::Page::Project::Settings::MirroringRepositories # rubocop: disable Cop/InjectEnterpriseEditionModule
view 'app/views/projects/mirrors/_authentication_method.html.haml' do
element :authentication_method
......
......@@ -3,7 +3,7 @@ module QA
module Project
module Settings
class ProtectedBranches < Page::Base
prepend EE::Page::Project::Settings::ProtectedBranches
prepend EE::Page::Project::Settings::ProtectedBranches # rubocop: disable Cop/InjectEnterpriseEditionModule
view 'app/views/projects/protected_branches/shared/_dropdown.html.haml' do
element :protected_branch_select
......
......@@ -11,9 +11,13 @@ module RuboCop
METHODS = Set.new(%i[include extend prepend]).freeze
def_node_matcher :ee_const?, <<~PATTERN
(const (const _ :EE) _)
PATTERN
def ee_const?(node)
line = node.location.expression.source_line
# We use `match?` here instead of RuboCop's AST matching, as this makes
# it far easier to handle nested constants such as `EE::Foo::Bar::Baz`.
line.match?(/(\s|\()(::)?EE::/)
end
def on_send(node)
return unless METHODS.include?(node.children[1])
......
......@@ -19,6 +19,41 @@ describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
end
it 'does not flag the use of `prepend EEFoo` in the middle of a file' do
expect_no_offenses(<<~SOURCE)
class Foo
prepend EEFoo
end
SOURCE
end
it 'flags the use of `prepend EE::Foo::Bar` in the middle of a file' do
expect_offense(<<~SOURCE)
class Foo
prepend EE::Foo::Bar
^^^^^^^^^^^^^^^^^^^^ 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 `prepend(EE::Foo::Bar)` in the middle of a file' do
expect_offense(<<~SOURCE)
class Foo
prepend(EE::Foo::Bar)
^^^^^^^^^^^^^^^^^^^^^ 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 `prepend EE::Foo::Bar::Baz` in the middle of a file' do
expect_offense(<<~SOURCE)
class Foo
prepend EE::Foo::Bar::Baz
^^^^^^^^^^^^^^^^^^^^^^^^^ 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 `prepend ::EE` in the middle of a file' do
expect_offense(<<~SOURCE)
class Foo
......
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