Skip to content
Snippets Groups Projects
Commit 23022cf7 authored by Harry Minsky's avatar Harry Minsky
Browse files

Fix Lint/RedundantSafeNavigation offenses

Changelog: other

EE: true
parent 864c303a
No related branches found
No related tags found
2 merge requests!148930Uses billable_member util in PreviewBillableUserChangeService,!148581Fix Lint/RedundantSafeNavigation offenses
---
# Cop supports --autocorrect.
Lint/RedundantSafeNavigation:
Exclude:
- 'app/controllers/import/base_controller.rb'
- 'app/graphql/resolvers/users_resolver.rb'
- 'app/graphql/types/countable_connection_type.rb'
- 'app/helpers/search_helper.rb'
- 'ee/app/graphql/ee/types/issue_connection_type.rb'
- 'ee/app/models/search/namespace_index_assignment.rb'
- 'lib/api/projects.rb'
- 'lib/sidebars/projects/menus/infrastructure_menu.rb'
- 'spec/lib/gitlab/redis/multi_store_spec.rb'
......@@ -15,7 +15,7 @@ def status
incompatible_repos: serialized_incompatible_repos }
end
format.html do
if params[:namespace_id]&.present?
if params[:namespace_id].present?
@namespace = Namespace.find_by_id(params[:namespace_id])
render_404 unless current_user.can?(:import_projects, @namespace)
......
......@@ -48,7 +48,7 @@ def ready?(**args)
return super if args.values.compact.blank?
if args[:usernames]&.present? && args[:ids]&.present?
if args[:usernames].present? && args[:ids].present?
raise Gitlab::Graphql::Errors::ArgumentError, 'Provide either a list of usernames or ids'
end
......
......@@ -14,7 +14,7 @@ def count
relation = relation.reorder(nil) if relation.respond_to?(:reorder)
# rubocop: enable CodeReuse/ActiveRecord
if relation.try(:group_values)&.present?
if relation.try(:group_values).present?
relation.size.keys.size
else
relation.size
......
......@@ -204,11 +204,11 @@ def search_group
end
def search_has_group?
search_group&.present? && search_group&.persisted?
search_group.present? && search_group&.persisted?
end
def search_has_project?
@project&.present? && @project&.persisted?
@project.present? && @project&.persisted?
end
def header_search_context
......@@ -228,7 +228,7 @@ def header_search_context
end
hash[:scope] = search_scope if search_has_project? || search_has_group?
hash[:for_snippets] = @snippet&.present? || @snippets&.any?
hash[:for_snippets] = @snippet.present? || @snippets&.any?
end
end
......
......@@ -18,7 +18,7 @@ def weight
result = relation.sum(:weight)
if relation.try(:group_values)&.present?
if relation.try(:group_values).present?
result.values.sum
else
result
......
......@@ -37,7 +37,7 @@ def set_namespace_id_non_nullable
end
def set_index_type
self.index_type = index&.type if index&.present?
self.index_type = index&.type if index.present?
end
def only_root_namespaces_can_be_indexed
......
......@@ -228,7 +228,7 @@ def translate_params_for_compatibility(params)
end
def add_import_params(params)
params[:import_type] = 'git' if params[:import_url]&.present?
params[:import_type] = 'git' if params[:import_url].present?
params
end
end
......
......@@ -123,7 +123,7 @@ def google_cloud_menu_item
def google_oauth2_configured?
config = Gitlab::Auth::OAuth::Provider.config_for('google_oauth2')
config&.present? && config.app_id.present? && config.app_secret.present?
config.present? && config.app_id.present? && config.app_secret.present?
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment