Showing 23 of 152 total issues
Class API
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class API
include Constants
include Authorization
include MimeType
include RateLimit
Method call
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def call(current_options, params)
unless HTTP_METHODS.include?(action)
raise ArgumentError, "unknown http method: #{action}"
end
- 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
Method build_nested_query
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def build_nested_query(value, prefix = nil, encoder = nil)
case value
when Array
value.map { |v| build_nested_query(v, "#{prefix}%5B%5D", encoder) }.join("&")
when Hash
- 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
Method filter!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def filter!(keys, params, options={:recursive => true}) # :nodoc:
case params
when Hash, ParamsHash
params.keys.each do |k, v|
unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
- 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
Method default
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.default(options = {})
api = options[:api]
proc do |builder|
builder.use Github::Request::Jsonize
builder.use Faraday::Request::Multipart
- 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
Method deep_merge!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge!(other, &block)
other.each_pair do |key, val|
tval = self[key]
if tval.is_a?(Hash) && val.is_a?(Hash)
self[key] = tval.deep_merge(val)
- 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
Method format_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def format_response
return '' if data.nil? || data.empty?
case data
when Hash
- 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
Method list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list(*args)
arguments(args) do
permit %w[ user org type sort direction since ]
end
params = arguments.params
- 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
Method perform_with_redirection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform_with_redirection(env, follows)
request_body = env[:body]
response = @app.call(env)
response.on_complete do |response_env|
- 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
Method parse_query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_query(query_string)
return '' if query_string.nil? || query_string.empty?
params = {}
query_string.split(DEFAULT_QUERY_SEP).each do |part|
- 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
Method assert_valid_values
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def assert_valid_values(permitted, params)
params.each do |k, v|
next unless permitted.keys.include?(k)
if permitted[k].is_a?(Array) && !permitted[k].include?(params[k])
raise Github::Error::UnknownValue.new(k,v, permitted[k].join(', '))
- 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
Method symbolize_keys!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def symbolize_keys!
hash = symbolize_keys
hash.each do |key, val|
hash[key] = case val
when Hash
- 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
Method delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete(*args)
raise_authentication_error unless authenticated?
params = arguments(args, required: [:client_id]).params
if arguments.client_id
- 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
Method method_added
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.method_added(method_name)
method_name = method_name.to_s.gsub(/_with(out)?_callback_.*$/, '')
# Only subclasses matter
return if self.root?
return if extra_methods.include?(method_name)
- 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
Method call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
if request_with_body?(env)
env[:request_headers][CONTENT_TYPE] ||= MIME_TYPE
env[:body] = encode_body env[:body] unless env[:body].respond_to?(:to_str)
elsif safe_to_modify?(env)
- 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
Method list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def list(*args)
params = arguments(args) do
assert_values VALID_ISSUE_PARAM_VALUES
end.params
- 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
Avoid too many return
statements within this method. Open
return if public_method_defined?(with_method)
Avoid too many return
statements within this method. Open
return -1
Avoid too many return
statements within this method. Open
return if public_method_defined?(with_method)
Method check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check(*args)
raise_authentication_error unless authenticated?
params = arguments(args, required: [:client_id, :access_token]).params
if arguments.client_id
- 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"