From b2b630bbc034662b5e4c862cda86ad1b24eea19e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 20 May 2024 00:19:18 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo/lint/ambiguous_operator_precedence.yml | 9 --------- lib/omni_auth/strategies/bitbucket.rb | 4 ++-- qa/qa/resource/api_fabricator.rb | 4 ++-- qa/qa/resource/group_access_token.rb | 2 +- qa/qa/resource/impersonation_token.rb | 2 +- qa/qa/resource/project_access_token.rb | 2 +- qa/qa/runtime/feature.rb | 4 ++-- qa/qa/tools/test_resources_handler.rb | 2 +- 8 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.rubocop_todo/lint/ambiguous_operator_precedence.yml b/.rubocop_todo/lint/ambiguous_operator_precedence.yml index 1c4a3726a61..840bcc84eed 100644 --- a/.rubocop_todo/lint/ambiguous_operator_precedence.yml +++ b/.rubocop_todo/lint/ambiguous_operator_precedence.yml @@ -42,15 +42,6 @@ Lint/AmbiguousOperatorPrecedence: - 'lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb' - 'lib/gitlab/database/postgres_hll/buckets.rb' - 'lib/gitlab/database/query_analyzers/prevent_cross_database_modification.rb' - - 'lib/omni_auth/strategies/bitbucket.rb' - - 'qa/qa/ee/page/project/secure/pipeline_security.rb' - - 'qa/qa/resource/api_fabricator.rb' - - 'qa/qa/resource/group_access_token.rb' - - 'qa/qa/resource/impersonation_token.rb' - - 'qa/qa/resource/personal_access_token.rb' - - 'qa/qa/resource/project_access_token.rb' - - 'qa/qa/runtime/feature.rb' - - 'qa/qa/tools/test_resources_handler.rb' - 'scripts/packages/automated_cleanup.rb' - 'scripts/perf/gc/print_gc_stats.rb' - 'scripts/perf/query_limiting_report.rb' diff --git a/lib/omni_auth/strategies/bitbucket.rb b/lib/omni_auth/strategies/bitbucket.rb index dff3652f3ca..ffc53963746 100644 --- a/lib/omni_auth/strategies/bitbucket.rb +++ b/lib/omni_auth/strategies/bitbucket.rb @@ -32,12 +32,12 @@ module OmniAuth def primary_email primary = emails.find { |i| i['is_primary'] && i['is_confirmed'] } - primary && primary['email'] || nil + (primary && primary['email']) || nil end def emails email_response = access_token.get('api/2.0/user/emails').parsed - @emails ||= email_response && email_response['values'] || [] + @emails ||= (email_response && email_response['values']) || [] end def callback_url diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index 838324496eb..849babd5e38 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -15,8 +15,8 @@ module QA attr_accessor :api_user, :api_resource, :api_response def api_support? - respond_to?(:api_get_path) && - (respond_to?(:api_post_path) && respond_to?(:api_post_body)) || + (respond_to?(:api_get_path) && + (respond_to?(:api_post_path) && respond_to?(:api_post_body))) || (respond_to?(:api_put_path) && respond_to?(:api_put_body)) end diff --git a/qa/qa/resource/group_access_token.rb b/qa/qa/resource/group_access_token.rb index cfb2d1a1bca..71463618803 100644 --- a/qa/qa/resource/group_access_token.rb +++ b/qa/qa/resource/group_access_token.rb @@ -73,7 +73,7 @@ module QA # Expire in 2 days just in case the token is created just before midnight def expires_at - @expires_at || Time.now.utc.to_date + 2 + @expires_at || (Time.now.utc.to_date + 2) end def fabricate! diff --git a/qa/qa/resource/impersonation_token.rb b/qa/qa/resource/impersonation_token.rb index d6d0e0ba674..6fa366ab01f 100644 --- a/qa/qa/resource/impersonation_token.rb +++ b/qa/qa/resource/impersonation_token.rb @@ -68,7 +68,7 @@ module QA # Expire in 2 days just in case the token is created just before midnight def expires_at - @expires_at || Time.now.utc.to_date + 2 + @expires_at || (Time.now.utc.to_date + 2) end def fabricate! diff --git a/qa/qa/resource/project_access_token.rb b/qa/qa/resource/project_access_token.rb index 8bb782ee6db..aa60932bb8a 100644 --- a/qa/qa/resource/project_access_token.rb +++ b/qa/qa/resource/project_access_token.rb @@ -73,7 +73,7 @@ module QA # Expire in 2 days just in case the token is created just before midnight def expires_at - @expires_at || Time.now.utc.to_date + 2 + @expires_at || (Time.now.utc.to_date + 2) end def fabricate! diff --git a/qa/qa/runtime/feature.rb b/qa/qa/runtime/feature.rb index 5e1dd696405..317db50e823 100644 --- a/qa/qa/runtime/feature.rb +++ b/qa/qa/runtime/feature.rb @@ -56,7 +56,7 @@ module QA feature = JSON.parse(get_features).find { |flag| flag['name'] == key.to_s } if feature feature['state'] == 'on' || - feature['state'] == 'conditional' && scopes.present? && enabled_scope?(feature['gates'], **scopes) + (feature['state'] == 'conditional' && scopes.present? && enabled_scope?(feature['gates'], **scopes)) else # The feature wasn't found via the API so we check for a default value. # We expand the path include both ee and jh. @@ -122,7 +122,7 @@ module QA QA::Support::Waiter.wait_until(sleep_interval: 1) do is_enabled = enabled?(key, **scopes) - is_enabled == enable || !enable && scopes.present? + is_enabled == enable || (!enable && scopes.present?) end if is_enabled == enable diff --git a/qa/qa/tools/test_resources_handler.rb b/qa/qa/tools/test_resources_handler.rb index 343a6e3b9ee..7d455f59bfb 100644 --- a/qa/qa/tools/test_resources_handler.rb +++ b/qa/qa/tools/test_resources_handler.rb @@ -250,7 +250,7 @@ module QA transformed_values = resources.transform_values! do |v| v.reject do |attributes| attributes['info']&.match(/with full_path 'gitlab-qa-sandbox-group(-\d)?'/) || - attributes['http_method'] == 'get' && !attributes['info']&.include?("with username 'qa-") || + (attributes['http_method'] == 'get' && !attributes['info']&.include?("with username 'qa-")) || attributes['api_path'] == 'Cannot find resource API path' end end