Skip to content

Commit 8d3de89

Browse files
author
Ignacio Jonas
committed
Fix Rubocop issues
1 parent 50cfb77 commit 8d3de89

38 files changed

+387
-209
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
inherit_from: .rubocop_todo.yml
12
AllCops:
23
RunRailsCops: true
34
Exclude:
45
- bin/**/*
56
- vendor/**/*
7+
- auth0.gemspec

.rubocop_todo.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Configuration parameters: CountComments.
2+
Metrics/MethodLength:
3+
Max: 15
4+
5+
# Configuration parameters: AllowURI, URISchemes.
6+
Metrics/LineLength:
7+
Max: 121

Guardfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
scope group: :unit_test
22

33
group :unit_test do
4-
guard 'rspec', cmd: "bundle exec rspec -P \"spec/lib/auth0/**/*#{ENV['PATTERN']}*_spec.rb\" --drb --format Fuubar --color" do
4+
guard 'rspec', cmd:
5+
"bundle exec rspec -P \"spec/lib/auth0/**/*#{ENV['PATTERN']}*_spec.rb\"--drb --format Fuubar --color" do
56
# run every updated spec file
67
watch(%r{^spec/.+_spec\.rb$})
78
# run the lib specs when a file in lib/ changes
@@ -12,7 +13,8 @@ group :unit_test do
1213
end
1314

1415
group :integration do
15-
guard 'rspec', cmd: "MODE=full bundle exec rspec -P \"spec/integration/**/*#{ENV['PATTERN']}*_spec.rb\" --drb --format Fuubar --color" do
16+
guard 'rspec', cmd:
17+
"MODE=full bundle exec rspec -P \"spec/integration/**/*#{ENV['PATTERN']}*_spec.rb\" --drb --format Fuubar --color" do
1618
# run every updated spec file
1719
watch(%r{^spec/.+_spec\.rb$})
1820
# run the lib specs when a file in lib/ changes
@@ -23,7 +25,8 @@ group :integration do
2325
end
2426

2527
group :full do
26-
guard 'rspec', cmd: 'MODE=full bundle exec rspec --drb --format Fuubar --color' do
28+
guard 'rspec', cmd:
29+
'MODE=full bundle exec rspec --drb --format Fuubar --color' do
2730
# run every updated spec file
2831
watch(%r{^spec/.+_spec\.rb$})
2932
# run the lib specs when a file in lib/ changes

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ begin
2020
desc 'Run All Suites'
2121
RSpec::Core::RakeTask.new(:all)
2222

23-
task default: [ :rubocop, :spec ]
23+
task default: [:rubocop, :spec]
2424
rescue LoadError
25-
# No RSpec
25+
puts 'Load Error - No RSpec'
2626
end

lib/auth0/api/authentication_endpoints.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module Api
33
# {https://auth0.com/docs/auth-api}
44
# Describing functionality of auth0 authentication endpoints
55
module AuthenticationEndpoints
6+
UP_AUTH = 'Username-Password-Authentication'
7+
68
# {https://auth0.com/docs/auth-api#!#post--oauth-access_token}
79
def obtain_access_token
810
request_params = {
@@ -44,7 +46,8 @@ def impersonate(user_id, app_client_id, impersonator_id, options)
4446
end
4547

4648
# {https://auth0.com/docs/auth-api#!#post--oauth-ro}
47-
def login(username, password, scope = 'openid', id_token = nil, connection_name = 'Username-Password-Authentication')
49+
50+
def login(username, password, scope = 'openid', id_token = nil, connection_name = UP_AUTH)
4851
request_params = {
4952
client_id: @client_id,
5053
username: username,
@@ -58,7 +61,7 @@ def login(username, password, scope = 'openid', id_token = nil, connection_name
5861
end
5962

6063
# {https://auth0.com/docs/auth-api#!#post--dbconnections-signup}
61-
def signup(email, password, connection_name = 'Username-Password-Authentication')
64+
def signup(email, password, connection_name = UP_AUTH)
6265
request_params = {
6366
client_id: @client_id,
6467
email: email,
@@ -69,7 +72,7 @@ def signup(email, password, connection_name = 'Username-Password-Authentication'
6972
end
7073

7174
# {https://auth0.com/docs/auth-api#!#post--dbconnections-change_password}
72-
def change_password(email, password, connection_name = 'Username-Password-Authentication')
75+
def change_password(email, password, connection_name = UP_AUTH)
7376
request_params = {
7477
client_id: @client_id,
7578
email: email,

lib/auth0/api/v1/connections.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def create_connection(connection_name, strategy, tenant_domain, domain_aliases =
3030
strategy: strategy,
3131
options: {
3232
tenant_domain: tenant_domain,
33-
domain_aliases: domain_aliases
34-
}
33+
domain_aliases: domain_aliases }
3534
}
3635
post(path, request_params)
3736
end

lib/auth0/api/v1/logs.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,15 @@ module Api
33
module V1
44
# {https://auth0.com/docs/api#logs}
55
module Logs
6-
# {https://auth0.com/docs/api#!#get--api-logs-page--number--per_page--items--sort--field----1-1--fields--fields--exclude_fields-true-false-}
7-
#
8-
# {https://auth0.com/docs/api#!#get--api-logs-search--criteria-}
9-
#
10-
# {https://auth0.com/docs/api#!#get--api-logs-from--checkpointId--take--count-}
6+
# https://auth0.com/docs/api/v1#!#logs
117
def logs(options = {})
128
acceptable_params = %i(take from search_criteria page per_page sort fields exclude_fields)
139
options.reject! do |key, value|
14-
next unless key.nil? || \
15-
value.nil? || \
16-
!acceptable_params.include?(key.to_sym)
10+
next unless key.nil? || value.nil? || !acceptable_params.include?(key.to_sym)
1711
warn "#{key} is not in acceptable params list: #{acceptable_params}"
1812
true
1913
end
20-
path = '/api/logs?' + URI.encode_www_form(options)
14+
path = "/api/logs?#{URI.encode_www_form(options)}"
2115
get(path)
2216
end
2317

lib/auth0/api/v1/users.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Auth0
22
module Api
3+
# rubocop:disable Metrics/ModuleLength
34
module V1
45
# {https://auth0.com/docs/api#users}
56
module Users
@@ -141,7 +142,7 @@ def delete_users
141142

142143
# {https://auth0.com/docs/api#!#delete--api-users--user_id-}
143144
def delete_user(user_id)
144-
fail Auth0::MissingUserId, 'if you want to remove all users user delete_users method' if user_id.to_s.empty?
145+
fail Auth0::MissingUserId, 'if you want to remove all users use delete_users method' if user_id.to_s.empty?
145146
path = "/api/users/#{user_id}"
146147
delete(path)
147148
end

lib/auth0/api/v2/clients.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create_client(name, options = {})
2020

2121
# https://auth0.com/docs/apiv2#!/clients/get_clients_by_id
2222
def client(client_id, options = {})
23-
path = '/api/v2/clients/' + client_id.to_s
23+
path = "/api/v2/clients/#{client_id}"
2424
get(path, options)
2525
end
2626

lib/auth0/api/v2/connections.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Auth0
22
module Api
33
module V2
4+
# https://auth0.com/docs/api/v2#!/Connections
45
module Connections
56
def connections(strategy: nil, fields: nil, include_fields: true)
67
request_params = {
@@ -20,7 +21,7 @@ def create_connection(body)
2021
end
2122

2223
def connection(connection_id, fields: nil, include_fields: true)
23-
path = '/api/v2/connections/' + connection_id.to_s
24+
path = "/api/v2/connections/#{connection_id}"
2425
request_params = {
2526
fields: fields,
2627
include_fields: include_fields
@@ -36,7 +37,7 @@ def delete_connection(connection_id)
3637

3738
def update_connection(connection_id, body)
3839
fail Auth0::MissingConnectionId, 'you must specify a connection id' if connection_id.to_s.empty?
39-
path = '/api/v2/connections/' + connection_id.to_s
40+
path = "/api/v2/connections/#{connection_id}"
4041
patch(path, body)
4142
end
4243
end

0 commit comments

Comments
 (0)