fluent/fluentd-ui

View on GitHub

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
Severity: Minor
Found in app/models/concerns/fluentd/setting/section_parser.rb - About 1 day to fix

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

Severity: Minor
Found in app/models/concerns/fluentd/setting/plugin_parameter.rb - About 3 hrs to fix

    Class Plugin has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Plugin
      class GemError < StandardError; end
    
      WORKING = []
    
    
    Severity: Minor
    Found in app/models/plugin.rb - About 3 hrs to fix

      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
      Severity: Minor
      Found in app/models/concerns/fluentd/setting/configurable.rb - About 2 hrs to fix

      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')
      Severity: Major
      Found in babel.config.js - About 2 hrs to fix

        Class Agent has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Agent
            module Common
              attr_reader :extra_options
        
              def self.included(base)
        Severity: Minor
        Found in app/models/fluentd/agent/common.rb - About 2 hrs to fix

          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
          Severity: Minor
          Found in app/models/concerns/fluentd/setting/configurable.rb - About 2 hrs to fix

          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: {
          Severity: Major
          Found in app/javascript/packs/components/parser_plugin_form.js - About 2 hrs to fix

            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"
            Severity: Major
            Found in app/controllers/api/config_definitions_controller.rb - About 2 hrs to fix

              Function updateHighlightedLines has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    updateHighlightedLines: function(matches) {
                      if (!matches) {
                        this.highlightedLines = null;
                        return;
                      }
              Severity: Minor
              Found in app/javascript/packs/in_tail_parse.js - About 1 hr to fix

                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;
                Severity: Minor
                Found in app/javascript/packs/codemirror.js - About 1 hr to fix

                  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"
                  Severity: Minor
                  Found in app/models/concerns/fluentd/setting/plugin_config.rb - About 1 hr to fix

                    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 = []
                    Severity: Minor
                    Found in lib/regexp_preview/multi_line.rb - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in app/models/fluentd.rb - About 1 hr to fix

                      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 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
                      Severity: Minor
                      Found in app/models/concerns/fluentd/setting/registry_loader.rb - About 1 hr to fix

                      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)
                      Severity: Minor
                      Found in app/models/concerns/fluentd/setting/plugin.rb - About 1 hr to fix

                      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)
                      Severity: Minor
                      Found in app/models/concerns/fluentd/setting/plugin_config.rb - About 1 hr to fix

                        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|
                        Severity: Minor
                        Found in app/models/fluentd/setting/config.rb - About 1 hr to fix

                        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 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)
                        Severity: Minor
                        Found in app/models/concerns/fluentd/setting/plugin_config.rb - About 1 hr to fix

                        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"] || []
                        Severity: Minor
                        Found in app/models/fluentd/agent/common.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language