Showing 9 of 11 total issues
Method remap
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def remap(index_def, retry_delete_on_recoverable_errors: false, retry_delay: 0, max_delay: 0)
main_indexes = self.main_indexes
update_indexes = self.update_indexes
if main_indexes.size != 1 || update_indexes.size != 1 || main_indexes != update_indexes
- 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 remap
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remap(index_def, retry_delete_on_recoverable_errors: false, retry_delay: 0, max_delay: 0)
main_indexes = self.main_indexes
update_indexes = self.update_indexes
if main_indexes.size != 1 || update_indexes.size != 1 || main_indexes != update_indexes
Class AliasIndex
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class AliasIndex
SNAPSHOT_ERROR_SNIPPET = "Cannot delete indices that are being snapshotted"
RETRYABLE_ERROR_SNIPPETS = [
SNAPSHOT_ERROR_SNIPPET
].freeze
File search.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Elasticity
module Search
def self.build(client, index_name, document_types, body, search_args = {})
search_def = Search::Definition.new(index_name, document_types, body, search_args)
Search::Facade.new(client, search_def)
Method build
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.build(client, index_name, document_types, body, search_args = {})
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(client, index_base_name, document_type, use_new_timestamp_format = nil, include_type_name_on_create = nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(client, index_name, document_type, use_new_timestamp_format = nil, include_type_name_on_create = nil)
Method log_event
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def log_event(event)
bt = event.payload[:backtrace]
if bt.present? && defined?(Rails)
bt = Rails.backtrace_cleaner.clean(bt)
- 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 map_hit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def map_hit(hit)
attrs = { _id: hit["_id"] }
attrs.merge!(_score: hit["_score"])
attrs.merge!(sort: hit["sort"])
attrs.merge!(hit["_source"]) if hit["_source"]
- 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"