Skip to content

Commit

Permalink
Fix Style/RedundantReturn
Browse files Browse the repository at this point in the history
  • Loading branch information
dks17 authored and Evan-M committed Apr 9, 2018
1 parent da0746c commit f097ecd
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 21 deletions.
13 changes: 1 addition & 12 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 30`
# on 2018-04-02 18:32:20 +0300 using RuboCop version 0.54.0.
# on 2018-04-02 18:53:29 +0300 using RuboCop version 0.54.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -638,17 +638,6 @@ Style/PercentLiteralDelimiters:
Style/RaiseArgs:
EnforcedStyle: compact

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Exclude:
- 'app/controllers/devise_token_auth/application_controller.rb'
- 'app/controllers/devise_token_auth/passwords_controller.rb'
- 'app/controllers/devise_token_auth/sessions_controller.rb'
- 'app/models/devise_token_auth/concerns/user.rb'
- 'lib/devise_token_auth/url.rb'

# Offense count: 7
# Cop supports --auto-correct.
Style/RedundantSelf:
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/devise_token_auth/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def resource_data(opts={})
end

def resource_errors
return @resource.errors.to_hash.merge(full_messages: @resource.errors.full_messages)
@resource.errors.to_hash.merge(full_messages: @resource.errors.full_messages)
end

protected
Expand Down Expand Up @@ -53,7 +53,7 @@ def json_api?
return ActiveModel::Serializer.setup do |config|
config.adapter == :json_api
end if ActiveModel::Serializer.respond_to?(:setup)
return ActiveModelSerializers.config.adapter == :json_api
ActiveModelSerializers.config.adapter == :json_api
end

def recoverable_enabled?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/devise_token_auth/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def render_update_success
end

def render_update_error
return render json: {
render json: {
success: false,
errors: resource_errors
}, status: 422
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/devise_token_auth/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ def get_auth_params
auth_val.downcase!
end

return {
key: auth_key,
val: auth_val
}
{ key: auth_key, val: auth_val }
end

def render_new_error
Expand Down
2 changes: 1 addition & 1 deletion app/models/devise_token_auth/concerns/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def valid_token?(token, client_id='default')
return true if token_can_be_reused?(token, client_id)

# return false if none of the above conditions are met
return false
false
end

# this must be done from the controller so that additional params
Expand Down
2 changes: 1 addition & 1 deletion lib/devise_token_auth/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.generate(url, params = {})
res += "?#{query}"
res += "##{uri.fragment}" if uri.fragment

return res
res
end

def self.whitelisted?(url)
Expand Down

0 comments on commit f097ecd

Please sign in to comment.