Showing 15 of 15 total issues
Class Client
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
extend Forwardable
def_delegator :annotator, :add, :annotate
Method add
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def add(measurements)
measurements.each do |key, value|
multidimensional = has_tags?
if value.respond_to?(:each)
validate_parameters(value)
- 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 add
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add(measurements)
measurements.each do |metric, data|
entry = {}
if @prefix
metric = "#{@prefix}.#{metric}"
- 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 merge!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def merge!(mergeable)
if mergeable.respond_to?(:queued)
to_merge = mergeable.queued
elsif mergeable.respond_to?(:has_key?)
to_merge = mergeable
- 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 queued
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def queued
entries = []
multidimensional = has_tags?
@aggregated.each_value do |data|
- 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 add
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add(measurements)
measurements.each do |key, value|
multidimensional = has_tags?
if value.respond_to?(:each)
validate_parameters(value)
Method queued
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queued
entries = []
multidimensional = has_tags?
@aggregated.each_value do |data|
Method merge!
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge!(mergeable)
if mergeable.respond_to?(:queued)
to_merge = mergeable.queued
elsif mergeable.respond_to?(:has_key?)
to_merge = mergeable
Method add
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add(measurements)
measurements.each do |metric, data|
entry = {}
if @prefix
metric = "#{@prefix}.#{metric}"
Method submit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def submit
return true if self.empty?
options = {per_request: @per_request}
if persister.persist(self.client, self.queued, options)
@last_submit_time = Time.now
- 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 chunk_queued
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def chunk_queued(queued, per_request)
return [queued] if queue_count(queued) <= per_request
reqs = []
# separate metric-containing values from global values
globals = fetch_globals(queued)
- 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 get_series
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_series(metric_name, options={})
raise ArgumentError, ":resolution and :duration or :start_time must be set" if options.empty?
query = options.dup
if query[:start_time].respond_to?(:year)
query[:start_time] = query[:start_time].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 reconcile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reconcile(measurements, val)
arr = val.is_a?(Hash) ? [@tags, :tags] : [@source, :source]
return measurements if !val || val == arr.first
measurements.map! do |measurement|
unless measurement[arr.last]
- 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 persist
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def persist(client, queued, options={})
per_request = options[:per_request]
if per_request
requests = chunk_queued(queued, per_request)
else
- 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 queued
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def queued
return {} if @queued.empty?
globals = {}
time = has_tags? ? :time : :measure_time
globals[time] = @time if @time
- 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"