[go: up one dir, main page]

Snippet repo: Remove safe navigators and return early

The following discussion from !205897 (merged) should be addressed:

  • @jwoodwardgl started a discussion: (+1 comment)

    nitpick(non-blocking) you've already verified that snippet exists so the extra safe navigator is unnecessary

        self.organization = snippet.organization if snippet&.organization_id.present?
        self.project = snippet.project if snippet&.project_id.present?

    In fact, we can actually just return early if there's no snippet and remove all safe navigators

        return if compact_sharding_keys.size == 1 || snippet.nil?
    
        self.organization = snippet.organization if snippet.organization_id.present?
        self.project = snippet.project if snippet.project_id.present?
Edited by 🤖 GitLab Bot 🤖