fluent/fluentd-ui

View on GitHub

Showing 79 of 79 total issues

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

window.addEventListener("load", () => {
  new Vue({
    el: "#out-forward-setting",
    components: {
      "transport-config": TransportConfig,
Severity: Minor
Found in app/javascript/packs/out_forward_setting.js and 1 other location - About 35 mins to fix
app/javascript/packs/out_s3_setting.js on lines 6..14

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

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

window.addEventListener("load", () => {
  new Vue({
    el: "#out-s3-setting",
    components: {
      "owned-plugin-form": OwnedPluginForm,
Severity: Minor
Found in app/javascript/packs/out_s3_setting.js and 1 other location - About 35 mins to fix
app/javascript/packs/out_forward_setting.js on lines 6..14

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

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

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

    onChange: function() {
      console.log(this.pluginType, this.pluginName, this.transportType);
      this.updateSection();
    },
Severity: Minor
Found in app/javascript/packs/components/transport_config.js and 1 other location - About 30 mins to fix
app/javascript/packs/transport_section.js on lines 46..49

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

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

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

    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

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

                  onChange: function() {
                    console.log(this.pluginType, this.pluginName, this.transportType);
                    this.updateSection();
                  },
            Severity: Minor
            Found in app/javascript/packs/transport_section.js and 1 other location - About 30 mins to fix
            app/javascript/packs/components/transport_config.js on lines 36..39

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

            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

            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

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

                    def skip?(key, value)
                      return true if value.blank?
                      if self._defaults.key?(key)
                        self.class.reformat_value(key, self._defaults[key]) == self.class.reformat_value(key, value)
                      else
              Severity: Minor
              Found in app/models/concerns/fluentd/setting/section_config.rb and 1 other location - About 20 mins to fix
              app/models/concerns/fluentd/setting/plugin_config.rb on lines 118..123

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

              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

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

                    def skip?(key, value)
                      return true if value.blank?
                      if self._defaults.key?(key)
                        self.class.reformat_value(key, self._defaults[key]) == self.class.reformat_value(key, value)
                      else
              Severity: Minor
              Found in app/models/concerns/fluentd/setting/plugin_config.rb and 1 other location - About 20 mins to fix
              app/models/concerns/fluentd/setting/section_config.rb on lines 50..55

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

              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

              Severity
              Category
              Status
              Source
              Language