Showing 52 of 79 total issues
Method parse_section
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def parse_section(name, definition)
config_section(name, **definition.slice(:required, :multi, :alias)) do
if %i(buffer storage parse format).include?(name)
define_all_attributes(name)
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
Class Fluentd
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Fluentd
module Setting
module PluginParameter
extend ActiveSupport::Concern
Class Plugin
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Plugin
class GemError < StandardError; end
WORKING = []
Method initialize
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def initialize(attributes = {})
# the superclass does not know specific attributes of the model
begin
super
rescue ActiveModel::UnknownAttributeError => ex
- 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
Function exports
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Class Agent
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Agent
module Common
attr_reader :extra_options
def self.included(base)
Method config_param
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def config_param(name, type = ActiveModel::Type::Value.new, **options)
# NOTE: We cannot overwrite types defined by ActiveModel in config/initializers/types.rb
if type == :time
type = Fluentd::Setting::Type::Time.new
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
Function updateSection
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateSection: function() {
$.ajax({
method: "GET",
url: `${relativeUrlRoot}/api/config_definitions`,
headers: {
Method index
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
name = params[:name]
type = params[:type]
prefix = case type
when "input"
Function token
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
token: function(stream, state) {
if (stream.eatWhile(/[ \t]/)) {
// ignore indenting spaces
stream.skipTo(stream.peek());
return;
Function updateHighlightedLines
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateHighlightedLines: function(matches) {
if (!matches) {
this.highlightedLines = null;
return;
}
Method to_config
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_config
name = case plugin_type
when "input"
"source"
when "output"
Method _matches
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _matches
begin
io = File.open(path)
reader = FileReverseReader.new(io)
parserd_chunks = []
Method define_all_attributes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def define_all_attributes(section_name)
registry = case section_name
when :buffer
Fluent::Plugin::BUFFER_REGISTRY
when :storage
- 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 register_plugin
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def register_plugin(type, name)
self.plugin_type = type
self.plugin_name = name
if ["filter", "output"].include?(type)
- 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 check_permission
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_permission(column)
path = send(column)
return if path.blank? # if empty, presence: true will catch it
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 parse_attributes
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_attributes(attributes)
base_klasses = config_definition.keys
sections, params = attributes.partition do |key, _section_attributes|
base_klasses.any? do |base_klass|
config_definition.dig(base_klass, key.to_sym, :section) || config_definition.dig(key.to_sym, :section)
Method parse_attributes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_attributes(attributes)
base_klasses = config_definition.keys
sections, params = attributes.partition do |key, _section_attributes|
base_klasses.any? do |base_klass|
config_definition.dig(base_klass, key.to_sym, :section) || config_definition.dig(key.to_sym, :section)
- 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 delete_element
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def delete_element(name, arg, element)
if name == "label"
label_section = fl_config.elements(name: name, arg: arg).first
original_size = label_section.elements.size
remaining_elements = label_section.elements.reject do |e|
- 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 dump_parsed_config
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dump_parsed_config(parsed_config)
content = "".dup
sources = parsed_config["source"] || []
filters = parsed_config["filter"] || []
matches = parsed_config["match"] || []