fluent/fluentd-ui

View on GitHub

Showing 52 of 79 total issues

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

              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

                  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

                  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

                  Avoid too many return statements within this method.
                  Open

                              return element
                  Severity: Major
                  Found in app/models/fluentd/setting/config.rb - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language