Showing 15 of 32 total issues
File query.rb
has 431 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'time'
require 'iso8601'
require 'active_support/all'
require 'active_model'
File filter.rb
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Druid
class Filter
include ActiveModel::Model
attr_accessor :type
Class Builder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Builder
attr_reader :query
def initialize
Method validate_each
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
if !value.is_a?(Array) || value.blank?
record.errors.add(attribute, 'must be a list with at least one interval')
return
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 validate_each
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
if TYPES.include?(record.queryType)
if value.is_a?(String)
record.errors.add(attribute, "must be one of #{SIMPLE.inspect}") unless SIMPLE.include?(value)
elsif value.is_a?(Granularity)
- 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 dimensions=
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def dimensions=(value)
if value.is_a?(Array)
@dimensions = value.map do |x|
x.is_a?(Dimension) ? x : Dimension.new(x)
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 aggregations=
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def aggregations=(value)
if value.is_a?(Array)
@aggregations = value.map do |x|
x.is_a?(Aggregation) ? x : Aggregation.new(x)
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 metadata!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def metadata!(opts = {})
meta_path = "#{@uri.path}datasources/#{name}"
if opts[:interval]
from, to = opts[:interval]
- 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 verify_broker
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def verify_broker(service, name)
$log.debug("druid.zk verify", broker: name, service: service) if $log
info = @zk.get("#{watch_path(service)}/#{name}")
node = MultiJson.load(info[0])
uri = "http://#{node['address']}:#{node['port']}/druid/v2/"
- 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 fields=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fields=(value)
if value.is_a?(Array)
@fields = value.map do |x|
x.is_a?(Filter) ? x : Filter.new(x)
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 intervals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def intervals(is)
@query.intervals = is.map do |from, to|
from = from.respond_to?(:iso8601) ? from.iso8601 : ISO8601::DateTime.new(from).to_s
to = to.respond_to?(:iso8601) ? to.iso8601 : ISO8601::DateTime.new(to).to_s
"#{from}/#{to}"
- 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 validate_each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
if TYPES.include?(record.queryType)
if !value.is_a?(Array) || value.blank?
record.errors.add(attribute, 'must be a list with at least one aggregator')
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 post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def post(query)
query = query.query if query.is_a?(Druid::Query::Builder)
query = Query.new(MultiJson.load(query)) if query.is_a?(String)
query.dataSource = 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 check_service
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_service(service)
return if @watched_services.include?(service)
watch_service(service)
- 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 validate_each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
if TYPES.include?(record.queryType)
if !value.is_a?(Array) || value.blank?
record.errors.add(attribute, 'must be a list with at least one dimension')
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"