diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2019-02-08 14:19:53 +0200 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2019-03-06 17:51:56 +0200 |
commit | 3288e1a874ec0184f9f27f932748e51c57babf17 (patch) | |
tree | 9f8667f5349ecfc59f3c8a6e9641cb1e32fa3d5b /lib/gitlab/git | |
parent | 7bbdb2a29fbc7b8c9f879c42de7063adaa8313c7 (diff) | |
download | gitlab-ce-3288e1a874ec0184f9f27f932748e51c57babf17.tar.gz |
Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/commit.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/git/tree.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index c5688cda565..491e4b47196 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -58,10 +58,10 @@ module Gitlab return commit_id if commit_id.is_a?(Gitlab::Git::Commit) # Some weird thing? - return nil unless commit_id.is_a?(String) + return unless commit_id.is_a?(String) # This saves us an RPC round trip. - return nil if commit_id.include?(':') + return if commit_id.include?(':') commit = find_commit(repo, commit_id) diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 2f8e4e9e93d..7750978fb95 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -276,7 +276,7 @@ module Gitlab # senddata response. def archive_file_path(storage_path, sha, name, format = "tar.gz") # Build file path - return nil unless name + return unless name extension = case format diff --git a/lib/gitlab/git/tree.rb b/lib/gitlab/git/tree.rb index 51542bcaaa2..6fcea4e12b4 100644 --- a/lib/gitlab/git/tree.rb +++ b/lib/gitlab/git/tree.rb @@ -44,7 +44,7 @@ module Gitlab entry[:name] == path_arr[0] && entry[:type] == :tree end - return nil unless entry + return unless entry if path_arr.size > 1 path_arr.shift |