Showing 10 of 10 total issues
Method request_with_auto_refresh
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def request_with_auto_refresh(params)
request_without_auto_refresh(params).tap do
next unless AutoRefresh.enabled?
next if SKIP_IDS.include?(params[:id].to_s.downcase)
next unless METHODS.include?(params[:method].to_s.downcase)
- 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 next_cluster_host
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def next_cluster_host
if @resurrect_at
time = Time.now.to_i
resurrect_cluster(time) if @resurrect_at <= time
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 configure
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def configure(config, tag = :elastics)
migrated = false
error = nil
config.around tag => true do |ex|
if migrated
- 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 http_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def http_request(event)
return unless logger.debug?
payload = event.payload[:args]
method, path, query, body, params = payload
- 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 http_request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def http_request(method, path, query, body, params = nil, host = @host)
Method models_to_reindex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def models_to_reindex(options = {})
indices = options[:indices].try!(:map, &:to_s)
types = options[:types].try!(:map, &:to_s)
models = Model.list.select do |model|
next if indices && !indices.include?(model.elastics_index_base)
- 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 request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request(params = {})
method = params[:method] || :get
body = params[:body]
body = body.to_json if body && !body.is_a?(String)
res = http_request(method, request_path(params), params[:query], body, 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 http_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def http_request(method, path, query, body, params = nil)
Method reindex_elastics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reindex_elastics(options = {})
scope = respond_to?(:reindex_scope) ? reindex_scope : all
if after = options.delete(:updated_after)
if updated_at = arel_table[:updated_at]
scope = scope.where(updated_at.gt(after))
- 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 create_indices
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_indices(options = {})
version = options.fetch :version, :current
each_filtered(indices, options[:indices]) do |index|
versioned_index = versioned_index_name(index, version)
exists = client.index_exists?(versioned_index)
- 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"