From 136dcc497431921ff4b1d2a7037c31ddb7a4bf4a Mon Sep 17 00:00:00 2001 From: Victor Koronen Date: Sat, 19 Dec 2015 14:53:08 +0100 Subject: [PATCH] Fix Style/GuardClause --- .rubocop_todo.yml | 6 ------ fever_api.rb | 7 +++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0c49d789b..d6255095b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,12 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# Configuration parameters: MinBodyLength. -Style/GuardClause: - Exclude: - - 'fever_api.rb' - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues. diff --git a/fever_api.rb b/fever_api.rb index aa071c79a..2d6c83027 100644 --- a/fever_api.rb +++ b/fever_api.rb @@ -17,10 +17,9 @@ class Endpoint < Sinatra::Base end def authenticated?(api_key) - if api_key - user = User.first - user.api_key && api_key.downcase == user.api_key.downcase - end + return unless api_key + user = User.first + user.api_key && api_key.downcase == user.api_key.downcase end get "/" do