Showing 67 of 80 total issues
Method configure
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
@timestamp_parser = create_time_parser
@backend_options = backend_options
Method create_rollover_alias
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_rollover_alias(target_index, rollover_index, deflector_alias_name, app_name, index_date_pattern, index_separator, enable_ilm, ilm_policy_id, ilm_policy, ilm_policy_overwrite, host)
# ILM request to create alias.
if rollover_index || enable_ilm
if !client.indices.exists_alias(:name => deflector_alias_name)
if @logstash_format
Method template_install
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil, index_separator = '-')
Method get_affinity_target_indices
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_affinity_target_indices(chunk)
indices = Hash.new
if target_index_affinity_enabled?()
id_key_accessor = record_accessor_create(@id_key)
ids = Set.new
Method verify_ilm_working
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def verify_ilm_working
# Check the Elasticsearch instance for ILM readiness - this means that the version has to be a non-OSS release, with ILM feature
# available and enabled.
begin
xpack = xpack_info
- 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_connection_options
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_connection_options(con_host)
raise "`password` must be present if `user` is present" if @user && !@password
hosts = if con_host || @hosts
(con_host || @hosts).split(',').map do |host_str|
Method retry_operate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def retry_operate(max_retries, fail_on_retry_exceed = true, catch_trasport_exceptions = true)
return unless block_given?
retries = 0
transport_errors = TRANSPORT_CLASS::Transport::Errors.constants.map{ |c| TRANSPORT_CLASS::Transport::Errors.const_get c } if catch_trasport_exceptions
begin
- 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 template_install
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil, index_separator = '-')
inject_template_name = get_template_name(enable_ilm, name, deflector_alias_name)
if overwrite
template_put(inject_template_name,
enable_ilm ? inject_ilm_settings_to_template(deflector_alias_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 process_message
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_message(tag, meta, header, time, record, affinity_target_indices, extracted_values)
Method template_installation_actual
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def template_installation_actual(deflector_alias, template_name, customize_template, application_name, target_index, ilm_policy_id, host=nil)
Method template_installation
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def template_installation(deflector_alias, template_name, customize_template, application_name, ilm_policy_id, target_index, host)
Method send_bulk
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_bulk(data, tag, chunk, bulk_message_count, extracted_values, info, unpacked_msg_arr)
Method process_events
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_events(hit, es)
event = hit["_source"]
time = Fluent::Engine.now
if @parse_timestamp
if event.has_key?(TIMESTAMP_FIELD)
- 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 run_slice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_slice(slice_id=nil)
slice_query = @base_query
slice_query = slice_query.merge('slice' => { 'id' => slice_id, 'max' => @num_slices}) unless slice_id.nil?
result = client.search(@options.merge(:body => Yajl.dump(slice_query) ))
es = Fluent::MultiEventStream.new
- 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 handle_error
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_error(response, tag, chunk, bulk_message_count, extracted_values, unpacked_msg_arr)
Method append_record_to_messages
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def append_record_to_messages(op, meta, header, record, msgs)
Method inject_ilm_settings_to_template
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template, index_separator)
Method append_record_to_messages
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def append_record_to_messages(op, meta, header, record, msgs)
Method is_existing_connection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_existing_connection(host)
# check if the host provided match the current connection
return false if @_es.nil?
return false if @current_config.nil?
return false if host.length != @current_config.length
- 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 is_existing_connection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_existing_connection(host)
# check if the host provided match the current connection
return false if @_es.nil?
return false if @current_config.nil?
return false if host.length != @current_config.length
- 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"