Showing 80 of 80 total issues
File out_elasticsearch.rb
has 1022 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'date'
require 'excon'
require 'elasticsearch'
require 'set'
require 'json'
Method configure
has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring. Open
def configure(conf)
compat_parameters_convert(conf, :buffer)
super
if placeholder_substitution_needed_for_template?
- 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 a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def handle_error(response, tag, chunk, bulk_message_count, extracted_values, unpacked_msg_arr)
items = response['items']
if items.nil? || !items.is_a?(Array)
raise ElasticsearchVersionMismatch, "The response format was unrecognized: #{response}"
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 write
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def write(chunk)
bulk_message = Hash.new { |h,k| h[k] = '' }
dynamic_conf = @dynamic_config.clone
headers = {
- 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 190 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
compat_parameters_convert(conf, :buffer)
super
if placeholder_substitution_needed_for_template?
Class ElasticsearchOutput
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class ElasticsearchOutput < Output
class RecoverableRequestFailure < StandardError; end
class UnrecoverableRequestFailure < Fluent::UnrecoverableError; end
class RetryStreamEmitFailure < StandardError; end
Method process_message
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def process_message(tag, meta, header, time, record, affinity_target_indices, extracted_values)
logstash_prefix, logstash_dateformat, index_name, type_name, _template_name, _customize_template, _deflector_alias, application_name, pipeline, _ilm_policy_id = extracted_values
if @flatten_hashes
record = flatten_record(record)
- 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 a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def get_connection_options(con_host=nil)
hosts = if con_host || @hosts
(con_host || @hosts).split(',').map do |host_str|
# Support legacy hosts format host:port,host:port,host:port...
- 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 write
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def write(chunk)
bulk_message_count = Hash.new { |h,k| h[k] = 0 }
bulk_message = Hash.new { |h,k| h[k] = '' }
header = {}
meta = {}
- 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 send_bulk
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def send_bulk(data, tag, chunk, bulk_message_count, extracted_values, info, unpacked_msg_arr)
_logstash_prefix, _logstash_dateformat, index_name, _type_name, template_name, customize_template, deflector_alias, application_name, _pipeline, ilm_policy_id = extracted_values
if deflector_alias
template_installation(deflector_alias, template_name, customize_template, application_name, index_name, ilm_policy_id, info.host)
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 handle_error
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_error(response, tag, chunk, bulk_message_count, extracted_values, unpacked_msg_arr)
items = response['items']
if items.nil? || !items.is_a?(Array)
raise ElasticsearchVersionMismatch, "The response format was unrecognized: #{response}"
end
Method write
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def write(chunk)
data_stream_name = @data_stream_name
data_stream_template_name = @data_stream_template_name
data_stream_ilm_name = @data_stream_ilm_name
host = nil
- 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 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_message(tag, meta, header, time, record, affinity_target_indices, extracted_values)
logstash_prefix, logstash_dateformat, index_name, type_name, _template_name, _customize_template, _deflector_alias, application_name, pipeline, _ilm_policy_id = extracted_values
if @flatten_hashes
record = flatten_record(record)
Method get_connection_options
has a Cognitive Complexity of 23 (exceeds 5 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|
- 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 write
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write(chunk)
bulk_message = Hash.new { |h,k| h[k] = '' }
dynamic_conf = @dynamic_config.clone
headers = {
Method inject_ilm_settings_to_template
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template, index_separator)
log.debug("Overwriting index patterns when Index Lifecycle Management is enabled.")
template['index_patterns'] = "#{target_index}#{index_separator}*"
if @use_legacy_template
template.delete('template') if template.include?('template')
- 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_installation_actual
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def template_installation_actual(deflector_alias, template_name, customize_template, application_name, target_index, ilm_policy_id, host=nil)
if template_name && @template_file
if !@logstash_format && (deflector_alias.nil? || (@alias_indexes.include? deflector_alias)) && (@template_names.include? template_name)
if deflector_alias
log.debug("Index alias #{deflector_alias} and template #{template_name} already exist (cached)")
- 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 a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get_connection_options(con_host=nil)
hosts = if con_host || @hosts
(con_host || @hosts).split(',').map do |host_str|
# Support legacy hosts format host:port,host:port,host:port...
- 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_data_stream_parameters
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def validate_data_stream_parameters
{"data_stream_name" => @data_stream_name,
"data_stream_template_name"=> @data_stream_template_name,
"data_stream_ilm_name" => @data_stream_ilm_name}.each do |parameter, value|
unless valid_data_stream_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
File in_elasticsearch.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'elasticsearch'
require 'faraday/excon'
require 'fluent/log-ext'
require 'fluent/plugin/input'