fluent/fluentd-ui

View on GitHub

Showing 79 of 79 total issues

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

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

      Function mounted has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        mounted: function() {
          if (this.option.type === "enum") {
            this.selectedValue = this.option.default;
          } else if (this.option.type === "bool") {
            this.checkboxValue = this.option.default;
      Severity: Minor
      Found in app/javascript/packs/components/config_field.js - About 55 mins 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

                @plugin.parse(line) do |time, record|
                  next unless record
                  last_pos = 0
                  record.each do |key, value|
                    v = value.to_s
      Severity: Minor
      Found in lib/regexp_preview/single_line.rb and 1 other location - About 55 mins to fix
      lib/regexp_preview/multi_line.rb on lines 46..58

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

      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

                @plugin.parse(chunk) do |time, record|
                  next unless record
                  last_pos = 0
                  record.each do |key, value|
                    v = value.to_s
      Severity: Minor
      Found in lib/regexp_preview/multi_line.rb and 1 other location - About 55 mins to fix
      lib/regexp_preview/single_line.rb on lines 35..47

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

      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 parse_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_attributes(attributes)
              sections, params = attributes.partition do |key, _|
                self._sections.key?(key.to_sym)
              end
              elements = sections.map do |key, section_params|
      Severity: Minor
      Found in app/models/concerns/fluentd/setting/section_config.rb - About 45 mins 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 group_by_label has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def group_by_label
              hash = Hash.new{|h, k| h[k] = {} }
              sources.each do |source|
                label = source["@label"] || source["label"]
                if label
      Severity: Minor
      Found in app/models/fluentd/setting/config.rb - About 45 mins 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 to_config has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 tail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def tail(limit = nil)
          return [] unless File.exists?(log_file)
      
          limit = limit.to_i rescue 0
          limit = limit.zero? ? Settings.default_log_tail_count : limit
      Severity: Minor
      Found in app/models/fluentd_log.rb - About 45 mins 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

                if (!foundExpression && this.unwatchExpression) {
                  this.expression = null;
                  this.unwatchExpression();
                  this.unwatchExpression = null;
                }
      Severity: Minor
      Found in app/javascript/packs/components/parser_plugin_form.js and 1 other location - About 40 mins to fix
      app/javascript/packs/components/parser_plugin_form.js on lines 117..121

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

      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

                if (!foundTimeFormat && this.unwatchTimeFormat) {
                  this.timeFormat = null;
                  this.unwatchTimeFormat();
                  this.unwatchTimeFormat = null;
                }
      Severity: Minor
      Found in app/javascript/packs/components/parser_plugin_form.js and 1 other location - About 40 mins to fix
      app/javascript/packs/components/parser_plugin_form.js on lines 112..116

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

      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

          inputId: function(name, index, subIndex) {
            return `setting_${this.containerType}_${index}_${this.grepType}_${subIndex}__${name}`;
          },
      Severity: Minor
      Found in app/javascript/packs/components/grep_pattern.js and 1 other location - About 40 mins to fix
      app/javascript/packs/components/grep_pattern.js on lines 39..41

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

      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

          inputName: function(name, index, subIndex) {
            return `setting[${this.containerType}[${index}]][${this.grepType}[${subIndex}]][${name}]`;
          }
      Severity: Minor
      Found in app/javascript/packs/components/grep_pattern.js and 1 other location - About 40 mins to fix
      app/javascript/packs/components/grep_pattern.js on lines 36..38

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

      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

            "parse.expression": function() {
              console.log(`parse.expression: ${this.parse.expression}`);
              this.preview();
            },
      Severity: Minor
      Found in app/javascript/packs/in_tail_parse.js and 1 other location - About 40 mins to fix
      app/javascript/packs/in_tail_parse.js on lines 38..41

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

      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

            "parse.time_format": function() {
              console.log(`parse.time_format: ${this.parse.time_format}`);
              this.preview();
            },
      Severity: Minor
      Found in app/javascript/packs/in_tail_parse.js and 1 other location - About 40 mins to fix
      app/javascript/packs/in_tail_parse.js on lines 34..37

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

      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 parse_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_config(content)
              scanner = StringScanner.new(content)
              contents = Hash.new {|h, k| h[k] = [] }
              until scanner.eos? do
                started = scanner.pos
      Severity: Minor
      Found in app/models/fluentd/agent/common.rb - About 35 mins 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 _matches has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 load_plugin_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def load_plugin_config
                dumped_config = {}
                plugin_class.ancestors.reverse_each do |klass|
                  next unless klass.respond_to?(:dump_config_definition)
                  dumped_config_definition = klass.dump_config_definition
      Severity: Minor
      Found in app/models/concerns/fluentd/setting/plugin.rb - About 35 mins 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 each_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def each_line(&block)
          #read from the end of file
          io.seek(0, IO::SEEK_END)
          buf = ""
          loop do
      Severity: Minor
      Found in lib/file_reverse_reader.rb - About 35 mins 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 tree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def tree
          Dir.glob("#{root_dir == "/" ? "/" : "#{root_dir}/"}*").map do |file|
            {
              :path => file,
              :is_dir => File.directory?(file),
      Severity: Minor
      Found in lib/treeview.rb - About 35 mins 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

      Severity
      Category
      Status
      Source
      Language