Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rubocop_todo/rails/negate_include.yml56
-rw-r--r--app/finders/projects_finder.rb2
-rw-r--r--app/helpers/application_settings_helper.rb2
-rw-r--r--app/helpers/projects_helper.rb2
-rw-r--r--app/helpers/tree_helper.rb2
-rw-r--r--app/models/integrations/chat_message/pipeline_message.rb2
-rw-r--r--app/models/integrations/field.rb2
-rw-r--r--app/models/label.rb2
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--app/models/milestone.rb2
-rw-r--r--app/services/todo_service.rb2
-rw-r--r--app/services/work_items/parent_links/create_service.rb2
-rw-r--r--config/application.rb2
-rw-r--r--config/initializers/1_settings.rb2
-rw-r--r--danger/roulette/Dangerfile2
-rw-r--r--lib/api/maven_packages.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--qa/qa/tools/delete_test_users.rb4
-rw-r--r--rubocop/cop/gitlab/feature_available_usage.rb2
-rw-r--r--rubocop/cop/graphql/id_type.rb2
-rw-r--r--rubocop/cop/migration/add_reference.rb2
-rw-r--r--rubocop/cop/rspec/factory_bot/inline_association.rb2
-rw-r--r--spec/lib/container_registry/blob_spec.rb4
-rw-r--r--spec/lib/container_registry/client_spec.rb2
-rw-r--r--spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb2
-rw-r--r--spec/lib/gitlab/metrics/subscribers/active_record_spec.rb4
-rw-r--r--spec/support/matchers/pushed_frontend_feature_flags_matcher.rb2
-rw-r--r--spec/support/shared_contexts/markdown_golden_master_shared_examples.rb2
-rw-r--r--spec/uploaders/object_storage_spec.rb2
-rw-r--r--tooling/danger/specs.rb2
40 files changed, 102 insertions, 46 deletions
diff --git a/.rubocop_todo/rails/negate_include.yml b/.rubocop_todo/rails/negate_include.yml
new file mode 100644
index 00000000000..74f469f325b
--- /dev/null
+++ b/.rubocop_todo/rails/negate_include.yml
@@ -0,0 +1,56 @@
+---
+# Cop supports --autocorrect.
+Rails/NegateInclude:
+ Details: grace period
+ Exclude:
+ - 'app/finders/projects_finder.rb'
+ - 'app/helpers/application_settings_helper.rb'
+ - 'app/helpers/projects_helper.rb'
+ - 'app/helpers/tree_helper.rb'
+ - 'app/models/integrations/chat_message/pipeline_message.rb'
+ - 'app/models/integrations/field.rb'
+ - 'app/models/label.rb'
+ - 'app/models/merge_request.rb'
+ - 'app/models/milestone.rb'
+ - 'app/services/todo_service.rb'
+ - 'app/services/work_items/parent_links/create_service.rb'
+ - 'config/application.rb'
+ - 'config/initializers/1_settings.rb'
+ - 'danger/roulette/Dangerfile'
+ - 'ee/app/finders/security/pipeline_vulnerabilities_finder.rb'
+ - 'ee/app/models/ee/vulnerability.rb'
+ - 'ee/app/services/epic_issues/create_service.rb'
+ - 'ee/app/services/security/ingestion/tasks/ingest_remediations.rb'
+ - 'ee/app/services/security/security_orchestration_policies/validate_policy_service.rb'
+ - 'lib/api/maven_packages.rb'
+ - 'lib/gitlab/background_migration/legacy_upload_mover.rb'
+ - 'lib/gitlab/ci/build/rules/rule/clause/exists.rb'
+ - 'lib/gitlab/ci/parsers/coverage/sax_document.rb'
+ - 'lib/gitlab/ci/queue/metrics.rb'
+ - 'lib/gitlab/database/each_database.rb'
+ - 'lib/gitlab/email/handler/create_issue_handler.rb'
+ - 'lib/gitlab/email/handler/service_desk_handler.rb'
+ - 'lib/gitlab/graphql/queries.rb'
+ - 'lib/gitlab/import_export/attributes_permitter.rb'
+ - 'lib/gitlab/search_results.rb'
+ - 'lib/gitlab/task_helpers.rb'
+ - 'lib/gitlab/url_blocker.rb'
+ - 'lib/gitlab_edition.rb'
+ - 'qa/qa/page/merge_request/show.rb'
+ - 'qa/qa/runtime/ip_address.rb'
+ - 'qa/qa/support/run.rb'
+ - 'qa/qa/tools/delete_test_users.rb'
+ - 'rubocop/cop/gitlab/feature_available_usage.rb'
+ - 'rubocop/cop/graphql/id_type.rb'
+ - 'rubocop/cop/migration/add_reference.rb'
+ - 'rubocop/cop/rspec/factory_bot/inline_association.rb'
+ - 'scripts/lib/gitlab.rb'
+ - 'scripts/static-analysis'
+ - 'spec/lib/container_registry/blob_spec.rb'
+ - 'spec/lib/container_registry/client_spec.rb'
+ - 'spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb'
+ - 'spec/lib/gitlab/metrics/subscribers/active_record_spec.rb'
+ - 'spec/support/matchers/pushed_frontend_feature_flags_matcher.rb'
+ - 'spec/support/shared_contexts/markdown_golden_master_shared_examples.rb'
+ - 'spec/uploaders/object_storage_spec.rb'
+ - 'tooling/danger/specs.rb'
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index 6b1c52c357e..3c42a1f769f 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -134,7 +134,7 @@ class ProjectsFinder < UnionFinder
public_visibility_levels = Gitlab::VisibilityLevel.levels_for_user(current_user)
- public_visibility_levels.exclude?(params[:visibility_level].to_i)
+ !public_visibility_levels.include?(params[:visibility_level].to_i)
end
def owned_projects?
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 4fb53fcc738..f573aa34730 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -104,7 +104,7 @@ module ApplicationSettingsHelper
def oauth_providers_checkboxes(form)
button_based_providers.map do |source|
- checked = @application_setting.disabled_oauth_sign_in_sources.exclude?(source.to_s)
+ checked = !@application_setting.disabled_oauth_sign_in_sources.include?(source.to_s)
name = Gitlab::Auth::OAuth::Provider.label_for(source)
form.gitlab_ui_checkbox_component(
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index a3fbf78c919..d44ba35bb44 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -696,7 +696,7 @@ module ProjectsHelper
def project_allowed_visibility_levels(project)
Gitlab::VisibilityLevel.values.select do |level|
- project.visibility_level_allowed?(level) && restricted_levels.exclude?(level)
+ project.visibility_level_allowed?(level) && !restricted_levels.include?(level)
end
end
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 6f8b80aead9..370dbb10462 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -96,7 +96,7 @@ module TreeHelper
part_path = File.join(part_path, part) unless part_path.empty?
part_path = part if part_path.empty?
- next if parts.count > max_links && parts.last(2).exclude?(part)
+ next if parts.count > max_links && !parts.last(2).include?(part)
yield(part, part_path)
end
diff --git a/app/models/integrations/chat_message/pipeline_message.rb b/app/models/integrations/chat_message/pipeline_message.rb
index 815b260f6a3..88db40bea7f 100644
--- a/app/models/integrations/chat_message/pipeline_message.rb
+++ b/app/models/integrations/chat_message/pipeline_message.rb
@@ -96,7 +96,7 @@ module Integrations
failed_jobs = builds.select do |build|
# Select jobs which doesn't have a successful retry
- build[:status] == 'failed' && succeeded_job_names.exclude?(build[:name])
+ build[:status] == 'failed' && !succeeded_job_names.include?(build[:name])
end
failed_jobs.uniq { |job| job[:name] }.reverse
diff --git a/app/models/integrations/field.rb b/app/models/integrations/field.rb
index 5931a34fca9..53c8f5f623e 100644
--- a/app/models/integrations/field.rb
+++ b/app/models/integrations/field.rb
@@ -28,7 +28,7 @@ module Integrations
invalid_attributes = attributes.keys - ATTRIBUTES
if invalid_attributes.present?
raise ArgumentError, "Invalid attributes #{invalid_attributes.inspect}"
- elsif TYPES.exclude?(self[:type])
+ elsif !TYPES.include?(self[:type])
raise ArgumentError, "Invalid type #{self[:type].inspect}"
end
end
diff --git a/app/models/label.rb b/app/models/label.rb
index 8637df72fed..aa53c0e0f3f 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -285,7 +285,7 @@ class Label < ApplicationRecord
def label_format_reference(format = :id)
raise StandardError, 'Unknown format' unless [:id, :name].include?(format)
- if format == :name && name.exclude?('"')
+ if format == :name && !name.include?('"')
%("#{name}")
else
id
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index cccf2c918b0..6987bccadcb 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -733,7 +733,7 @@ class MergeRequest < ApplicationRecord
def merge_participants
participants = [author]
- if auto_merge_enabled? && participants.exclude?(merge_user)
+ if auto_merge_enabled? && !participants.include?(merge_user)
participants << merge_user
end
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index ba5b84add7d..da07d8dd9fc 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -263,7 +263,7 @@ class Milestone < ApplicationRecord
raise ArgumentError, _('Cannot refer to a group milestone by an internal id!')
end
- if format == :name && name.exclude?('"')
+ if format == :name && !name.include?('"')
%("#{name}")
else
iid
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index afb69149cea..06352d36215 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -235,7 +235,7 @@ class TodoService
).distinct_user_ids
end
- if users_multiple_todos.present? && Todo::ACTIONS_MULTIPLE_ALLOWED.exclude?(attributes.fetch(:action))
+ if users_multiple_todos.present? && !Todo::ACTIONS_MULTIPLE_ALLOWED.include?(attributes.fetch(:action))
excluded_user_ids += pending_todos(
users_multiple_todos,
attributes.slice(:project_id, :target_id, :target_type, :commit_id, :discussion, :action)
diff --git a/app/services/work_items/parent_links/create_service.rb b/app/services/work_items/parent_links/create_service.rb
index 81d90f5feab..e7906f1fcdd 100644
--- a/app/services/work_items/parent_links/create_service.rb
+++ b/app/services/work_items/parent_links/create_service.rb
@@ -30,7 +30,7 @@ module WorkItems
def linkable?(work_item)
can?(current_user, :admin_parent_link, work_item) &&
- previous_related_issuables.exclude?(work_item)
+ !previous_related_issuables.include?(work_item)
end
def previous_related_issuables
diff --git a/config/application.rb b/config/application.rb
index 597f19c7f3c..51818579ccf 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -525,7 +525,7 @@ module Gitlab
LOOSE_APP_ASSETS = lambda do |logical_path, filename|
filename.start_with?(*asset_roots) &&
- ['.js', '.css', '.md', '.vue', '.graphql', ''].exclude?(File.extname(logical_path))
+ !['.js', '.css', '.md', '.vue', '.graphql', ''].include?(File.extname(logical_path))
end
app.config.assets.precompile << LOOSE_APP_ASSETS
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 0e3f4e8e189..d0a67c13622 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -932,7 +932,7 @@ Gitlab.ee do
Settings.kerberos['https'] = Settings.gitlab.https if Settings.kerberos['https'].nil?
Settings.kerberos['port'] ||= Settings.kerberos.https ? 8443 : 8088
- if Settings.kerberos['enabled'] && Settings.omniauth.providers.map(&:name).exclude?('kerberos')
+ if Settings.kerberos['enabled'] && !Settings.omniauth.providers.map(&:name).include?('kerberos')
Settings.omniauth.providers << Settingslogic.new({ 'name' => 'kerberos' })
end
end
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index 8f2d01390e1..ca5a671ef29 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -96,7 +96,7 @@ categories = Set.new(changes.keys - [:unknown])
categories << :database if helper.mr_labels.include?('database')
# Ensure to spin for UX reviewer when ~UX is applied (e.g. to review changes to the UI) except when it's from wider community contribution where we want to assign from the corresponding group
-categories << :ux if helper.mr_labels.include?('UX') && helper.mr_labels.exclude?('Community contribution')
+categories << :ux if helper.mr_labels.include?('UX') && !helper.mr_labels.include?('Community contribution')
# Ensure to spin for Product Intelligence reviewer when ~"product intelligence::review pending" is applied
categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending")
diff --git a/lib/api/maven_packages.rb b/lib/api/maven_packages.rb
index a82f53cf738..638ce6dbedc 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].exclude?(::Packages::Maven::FindOrCreatePackageService::SNAPSHOT_TERM)
+ !params[:path].include?(::Packages::Maven::FindOrCreatePackageService::SNAPSHOT_TERM)
::Packages::Maven::PackageFinder.new(
current_user,
diff --git a/lib/gitlab/background_migration/legacy_upload_mover.rb b/lib/gitlab/background_migration/legacy_upload_mover.rb
index 2b2a7d65d08..1879a6c5427 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.exclude?(old_path_sub)
+ if !File.exist?(old_path) || !old_path.include?(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 d3cc9337fd9..c55615bb83b 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.exclude?('/') && glob.exclude?('**')
+ !glob.include?('/') && !glob.include?('**')
end
# matches glob patterns that have no metacharacters for File#fnmatch?
def exact_glob?(glob)
- glob.exclude?('*') && glob.exclude?('?') && glob.exclude?('[') && glob.exclude?('{')
+ !glob.include?('*') && !glob.include?('?') && !glob.include?('[') && !glob.include?('{')
end
end
end
diff --git a/lib/gitlab/ci/parsers/coverage/sax_document.rb b/lib/gitlab/ci/parsers/coverage/sax_document.rb
index eafeaf9d505..ddd9c80f5ea 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.exclude?(GO_SOURCE_PATTERN)
+ return unless project_path && paths && !node.include?(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 0273a13e6f2..5cee73238ca 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.exclude?(queue)
+ if !Rails.env.production? && !QUEUE_DEPTH_HISTOGRAMS.include?(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.exclude?(operation)
+ if !Rails.env.production? && !OPERATION_COUNTERS.include?(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 dcf2ab9dec8..02f008abf85 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.exclude?(connection_name.to_sym)
+ next if selected_databases.present? && !selected_databases.include?(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.exclude?(connection_name.to_sym)
+ return if selected_databases.present? && !selected_databases.include?(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 c41c93b6ec0..e21a88c4e0d 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.exclude?('+') && mail_key.exclude?(Gitlab::Email::Common::UNSUBSCRIBE_SUFFIX_LEGACY)
+ project_path && !incoming_email_token.include?('+') && !mail_key.include?(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 8b436bb7a29..06365296a76 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.exclude?('+')
+ project_path && project_path.include?('/') && !mail_key.include?('+')
end
def author
diff --git a/lib/gitlab/graphql/queries.rb b/lib/gitlab/graphql/queries.rb
index b97a003813d..cf06a2729d9 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.exclude?(v.name)
+ @skipped_arguments.include?(v.name) && !@printed_arguments.include?(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.exclude?(fragment_def.name)
+ if skips? && @skipped_fragments.include?(fragment_def.name) && !@used_fragments.include?(fragment_def.name)
return ''
end
diff --git a/lib/gitlab/import_export/attributes_permitter.rb b/lib/gitlab/import_export/attributes_permitter.rb
index 67c6a1f0649..8c7a6c13246 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.exclude?(relation_sym) && @attributes_finder.included_attributes.key?(relation_sym)
+ !DISABLED_RELATION_NAMES.include?(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 8658fa343e2..37414f9e2b1 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].exclude?(scope)
+ sort_by = nil if SCOPE_ONLY_SORT[sort_by] && !SCOPE_ONLY_SORT[sort_by].include?(scope)
case sort_by
when :created_at_asc
diff --git a/lib/gitlab/task_helpers.rb b/lib/gitlab/task_helpers.rb
index 38ad7712e73..54db31ffd6c 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.exclude?(answer)
+ end while choices.present? && !choices.include?(answer)
answer
end
diff --git a/qa/qa/tools/delete_test_users.rb b/qa/qa/tools/delete_test_users.rb
index 847a2d19e62..30d3a82fb1b 100644
--- a/qa/qa/tools/delete_test_users.rb
+++ b/qa/qa/tools/delete_test_users.rb
@@ -22,7 +22,7 @@ module QA
raise ArgumentError, "Please provide GITLAB_QA_ADMIN_ACCESS_TOKEN" unless ENV['GITLAB_QA_ADMIN_ACCESS_TOKEN']
@api_client = Runtime::API::Client.new(ENV['GITLAB_ADDRESS'], personal_access_token: ENV['GITLAB_QA_ADMIN_ACCESS_TOKEN'])
- @dry_run = FALSY_VALUES.exclude?(dry_run.to_s.downcase)
+ @dry_run = !FALSY_VALUES.include?(dry_run.to_s.downcase)
@delete_before = Date.parse(delete_before)
@page_no = '1'
@exclude_users = Array(exclude_users.to_s.split(',')) + EXCLUDE_USERS
@@ -61,7 +61,7 @@ module QA
JSON.parse(response.body).select do |user|
user['username'].start_with?('qa-user-', 'test-user-') \
&& (user['name'] == 'QA Tests' || user['name'].start_with?('QA User')) \
- && @exclude_users.exclude?(user['username']) \
+ && !@exclude_users.include?(user['username']) \
&& Date.parse(user.fetch('created_at', Date.today.to_s)) < @delete_before
end
end
diff --git a/rubocop/cop/gitlab/feature_available_usage.rb b/rubocop/cop/gitlab/feature_available_usage.rb
index 16f23bb06c4..fcf4992a19d 100644
--- a/rubocop/cop/gitlab/feature_available_usage.rb
+++ b/rubocop/cop/gitlab/feature_available_usage.rb
@@ -39,7 +39,7 @@ module RuboCop
return if feature_name(node).nil?
return if ALL_FEATURES.include?(feature_name(node)) && args_count(node) == 2
- if ALL_FEATURES.exclude?(feature_name(node))
+ if !ALL_FEATURES.include?(feature_name(node))
add_offense(node, message: licensed_feature_message(node))
elsif args_count(node) < 2
add_offense(node, message: NOT_ENOUGH_ARGS_MSG)
diff --git a/rubocop/cop/graphql/id_type.rb b/rubocop/cop/graphql/id_type.rb
index a86c31de2d4..eb677aa4507 100644
--- a/rubocop/cop/graphql/id_type.rb
+++ b/rubocop/cop/graphql/id_type.rb
@@ -21,7 +21,7 @@ module RuboCop
private
def does_not_match?(arg)
- WHITELISTED_ARGUMENTS.exclude?(arg)
+ !WHITELISTED_ARGUMENTS.include?(arg)
end
end
end
diff --git a/rubocop/cop/migration/add_reference.rb b/rubocop/cop/migration/add_reference.rb
index 6f2648c8f93..02a0ef899b4 100644
--- a/rubocop/cop/migration/add_reference.rb
+++ b/rubocop/cop/migration/add_reference.rb
@@ -41,7 +41,7 @@ module RuboCop
private
def existing_table?(new_tables, table)
- new_tables.exclude?(table)
+ !new_tables.include?(table)
end
def create_table?(node)
diff --git a/rubocop/cop/rspec/factory_bot/inline_association.rb b/rubocop/cop/rspec/factory_bot/inline_association.rb
index a770dac9794..8d7c73b99a0 100644
--- a/rubocop/cop/rspec/factory_bot/inline_association.rb
+++ b/rubocop/cop/rspec/factory_bot/inline_association.rb
@@ -99,7 +99,7 @@ module RuboCop
def inside_assocation_definition?(node)
node.each_ancestor(:block).any? do |parent|
name = association_definition(parent)
- name && SKIP_NAMES.exclude?(name)
+ name && !SKIP_NAMES.include?(name)
end
end
end
diff --git a/spec/lib/container_registry/blob_spec.rb b/spec/lib/container_registry/blob_spec.rb
index 0f8b894cbd8..676adc74be2 100644
--- a/spec/lib/container_registry/blob_spec.rb
+++ b/spec/lib/container_registry/blob_spec.rb
@@ -100,7 +100,7 @@ RSpec.describe ContainerRegistry::Blob do
context 'for a valid address' do
before do
stub_request(:get, location)
- .with { |request| request.headers.exclude?('Authorization') }
+ .with { |request| !request.headers.include?('Authorization') }
.to_return(
status: 200,
headers: { 'Content-Type' => 'application/json' },
@@ -115,7 +115,7 @@ RSpec.describe ContainerRegistry::Blob do
context 'for a relative address' do
before do
stub_request(:get, 'http://registry.gitlab/relative')
- .with { |request| request.headers.exclude?('Authorization') }
+ .with { |request| !request.headers.include?('Authorization') }
.to_return(
status: 200,
headers: { 'Content-Type' => 'application/json' },
diff --git a/spec/lib/container_registry/client_spec.rb b/spec/lib/container_registry/client_spec.rb
index b3e454fdc42..cb2da24b712 100644
--- a/spec/lib/container_registry/client_spec.rb
+++ b/spec/lib/container_registry/client_spec.rb
@@ -180,7 +180,7 @@ RSpec.describe ContainerRegistry::Client do
# https://github.com/bblimke/webmock/blob/master/lib/webmock/matchers/hash_excluding_matcher.rb
stub_request(:get, redirect_location)
.with(headers: redirect_header) do |request|
- request.headers.exclude?('Authorization')
+ !request.headers.include?('Authorization')
end
.to_return(status: 200, body: "Successfully redirected")
end
diff --git a/spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb b/spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb
index 93bb01ce895..bb3c8626d32 100644
--- a/spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter do
transform!
expect(all_metrics).to satisfy_all do |metric|
- metric[:prometheus_endpoint_path].present? && metric[:prometheus_endpoint_path].exclude?("\n")
+ metric[:prometheus_endpoint_path].present? && !metric[:prometheus_endpoint_path].include?("\n")
end
end
diff --git a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
index 540231b8024..005c1ae2d0a 100644
--- a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
+++ b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
@@ -219,7 +219,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
# Emulate Marginalia pre-pending comments
def sql(query, comments: true)
- if comments && %w[BEGIN COMMIT].exclude?(query)
+ if comments && !%w[BEGIN COMMIT].include?(query)
"/*application:web,controller:badges,action:pipeline,correlation_id:01EYN39K9VMJC56Z7808N7RSRH*/ #{query}"
else
query
@@ -284,7 +284,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
# Emulate Marginalia pre-pending comments
def sql(query, comments: true)
- if comments && %w[BEGIN COMMIT].exclude?(query)
+ if comments && !%w[BEGIN COMMIT].include?(query)
"/*application:web,controller:badges,action:pipeline,correlation_id:01EYN39K9VMJC56Z7808N7RSRH*/ #{query}"
else
query
diff --git a/spec/support/matchers/pushed_frontend_feature_flags_matcher.rb b/spec/support/matchers/pushed_frontend_feature_flags_matcher.rb
index 25a472e2c2b..ecd174edec9 100644
--- a/spec/support/matchers/pushed_frontend_feature_flags_matcher.rb
+++ b/spec/support/matchers/pushed_frontend_feature_flags_matcher.rb
@@ -17,7 +17,7 @@ RSpec::Matchers.define :have_pushed_frontend_feature_flags do |expected|
failure_message do |actual|
missing = expected.select do |feature_flag_name, enabled|
- html(actual).exclude?(to_js(feature_flag_name, enabled))
+ !html(actual).include?(to_js(feature_flag_name, enabled))
end
formatted_missing_flags = missing.map { |feature_flag_name, enabled| to_js(feature_flag_name, enabled) }.join("\n")
diff --git a/spec/support/shared_contexts/markdown_golden_master_shared_examples.rb b/spec/support/shared_contexts/markdown_golden_master_shared_examples.rb
index 4d292d265a7..72e23e6d5fa 100644
--- a/spec/support/shared_contexts/markdown_golden_master_shared_examples.rb
+++ b/spec/support/shared_contexts/markdown_golden_master_shared_examples.rb
@@ -44,7 +44,7 @@ RSpec.shared_context 'API::Markdown Golden Master shared context' do |markdown_y
if focused_markdown_examples_string = ENV['FOCUSED_MARKDOWN_EXAMPLES']
focused_markdown_examples = focused_markdown_examples_string.split(',').map(&:strip) || []
- markdown_examples.reject! { |markdown_example| focused_markdown_examples.exclude?(markdown_example.fetch(:name)) }
+ markdown_examples.reject! { |markdown_example| !focused_markdown_examples.include?(markdown_example.fetch(:name)) }
end
markdown_examples.each do |markdown_example|
diff --git a/spec/uploaders/object_storage_spec.rb b/spec/uploaders/object_storage_spec.rb
index 9b48f1fdd8e..a4f6116f7d7 100644
--- a/spec/uploaders/object_storage_spec.rb
+++ b/spec/uploaders/object_storage_spec.rb
@@ -283,7 +283,7 @@ RSpec.describe ObjectStorage do
# We need to check the Host header not including the port because AWS does not accept
stub_request(:get, %r{s3.amazonaws.com/#{uploader.path}})
- .with { |request| request.headers['Host'].to_s.exclude?(':443') }
+ .with { |request| !request.headers['Host'].to_s.include?(':443') }
.to_return(status: 200, body: '')
end
diff --git a/tooling/danger/specs.rb b/tooling/danger/specs.rb
index 32e8e404520..c7baf920314 100644
--- a/tooling/danger/specs.rb
+++ b/tooling/danger/specs.rb
@@ -132,7 +132,7 @@ module Tooling
def find_line_number(file_lines, searched_line, exclude_indexes: [])
_, index = file_lines.each_with_index.find do |file_line, index|
- file_line == searched_line && exclude_indexes.exclude?(index)
+ file_line == searched_line && !exclude_indexes.include?(index)
end
index