diff --git a/.rubocop_todo/lint/ambiguous_operator_precedence.yml b/.rubocop_todo/lint/ambiguous_operator_precedence.yml index 1c4a3726a61552bf1960e5bf9bde2da434c96313..840bcc84eedeb86cadd5eba1fa45a68092bdd2fa 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 dff3652f3ca18729f42931b22b6a2adff95aecb4..ffc539637460d41deb7e67f200e1280e27e9e1e9 100644 --- a/lib/omni_auth/strategies/bitbucket.rb +++ b/lib/omni_auth/strategies/bitbucket.rb @@ -32,12 +32,12 @@ def raw_info 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/ee/page/project/secure/pipeline_security.rb b/qa/qa/ee/page/project/secure/pipeline_security.rb index 328228aa77d4a7433dc5e1ea8437a57824901e69..6e853bbefa2c2f1e95a30a94857a7ad813d9685b 100644 --- a/qa/qa/ee/page/project/secure/pipeline_security.rb +++ b/qa/qa/ee/page/project/secure/pipeline_security.rb @@ -95,7 +95,7 @@ def toggle_hide_dismissed(toggle_to) within_element('findings-hide-dismissed-toggle') do toggle = find('button.gl-toggle') checked = toggle[:class].include?('is-checked') - toggle.click if checked && toggle_to == "off" || !checked && toggle_to == "on" + toggle.click if (checked && toggle_to == "off") || (!checked && toggle_to == "on") end end diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index 838324496ebec1a85fb96e11bcf2bdff60dd9a27..849babd5e38c79e8761a4f100658b2931df1237a 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -15,8 +15,8 @@ module ApiFabricator 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 cfb2d1a1bca9c00035cfbc563b458a2607b21d1f..7146361880399b2ea5e876cd122f55a7dfd1c2db 100644 --- a/qa/qa/resource/group_access_token.rb +++ b/qa/qa/resource/group_access_token.rb @@ -73,7 +73,7 @@ def revoke_via_ui! # 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 d6d0e0ba6749a4f961cbfbcca7b9ca80d2931c1f..6fa366ab01f73aa25b7c1b75969dc81f902bbf60 100644 --- a/qa/qa/resource/impersonation_token.rb +++ b/qa/qa/resource/impersonation_token.rb @@ -68,7 +68,7 @@ def revoke_via_browser_ui! # 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 8bb782ee6dbdfd19e319c8c4da0bb912ab31f911..aa60932bb8adcf489d84a6d806abfd5a0022a751 100644 --- a/qa/qa/resource/project_access_token.rb +++ b/qa/qa/resource/project_access_token.rb @@ -73,7 +73,7 @@ def revoke_via_ui! # 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 5e1dd696405342b505b02c063d40ca3ded218553..317db50e82371e37d7c9cff55e1b2c6df6b58807 100644 --- a/qa/qa/runtime/feature.rb +++ b/qa/qa/runtime/feature.rb @@ -56,7 +56,7 @@ def enabled?(key, **scopes) 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 @@ def set_and_verify(key, enable:, **scopes) 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 343a6e3b9eed29d0d878449eaefdd5799912b399..7d455f59bfb258624dd1430664d5ef3c21a36410 100644 --- a/qa/qa/tools/test_resources_handler.rb +++ b/qa/qa/tools/test_resources_handler.rb @@ -250,7 +250,7 @@ def filter_resources(resources) 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