fluent/fluentd-ui

View on GitHub

Showing 52 of 79 total issues

Avoid too many return statements within this function.
Open

          return "variable";
Severity: Major
Found in app/javascript/packs/codemirror.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return "builtin";
    Severity: Major
    Found in app/javascript/packs/codemirror.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return "string";
      Severity: Major
      Found in app/javascript/packs/codemirror.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return "keyword";
        Severity: Major
        Found in app/javascript/packs/codemirror.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return "keyword";
          Severity: Major
          Found in app/javascript/packs/codemirror.js - About 30 mins to fix

            Method reformat_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def reformat_value(name, value)
                      type = column_type(name)
                      return value if type.nil? # name == :time_key
                      return value.to_sym if type == :enum
                      return value if type == :regexp
            Severity: Minor
            Found in app/models/concerns/fluentd/setting/plugin_parameter.rb - About 25 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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                name = params[:name]
                type = params[:type]
                prefix = case type
                         when "input"
            Severity: Minor
            Found in app/controllers/api/config_definitions_controller.rb - About 25 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 render_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def render_section(key, options)
                section_class = object.class._sections[key]
                children = object.__send__(key) || { "0" => {} }
                html = ""
                html_class = "js-nested-column #{section_class.multi ? "js-multiple" : ""}"
            Severity: Minor
            Found in app/form_builders/fluentd_form_builder.rb - About 25 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 initial_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def initial_params
                      new # ensure to load attributes
                      params = {}
                      self._defaults.each do |key, value|
                        if key.to_s.start_with?("@")
            Severity: Minor
            Found in app/models/concerns/fluentd/setting/plugin_parameter.rb - About 25 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 finish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def finish
                @setting = target_class.new(setting_params)
                unless @setting.valid?
                  return render "shared/settings/show"
                end
            Severity: Minor
            Found in app/controllers/concerns/setting_concern.rb - About 25 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 wait_starting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def wait_starting
                    begin
                      timeout(wait_process_starting_seconds) do
                        loop do
                          break if pid && Process.kill(0, pid)
            Severity: Minor
            Found in app/models/fluentd/agent/fluentd_gem.rb - About 25 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 6 (exceeds 5 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 25 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