Showing 17 of 52 total issues
Method mock
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock
user_id = cistern.serial_id
user = params.fetch('user')
organization_id = user['organization_id']
Method mock
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock
comment = params.fetch('ticket').delete('comment')
body = find!(:tickets, ticket_id).merge!(ticket_params)
Method mock
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock
create_params = view_params
if Zendesk2.blank?(create_params['title'])
error!(:invalid, details: { 'base' => [{ 'title' => 'Title: cannot be blank' }] })
Method mock
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock
identity = cistern.serial_id
locale = params['locale'] ||= 'en-us'
position = data[:help_center_sections].values.select { |a| a['category_id'] == category_id }.size
Method mock
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock
body = find!(:views, view_id)
update_params = view_params
Method mock
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def mock
terms = Hash[query.split(' ').map { |t| t.split(':') }]
terms.delete('type') # context already provided
collection = searchable_collection(terms)
- 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 data
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.data
@data ||= Hash.new do |h, k|
h[k] = {
brands: {},
categories: {},
Method initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
url = options[:url] || Zendesk2.defaults[:url]
@url = (URI.parse(url).to_s if url)
- 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 mock
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock
identity = cistern.serial_id
locale = params['locale'] ||= 'en-us'
position = data[:help_center_articles].values.select { |a| a['section_id'] == section_id }.size
Method page
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def page(collection, options = {})
url_params = options[:params] || params
page_params = page_params!(params)
page_size = (page_params.delete('per_page') || 50).to_i
Method mock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mock
comment = params.fetch('ticket').delete('comment')
body = find!(:tickets, ticket_id).merge!(ticket_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 mock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mock
terms = Hash[query.split(' ').map { |t| t.split(':') }]
terms.delete('type') # context already provided
collection = data[:organizations].values
- 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 page
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def page(collection, options = {})
url_params = options[:params] || params
page_params = page_params!(params)
page_size = (page_params.delete('per_page') || 50).to_i
- 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 search_by_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search_by_string(terms)
additional_terms = []
additional_terms = ["type:#{self.class.search_type}"] if self.class.search_type
additional_terms += self.class.scopes.inject([]) do |r, k|
val = public_send(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 mock
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def mock(_params = {})
view = find!(:views, view_id)
operators = Array(view['conditions']['all']).map do |c|
operator = 'is' == c.fetch('operator') ? :eql? : :!=
- 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 mock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mock
update_params = user_params
email = update_params['email']
- 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 translation_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def translation_params
new_params = Cistern::Hash.slice(params, :outdated, :draft)
# Extract locales and dedup "locale"
locales = params['locales'] || []
- 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"