Showing 43 of 43 total issues
File resources.rb
has 770 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ZendeskAPI
# @internal The following are redefined later, but needed by some circular resources (e.g. Ticket -> User, User -> Ticket)
class Ticket < Resource; end
class User < Resource; end
Class Collection
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Collection
include ZendeskAPI::Sideloading
include Pagination
# Options passed in that are automatically converted from an array to a comma-separated list.
Method create_verb
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def create_verb(method_verb)
define_method method_verb do |method|
define_method "#{method}!" do |*method_args|
opts = method_args.last.is_a?(Hash) ? method_args.pop : {}
- 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
File collection.rb
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'zendesk_api/resource'
require 'zendesk_api/resources'
require 'zendesk_api/search'
require 'zendesk_api/pagination'
Method set_file
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def set_file(hash, key, top_level)
return unless hash.key?(key)
file = if hash[key].is_a?(Hash) && hash[key].key?(:file)
hash[key].delete(:file)
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
original_env = env.dup
exception_happened = false
if @retry_on_exception
begin
- 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
Class Data
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Data
include Associations
class << self
def inherited(klass)
Method define_has_many_getter
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def define_has_many_getter(association)
klass = association[:class]
define_method association[:name] do |*args|
instance_opts = args.last.is_a?(Hash) ? args.pop : {}
- 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_missing
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args, &block)
method = method.to_s
options = args.last.is_a?(Hash) ? args.pop : {}
unless config.use_resource_cache
resource_class = resource_class_for(method)
- 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 save_associations
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def save_associations
self.class.associations.each do |association_data|
association_name = association_data[:name]
next unless send("#{association_name}_used?") && association = send(association_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 process
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process
many = statement.jump(:ident).source == "has_many"
klass = get_klass(statement)
Method build_connection
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_connection
Faraday.new(config.options) do |builder|
# response
builder.use ZendeskAPI::Middleware::Response::RaiseError
builder.use ZendeskAPI::Middleware::Response::Callback, self
- 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 generate_path
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def generate_path(*args)
options = SilentMash.new(:with_id => true)
if args.last.is_a?(Hash)
original_options = args.pop
options.merge!(original_options)
- 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 define_has_getter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def define_has_getter(association)
klass = association[:class] # shorthand
define_method association[:name] do |*args|
instance_options = args.last.is_a?(Hash) ? args.pop : {}
- 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 set_file
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_file(hash, key, top_level)
return unless hash.key?(key)
file = if hash[key].is_a?(Hash) && hash[key].key?(:file)
hash[key].delete(:file)
Method create_verb
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_verb(method_verb)
define_method method_verb do |method|
define_method "#{method}!" do |*method_args|
opts = method_args.last.is_a?(Hash) ? method_args.pop : {}
Method _all
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _all(start_page = @options["page"], bang = false, &block)
raise(ArgumentError, "must pass a block") unless block
page(start_page)
clear_cache
- 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_connection
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_connection
Faraday.new(config.options) do |builder|
# response
builder.use ZendeskAPI::Middleware::Response::RaiseError
builder.use ZendeskAPI::Middleware::Response::Callback, self
Method call
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
original_env = env.dup
exception_happened = false
if @retry_on_exception
begin
Method process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process
many = statement.jump(:ident).source == "has_many"
klass = get_klass(statement)
- 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"