Skip to content

Commit 18407a1

Browse files
committed
fixed guard clause violation
1 parent 06a0a01 commit 18407a1

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,6 @@ Style/DoubleNegation:
7474
- 'lib/grape/middleware/versioner/header.rb'
7575
- 'lib/grape/path.rb'
7676

77-
# Offense count: 1
78-
# Configuration parameters: MinBodyLength.
79-
Style/GuardClause:
80-
Exclude:
81-
- 'lib/grape/endpoint.rb'
82-
8377
# Offense count: 14
8478
# Configuration parameters: EnforcedStyle, SupportedStyles.
8579
# SupportedStyles: compact, exploded

lib/grape/endpoint.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ def new(*args, &block)
2222
def before_each(new_setup = false, &block)
2323
@before_each ||= []
2424
if new_setup == false
25-
if block_given?
26-
@before_each << block
27-
else
28-
return @before_each
29-
end
25+
return @before_each unless block_given?
26+
@before_each << block
3027
else
3128
@before_each = [new_setup]
3229
end

0 commit comments

Comments
 (0)