Skip to content
代码片段 群组 项目
未验证 提交 45c17479 编辑于 作者: Thong Kuah's avatar Thong Kuah 提交者: GitLab
浏览文件

Merge branch '239356-Lint/AmbiguousOperatorPrecedence7' into 'master'

Fix Lint/AmbiguousOperatorPrecedence 8 offenses

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151162



Merged-by: default avatarThong Kuah <tkuah@gitlab.com>
Approved-by: default avatarThong Kuah <tkuah@gitlab.com>
Approved-by: default avatarAndrew Evans <aevans@gitlab.com>
Co-authored-by: default avatarArchish <archishthakkar@gmail.com>
No related branches found
No related tags found
无相关合并请求
...@@ -42,15 +42,6 @@ Lint/AmbiguousOperatorPrecedence: ...@@ -42,15 +42,6 @@ Lint/AmbiguousOperatorPrecedence:
- 'lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb' - 'lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb'
- 'lib/gitlab/database/postgres_hll/buckets.rb' - 'lib/gitlab/database/postgres_hll/buckets.rb'
- 'lib/gitlab/database/query_analyzers/prevent_cross_database_modification.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/packages/automated_cleanup.rb'
- 'scripts/perf/gc/print_gc_stats.rb' - 'scripts/perf/gc/print_gc_stats.rb'
- 'scripts/perf/query_limiting_report.rb' - 'scripts/perf/query_limiting_report.rb'
......
...@@ -32,12 +32,12 @@ def raw_info ...@@ -32,12 +32,12 @@ def raw_info
def primary_email def primary_email
primary = emails.find { |i| i['is_primary'] && i['is_confirmed'] } primary = emails.find { |i| i['is_primary'] && i['is_confirmed'] }
primary && primary['email'] || nil (primary && primary['email']) || nil
end end
def emails def emails
email_response = access_token.get('api/2.0/user/emails').parsed email_response = access_token.get('api/2.0/user/emails').parsed
@emails ||= email_response && email_response['values'] || [] @emails ||= (email_response && email_response['values']) || []
end end
def callback_url def callback_url
......
...@@ -95,7 +95,7 @@ def toggle_hide_dismissed(toggle_to) ...@@ -95,7 +95,7 @@ def toggle_hide_dismissed(toggle_to)
within_element('findings-hide-dismissed-toggle') do within_element('findings-hide-dismissed-toggle') do
toggle = find('button.gl-toggle') toggle = find('button.gl-toggle')
checked = toggle[:class].include?('is-checked') 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
end end
......
...@@ -15,8 +15,8 @@ module ApiFabricator ...@@ -15,8 +15,8 @@ module ApiFabricator
attr_accessor :api_user, :api_resource, :api_response attr_accessor :api_user, :api_resource, :api_response
def api_support? def api_support?
respond_to?(:api_get_path) && (respond_to?(:api_get_path) &&
(respond_to?(:api_post_path) && respond_to?(:api_post_body)) || (respond_to?(:api_post_path) && respond_to?(:api_post_body))) ||
(respond_to?(:api_put_path) && respond_to?(:api_put_body)) (respond_to?(:api_put_path) && respond_to?(:api_put_body))
end end
......
...@@ -73,7 +73,7 @@ def revoke_via_ui! ...@@ -73,7 +73,7 @@ def revoke_via_ui!
# Expire in 2 days just in case the token is created just before midnight # Expire in 2 days just in case the token is created just before midnight
def expires_at def expires_at
@expires_at || Time.now.utc.to_date + 2 @expires_at || (Time.now.utc.to_date + 2)
end end
def fabricate! def fabricate!
......
...@@ -68,7 +68,7 @@ def revoke_via_browser_ui! ...@@ -68,7 +68,7 @@ def revoke_via_browser_ui!
# Expire in 2 days just in case the token is created just before midnight # Expire in 2 days just in case the token is created just before midnight
def expires_at def expires_at
@expires_at || Time.now.utc.to_date + 2 @expires_at || (Time.now.utc.to_date + 2)
end end
def fabricate! def fabricate!
......
...@@ -73,7 +73,7 @@ def revoke_via_ui! ...@@ -73,7 +73,7 @@ def revoke_via_ui!
# Expire in 2 days just in case the token is created just before midnight # Expire in 2 days just in case the token is created just before midnight
def expires_at def expires_at
@expires_at || Time.now.utc.to_date + 2 @expires_at || (Time.now.utc.to_date + 2)
end end
def fabricate! def fabricate!
......
...@@ -56,7 +56,7 @@ def enabled?(key, **scopes) ...@@ -56,7 +56,7 @@ def enabled?(key, **scopes)
feature = JSON.parse(get_features).find { |flag| flag['name'] == key.to_s } feature = JSON.parse(get_features).find { |flag| flag['name'] == key.to_s }
if feature if feature
feature['state'] == 'on' || feature['state'] == 'on' ||
feature['state'] == 'conditional' && scopes.present? && enabled_scope?(feature['gates'], **scopes) (feature['state'] == 'conditional' && scopes.present? && enabled_scope?(feature['gates'], **scopes))
else else
# The feature wasn't found via the API so we check for a default value. # The feature wasn't found via the API so we check for a default value.
# We expand the path include both ee and jh. # We expand the path include both ee and jh.
...@@ -122,7 +122,7 @@ def set_and_verify(key, enable:, **scopes) ...@@ -122,7 +122,7 @@ def set_and_verify(key, enable:, **scopes)
QA::Support::Waiter.wait_until(sleep_interval: 1) do QA::Support::Waiter.wait_until(sleep_interval: 1) do
is_enabled = enabled?(key, **scopes) is_enabled = enabled?(key, **scopes)
is_enabled == enable || !enable && scopes.present? is_enabled == enable || (!enable && scopes.present?)
end end
if is_enabled == enable if is_enabled == enable
......
...@@ -250,7 +250,7 @@ def filter_resources(resources) ...@@ -250,7 +250,7 @@ def filter_resources(resources)
transformed_values = resources.transform_values! do |v| transformed_values = resources.transform_values! do |v|
v.reject do |attributes| v.reject do |attributes|
attributes['info']&.match(/with full_path 'gitlab-qa-sandbox-group(-\d)?'/) || 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' attributes['api_path'] == 'Cannot find resource API path'
end end
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册