summaryrefslogtreecommitdiff
path: root/lib/declarative_policy
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2019-02-08 14:19:53 +0200
committerAndrew Newdigate <andrew@gitlab.com>2019-03-06 17:51:56 +0200
commit3288e1a874ec0184f9f27f932748e51c57babf17 (patch)
tree9f8667f5349ecfc59f3c8a6e9641cb1e32fa3d5b /lib/declarative_policy
parent7bbdb2a29fbc7b8c9f879c42de7063adaa8313c7 (diff)
downloadgitlab-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/declarative_policy')
-rw-r--r--lib/declarative_policy/rule.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/declarative_policy/rule.rb b/lib/declarative_policy/rule.rb
index f38f4f0a50f..964d35cde9e 100644
--- a/lib/declarative_policy/rule.rb
+++ b/lib/declarative_policy/rule.rb
@@ -84,7 +84,7 @@ module DeclarativePolicy
# returns nil unless it's already cached
def cached_pass?(context)
condition = context.condition(@name)
- return nil unless condition.cached?
+ return unless condition.cached?
condition.pass?
end
@@ -124,7 +124,7 @@ module DeclarativePolicy
def cached_pass?(context)
condition = delegated_context(context).condition(@name)
- return nil unless condition.cached?
+ return unless condition.cached?
condition.pass?
rescue MissingDelegate
@@ -161,7 +161,7 @@ module DeclarativePolicy
def cached_pass?(context)
runner = context.runner(@ability)
- return nil unless runner.cached?
+ return unless runner.cached?
runner.pass?
end