summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-03 06:07:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-03 06:07:06 +0000
commita3759fc2e1f8aa1493840ab0d4ebd4a2e5f495aa (patch)
treefb8f046819669955006fe21043bfcc13dbe40209 /lib
parent336483a4c150a112e83d95538218c59d9a952768 (diff)
downloadgitlab-ce-a3759fc2e1f8aa1493840ab0d4ebd4a2e5f495aa.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/maven_packages.rb2
-rw-r--r--lib/gitlab/background_migration/delete_orphans_approval_merge_request_rules.rb2
-rw-r--r--lib/gitlab/background_migration/legacy_upload_mover.rb2
-rw-r--r--lib/gitlab/ci/build/rules/rule/clause/exists.rb4
-rw-r--r--lib/gitlab/ci/parsers/coverage/sax_document.rb2
-rw-r--r--lib/gitlab/ci/queue/metrics.rb4
-rw-r--r--lib/gitlab/database/each_database.rb4
-rw-r--r--lib/gitlab/email/handler/create_issue_handler.rb2
-rw-r--r--lib/gitlab/email/handler/service_desk_handler.rb2
-rw-r--r--lib/gitlab/graphql/queries.rb4
-rw-r--r--lib/gitlab/import_export/attributes_permitter.rb2
-rw-r--r--lib/gitlab/search_results.rb2
-rw-r--r--lib/gitlab/task_helpers.rb2
-rw-r--r--lib/gitlab/url_blocker.rb2
-rw-r--r--lib/gitlab_edition.rb4
15 files changed, 20 insertions, 20 deletions
diff --git a/lib/api/maven_packages.rb b/lib/api/maven_packages.rb
index 638ce6dbedc..a82f53cf738 100644
--- a/lib/api/maven_packages.rb
+++ b/lib/api/maven_packages.rb
@@ -107,7 +107,7 @@ module API
def fetch_package(file_name:, project: nil, group: nil)
order_by_package_file = file_name.include?(::Packages::Maven::Metadata.filename) &&
- !params[:path].include?(::Packages::Maven::FindOrCreatePackageService::SNAPSHOT_TERM)
+ params[:path].exclude?(::Packages::Maven::FindOrCreatePackageService::SNAPSHOT_TERM)
::Packages::Maven::PackageFinder.new(
current_user,
diff --git a/lib/gitlab/background_migration/delete_orphans_approval_merge_request_rules.rb b/lib/gitlab/background_migration/delete_orphans_approval_merge_request_rules.rb
index b75bda51ef3..4b7b7d42c77 100644
--- a/lib/gitlab/background_migration/delete_orphans_approval_merge_request_rules.rb
+++ b/lib/gitlab/background_migration/delete_orphans_approval_merge_request_rules.rb
@@ -4,7 +4,7 @@ module Gitlab
module BackgroundMigration
# Deletes orphans records whenever report_type equals to scan_finding (i.e., 4)
class DeleteOrphansApprovalMergeRequestRules < BatchedMigrationJob
- scope_to -> (relation) { relation.where(report_type: 4) }
+ scope_to ->(relation) { relation.where(report_type: 4) }
operation_name :delete_all
diff --git a/lib/gitlab/background_migration/legacy_upload_mover.rb b/lib/gitlab/background_migration/legacy_upload_mover.rb
index 1879a6c5427..2b2a7d65d08 100644
--- a/lib/gitlab/background_migration/legacy_upload_mover.rb
+++ b/lib/gitlab/background_migration/legacy_upload_mover.rb
@@ -109,7 +109,7 @@ module Gitlab
old_path = upload.absolute_path
old_path_sub = '-/system/note/attachment'
- if !File.exist?(old_path) || !old_path.include?(old_path_sub)
+ if !File.exist?(old_path) || old_path.exclude?(old_path_sub)
log_legacy_diff_note_problem(old_path)
return false
end
diff --git a/lib/gitlab/ci/build/rules/rule/clause/exists.rb b/lib/gitlab/ci/build/rules/rule/clause/exists.rb
index c55615bb83b..d3cc9337fd9 100644
--- a/lib/gitlab/ci/build/rules/rule/clause/exists.rb
+++ b/lib/gitlab/ci/build/rules/rule/clause/exists.rb
@@ -66,12 +66,12 @@ module Gitlab
# matches glob patterns that only match files in the top level directory
def top_level_glob?(glob)
- !glob.include?('/') && !glob.include?('**')
+ glob.exclude?('/') && glob.exclude?('**')
end
# matches glob patterns that have no metacharacters for File#fnmatch?
def exact_glob?(glob)
- !glob.include?('*') && !glob.include?('?') && !glob.include?('[') && !glob.include?('{')
+ glob.exclude?('*') && glob.exclude?('?') && glob.exclude?('[') && glob.exclude?('{')
end
end
end
diff --git a/lib/gitlab/ci/parsers/coverage/sax_document.rb b/lib/gitlab/ci/parsers/coverage/sax_document.rb
index ddd9c80f5ea..eafeaf9d505 100644
--- a/lib/gitlab/ci/parsers/coverage/sax_document.rb
+++ b/lib/gitlab/ci/parsers/coverage/sax_document.rb
@@ -63,7 +63,7 @@ module Gitlab
end
def parse_source(node)
- return unless project_path && paths && !node.include?(GO_SOURCE_PATTERN)
+ return unless project_path && paths && node.exclude?(GO_SOURCE_PATTERN)
source = build_source_path(node)
self.sources << source if source.present?
diff --git a/lib/gitlab/ci/queue/metrics.rb b/lib/gitlab/ci/queue/metrics.rb
index 5cee73238ca..0273a13e6f2 100644
--- a/lib/gitlab/ci/queue/metrics.rb
+++ b/lib/gitlab/ci/queue/metrics.rb
@@ -76,7 +76,7 @@ module Gitlab
def observe_queue_depth(queue, size)
return unless Feature.enabled?(:gitlab_ci_builds_queuing_metrics)
- if !Rails.env.production? && !QUEUE_DEPTH_HISTOGRAMS.include?(queue)
+ if !Rails.env.production? && QUEUE_DEPTH_HISTOGRAMS.exclude?(queue)
raise ArgumentError, "unknown queue depth label: #{queue}"
end
@@ -113,7 +113,7 @@ module Gitlab
end
def self.increment_queue_operation(operation)
- if !Rails.env.production? && !OPERATION_COUNTERS.include?(operation)
+ if !Rails.env.production? && OPERATION_COUNTERS.exclude?(operation)
raise ArgumentError, "unknown queue operation: #{operation}"
end
diff --git a/lib/gitlab/database/each_database.rb b/lib/gitlab/database/each_database.rb
index 02f008abf85..dcf2ab9dec8 100644
--- a/lib/gitlab/database/each_database.rb
+++ b/lib/gitlab/database/each_database.rb
@@ -52,7 +52,7 @@ module Gitlab
next unless shared_model.limit_connection_names.include?(connection_name.to_sym)
end
- next if selected_databases.present? && !selected_databases.include?(connection_name.to_sym)
+ next if selected_databases.present? && selected_databases.exclude?(connection_name.to_sym)
with_shared_connection(connection_model.connection, connection_name) do
yield shared_model, connection_name
@@ -63,7 +63,7 @@ module Gitlab
def with_model_connection(model, selected_databases, &blk)
connection_name = model.connection_db_config.name
- return if selected_databases.present? && !selected_databases.include?(connection_name.to_sym)
+ return if selected_databases.present? && selected_databases.exclude?(connection_name.to_sym)
with_shared_connection(model.connection, connection_name) do
yield model, connection_name
diff --git a/lib/gitlab/email/handler/create_issue_handler.rb b/lib/gitlab/email/handler/create_issue_handler.rb
index e21a88c4e0d..c41c93b6ec0 100644
--- a/lib/gitlab/email/handler/create_issue_handler.rb
+++ b/lib/gitlab/email/handler/create_issue_handler.rb
@@ -73,7 +73,7 @@ module Gitlab
end
def can_handle_legacy_format?
- project_path && !incoming_email_token.include?('+') && !mail_key.include?(Gitlab::Email::Common::UNSUBSCRIBE_SUFFIX_LEGACY)
+ project_path && incoming_email_token.exclude?('+') && mail_key.exclude?(Gitlab::Email::Common::UNSUBSCRIBE_SUFFIX_LEGACY)
end
end
end
diff --git a/lib/gitlab/email/handler/service_desk_handler.rb b/lib/gitlab/email/handler/service_desk_handler.rb
index 06365296a76..8b436bb7a29 100644
--- a/lib/gitlab/email/handler/service_desk_handler.rb
+++ b/lib/gitlab/email/handler/service_desk_handler.rb
@@ -186,7 +186,7 @@ module Gitlab
end
def can_handle_legacy_format?
- project_path && project_path.include?('/') && !mail_key.include?('+')
+ project_path && project_path.include?('/') && mail_key.exclude?('+')
end
def author
diff --git a/lib/gitlab/graphql/queries.rb b/lib/gitlab/graphql/queries.rb
index cf06a2729d9..b97a003813d 100644
--- a/lib/gitlab/graphql/queries.rb
+++ b/lib/gitlab/graphql/queries.rb
@@ -78,7 +78,7 @@ module Gitlab
# remove variable definitions only used in skipped (client) fields
vars = op.variables.reject do |v|
- @skipped_arguments.include?(v.name) && !@printed_arguments.include?(v.name)
+ @skipped_arguments.include?(v.name) && @printed_arguments.exclude?(v.name)
end
if vars.any?
@@ -109,7 +109,7 @@ module Gitlab
end
def print_fragment_definition(fragment_def, indent: "")
- if skips? && @skipped_fragments.include?(fragment_def.name) && !@used_fragments.include?(fragment_def.name)
+ if skips? && @skipped_fragments.include?(fragment_def.name) && @used_fragments.exclude?(fragment_def.name)
return ''
end
diff --git a/lib/gitlab/import_export/attributes_permitter.rb b/lib/gitlab/import_export/attributes_permitter.rb
index 8c7a6c13246..67c6a1f0649 100644
--- a/lib/gitlab/import_export/attributes_permitter.rb
+++ b/lib/gitlab/import_export/attributes_permitter.rb
@@ -67,7 +67,7 @@ module Gitlab
end
def permitted_attributes_defined?(relation_sym)
- !DISABLED_RELATION_NAMES.include?(relation_sym) && @attributes_finder.included_attributes.key?(relation_sym)
+ DISABLED_RELATION_NAMES.exclude?(relation_sym) && @attributes_finder.included_attributes.key?(relation_sym)
end
private
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
index 37414f9e2b1..8658fa343e2 100644
--- a/lib/gitlab/search_results.rb
+++ b/lib/gitlab/search_results.rb
@@ -144,7 +144,7 @@ module Gitlab
sort_by = ::Gitlab::Search::SortOptions.sort_and_direction(order_by, sort)
# Reset sort to default if the chosen one is not supported by scope
- sort_by = nil if SCOPE_ONLY_SORT[sort_by] && !SCOPE_ONLY_SORT[sort_by].include?(scope)
+ sort_by = nil if SCOPE_ONLY_SORT[sort_by] && SCOPE_ONLY_SORT[sort_by].exclude?(scope)
case sort_by
when :created_at_asc
diff --git a/lib/gitlab/task_helpers.rb b/lib/gitlab/task_helpers.rb
index 54db31ffd6c..38ad7712e73 100644
--- a/lib/gitlab/task_helpers.rb
+++ b/lib/gitlab/task_helpers.rb
@@ -62,7 +62,7 @@ module Gitlab
begin
print(message)
answer = $stdin.gets.chomp
- end while choices.present? && !choices.include?(answer)
+ end while choices.present? && choices.exclude?(answer)
answer
end
diff --git a/lib/gitlab/url_blocker.rb b/lib/gitlab/url_blocker.rb
index 1e447923a39..f845ffb7ae6 100644
--- a/lib/gitlab/url_blocker.rb
+++ b/lib/gitlab/url_blocker.rb
@@ -204,7 +204,7 @@ module Gitlab
end
def validate_scheme(scheme, schemes)
- if scheme.blank? || (schemes.any? && !schemes.include?(scheme))
+ if scheme.blank? || (schemes.any? && schemes.exclude?(scheme))
raise BlockedUrlError, "Only allowed schemes are #{schemes.join(', ')}"
end
end
diff --git a/lib/gitlab_edition.rb b/lib/gitlab_edition.rb
index c3e58852498..2a668537534 100644
--- a/lib/gitlab_edition.rb
+++ b/lib/gitlab_edition.rb
@@ -49,7 +49,7 @@ module GitlabEdition
# The behavior needs to be synchronised with
# config/helpers/is_ee_env.js
root.join('ee/app/models/license.rb').exist? &&
- !%w[true 1].include?(ENV['FOSS_ONLY'].to_s)
+ !%w[true 1].include?(ENV['FOSS_ONLY'].to_s) # rubocop:disable Rails/NegateInclude
end
def self.jh?
@@ -58,7 +58,7 @@ module GitlabEdition
@is_jh =
ee? &&
root.join('jh').exist? &&
- !%w[true 1].include?(ENV['EE_ONLY'].to_s)
+ !%w[true 1].include?(ENV['EE_ONLY'].to_s) # rubocop:disable Rails/NegateInclude
end
def self.ee