lib/uber/client.rb
Class Client
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Client
include Uber::API
attr_accessor :server_token, :client_id, :client_secret
attr_accessor :bearer_token
Method validate_credential_type!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_credential_type!
credentials.each do |credential, value|
next if value.nil?
unless value.is_a?(String) || value.is_a?(Symbol) # rubocop:disable Style/Next, Metrics/LineLength
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Line is too long. [92/80] Open
Open
inspected = inspected.sub! @client_secret, only_show_last_four_chars(@client_secret)
- Exclude checks
Line is too long. [90/80] Open
Open
inspected = inspected.sub! @server_token, only_show_last_four_chars(@server_token)
- Exclude checks
Method Uber::Client#bearer_token=
is defined at both lib/uber/client.rb:14 and lib/uber/client.rb:46. Open
Open
def bearer_token=(token)
- Read upRead up
- Exclude checks
This cop checks for duplicated instance (or singleton) method definitions.
Example:
# bad
def duplicated
1
end
def duplicated
2
end
Example:
# bad
def duplicated
1
end
alias duplicated other_duplicated
Example:
# good
def duplicated
1
end
def other_duplicated
2
end
Add an empty line after magic comments. Open
Open
require "uber/version"
- Read upRead up
- Exclude checks
Checks for a newline after the final magic comment.
Example:
# good
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end