diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-08-24 14:21:46 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-05 12:18:32 +0200 |
commit | 7ad7222a5fb2790353e772416090399b9896b129 (patch) | |
tree | 28abc35d7927d2ec40bb25376d98d0e87d5fa049 /lib | |
parent | 00392d929b4553a9ed8e1938cb11f091b79566c9 (diff) | |
download | gitlab-ce-7ad7222a5fb2790353e772416090399b9896b129.tar.gz |
simplify if/else with guards
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/gpg/commit.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/gitlab/gpg/commit.rb b/lib/gitlab/gpg/commit.rb index 7aaf3f6aa5b..043045ceba7 100644 --- a/lib/gitlab/gpg/commit.rb +++ b/lib/gitlab/gpg/commit.rb @@ -83,16 +83,16 @@ module Gitlab end def verification_status(gpg_key) - if gpg_key && gpg_key.verified_and_belongs_to_email?(@commit.committer_email) && verified_signature.valid? + return GpgSignature.verification_statuses[:unknown_key] unless gpg_key + return GpgSignature.verification_statuses[:unverified_key] unless gpg_key.verified? + return GpgSignature.verification_statuses[:unverified] unless verified_signature.valid? + + if gpg_key.verified_and_belongs_to_email?(@commit.committer_email) GpgSignature.verification_statuses[:verified] - elsif gpg_key && gpg_key.verified? && verified_signature.valid? && gpg_key.user.all_emails.include?(@commit.committer_email) + elsif gpg_key.user.all_emails.include?(@commit.committer_email) GpgSignature.verification_statuses[:same_user_different_email] - elsif gpg_key && gpg_key.verified? && verified_signature.valid? - GpgSignature.verification_statuses[:other_user] - elsif gpg_key - GpgSignature.verification_statuses[:unverified_key] else - GpgSignature.verification_statuses[:unknown_key] + GpgSignature.verification_statuses[:other_user] end end |