Showing 67 of 80 total issues
Method write
has 61 lines of code (exceeds 25 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
File out_elasticsearch_data_stream.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'out_elasticsearch'
module Fluent::Plugin
class ElasticsearchOutputDataStream < ElasticsearchOutput
Method create_rollover_alias
has a Cognitive Complexity of 17 (exceeds 5 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
- 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 53 lines of code (exceeds 25 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 = {}
Method configure
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def configure(conf)
super
if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
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 client
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def client(host = nil, compress_connection = false)
return cloud_client if @cloud_id
# check here to see if we already have a client connection for the given host
connection_options = get_connection_options(host)
Method create_time_parser
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_time_parser
if @time_key_format
begin
# Strptime doesn't support all formats, but for those it does it's
# blazingly fast.
- 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 expand_placeholders
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def expand_placeholders(chunk)
logstash_prefix = extract_placeholders(@logstash_prefix, chunk)
logstash_dateformat = extract_placeholders(@logstash_dateformat, chunk)
index_name = extract_placeholders(@index_name, chunk)
if @type_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 create_time_parser
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_time_parser
if @timestamp_key_format
begin
# Strptime doesn't support all formats, but for those it does it's
# blazingly fast.
- 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 43 lines of code (exceeds 25 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...
Method expand_placeholders
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expand_placeholders(chunk)
logstash_prefix = extract_placeholders(@logstash_prefix, chunk)
logstash_dateformat = extract_placeholders(@logstash_dateformat, chunk)
index_name = extract_placeholders(@index_name, chunk)
if @type_name
Method configure
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
begin
Method send_bulk
has 36 lines of code (exceeds 25 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
Method configure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def configure(conf)
super
@timestamp_parser = create_time_parser
@backend_options = backend_options
- 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 set_tls_minmax_version_config
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_tls_minmax_version_config(ssl_version, ssl_max_version, ssl_min_version)
if USE_TLS_MINMAX_VERSION
case
when ssl_min_version.nil? && ssl_max_version.nil?
ssl_min_version = METHODS_MAP[:TLSv1_2]
- 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_rollover_alias
has 11 arguments (exceeds 4 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)
Method client
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def client(host = nil, compress_connection = false)
# check here to see if we already have a client connection for the given host
connection_options = get_connection_options(host)
@_es = nil unless is_existing_connection(connection_options[:hosts])
Method template_custom_install
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index, index_separator)
Method expand_param
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def expand_param(param, tag, time, record)
# check for '${ ... }'
# yes => `eval`
# no => return param
return param if (param.to_s =~ /\${.+}/).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 client
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def client(host = nil)
# check here to see if we already have a client connection for the given host
connection_options = get_connection_options(host)
@_es = nil unless is_existing_connection(connection_options[:hosts])