fluent/fluentd-ui

View on GitHub

Showing 79 of 79 total issues

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 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 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 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 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            beforeMount: function() {
              this.pluginType = this.$el.attributes.pluginType.nodeValue;
              this.pluginName = this.$el.attributes.pluginName.nodeValue;
            },
        Severity: Major
        Found in app/javascript/packs/transport_section.js and 1 other location - About 1 hr to fix
        app/javascript/packs/fluent_log.js on lines 20..23

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 64.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            beforeMount: function() {
              this.logUrl = this.$el.attributes.logUrl.nodeValue;
              this.initialAutoReload = this.$el.attributes.initialAutoReload.nodeValue;
            },
        Severity: Major
        Found in app/javascript/packs/fluent_log.js and 1 other location - About 1 hr to fix
        app/javascript/packs/transport_section.js on lines 39..42

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 64.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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|
        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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            "formats": function(newValue, oldValue) {
              console.log(`watch formats: ${newValue}`);
              this.$emit("change-formats", {
                "format_firstline": this.formatFirstline,
                "formats": this.formats
        Severity: Major
        Found in app/javascript/packs/components/parser_multiline_form.js and 1 other location - About 1 hr to fix
        app/javascript/packs/components/parser_multiline_form.js on lines 20..26

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 63.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            "formatFirstLine": function(newValue, oldValue) {
              console.log(`watch formatFirstLine: ${newValue}`);
              this.$emit("change-formats", {
                "format_firstline": this.formatFirstline,
                "formats": this.formats
        Severity: Major
        Found in app/javascript/packs/components/parser_multiline_form.js and 1 other location - About 1 hr to fix
        app/javascript/packs/components/parser_multiline_form.js on lines 27..33

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 63.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

          Method _matches has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _matches
                return [] if %i(json csv tsv ltsv).include?(@plugin_name)
                begin
                  io = File.open(path)
                  reader = FileReverseReader.new(io)
          Severity: Minor
          Found in lib/regexp_preview/single_line.rb - About 1 hr to fix

            Method delete_element has 32 lines of code (exceeds 25 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

              Function preview has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    preview: function() {
                      console.log("preview!!!!");
                      if (this.previewAjax && this.previewAjax.state() === "pending") {
                        this.previewAjax.abort && this.previewAjax.abort();
                      }
              Severity: Minor
              Found in app/javascript/packs/in_tail_parse.js - About 1 hr to fix

                Method parse_section has 31 lines of code (exceeds 25 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 hr to fix

                  Method logged_errors has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def logged_errors(&block)
                      return [] unless File.exist?(log_file)
                      buf = []
                      io = File.open(log_file)
                      reader = ::FileReverseReader.new(io)
                  Severity: Minor
                  Found in app/models/fluentd_log.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

                  Function created has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      created: function(){
                        let timer;
                        let self = this;
                        let currentInterval = POLLING_INTERVAL;
                        let fetch = function(){
                  Severity: Minor
                  Found in app/javascript/packs/navigation.js - About 1 hr to fix

                    Method config_param has 26 lines of code (exceeds 25 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 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language