fluent/fluentd-ui

View on GitHub

Showing 79 of 79 total issues

Method parse_section has a Cognitive Complexity of 52 (exceeds 5 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 day 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

Class Fluentd has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class Fluentd
  module Setting
    module PluginParameter
      extend ActiveSupport::Concern

Severity: Minor
Found in app/models/concerns/fluentd/setting/plugin_parameter.rb - About 3 hrs to fix

    Class Plugin has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Plugin
      class GemError < StandardError; end
    
      WORKING = []
    
    
    Severity: Minor
    Found in app/models/plugin.rb - About 3 hrs to fix

      Method initialize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(attributes = {})
              # the superclass does not know specific attributes of the model
              begin
                super
              rescue ActiveModel::UnknownAttributeError => ex
      Severity: Minor
      Found in app/models/concerns/fluentd/setting/configurable.rb - About 2 hrs 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

              $.ajax({
                url: this.endpoint,
                method: "POST",
                data: {
                  _method: "PATCH",
      Severity: Major
      Found in app/javascript/packs/settings.js and 1 other location - About 2 hrs to fix
      app/javascript/packs/settings.js on lines 89..104

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

      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

              $.ajax({
                url: this.endpoint,
                method: "POST",
                data: {
                  _method: "DELETE",
      Severity: Major
      Found in app/javascript/packs/settings.js and 1 other location - About 2 hrs to fix
      app/javascript/packs/settings.js on lines 62..80

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

      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

      Function exports has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(api) {
        var validEnv = ['development', 'test', 'production']
        var currentEnv = api.env()
        var isDevelopmentEnv = api.env('development')
        var isProductionEnv = api.env('production')
      Severity: Major
      Found in babel.config.js - About 2 hrs to fix

        Class Agent has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Agent
            module Common
              attr_reader :extra_options
        
              def self.included(base)
        Severity: Minor
        Found in app/models/fluentd/agent/common.rb - About 2 hrs to fix

          Method config_param has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 updateSection has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              updateSection: function() {
                $.ajax({
                  method: "GET",
                  url: `${relativeUrlRoot}/api/config_definitions`,
                  headers: {
          Severity: Major
          Found in app/javascript/packs/components/parser_plugin_form.js - About 2 hrs to fix

            Method index has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def index
                name = params[:name]
                type = params[:type]
                prefix = case type
                         when "input"
            Severity: Major
            Found in app/controllers/api/config_definitions_controller.rb - About 2 hrs to fix

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

                    $.ajax({
                      method: "GET",
                      url: `${relativeUrlRoot}/api/config_definitions`,
                      headers: {
                        "X-CSRF-Token": this.token
              Severity: Major
              Found in app/javascript/packs/components/parser_plugin_form.js and 4 other locations - About 1 hr to fix
              app/javascript/packs/components/aws_credential.js on lines 44..56
              app/javascript/packs/components/owned_plugin_form.js on lines 60..73
              app/javascript/packs/components/transport_config.js on lines 45..57
              app/javascript/packs/transport_section.js on lines 55..68

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

              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 5 locations. Consider refactoring.
              Open

                    $.ajax({
                      method: "GET",
                      url: `${relativeUrlRoot}/api/config_definitions`,
                      headers: {
                        "X-CSRF-Token": this.token
              Severity: Major
              Found in app/javascript/packs/components/transport_config.js and 4 other locations - About 1 hr to fix
              app/javascript/packs/components/aws_credential.js on lines 44..56
              app/javascript/packs/components/owned_plugin_form.js on lines 60..73
              app/javascript/packs/components/parser_plugin_form.js on lines 72..123
              app/javascript/packs/transport_section.js on lines 55..68

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

              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 5 locations. Consider refactoring.
              Open

                      $.ajax({
                        method: "GET",
                        url: `${relativeUrlRoot}/api/config_definitions`,
                        headers: {
                          "X-CSRF-Token": this.token
              Severity: Major
              Found in app/javascript/packs/transport_section.js and 4 other locations - About 1 hr to fix
              app/javascript/packs/components/aws_credential.js on lines 44..56
              app/javascript/packs/components/owned_plugin_form.js on lines 60..73
              app/javascript/packs/components/parser_plugin_form.js on lines 72..123
              app/javascript/packs/components/transport_config.js on lines 45..57

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

              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 5 locations. Consider refactoring.
              Open

                    $.ajax({
                      method: "GET",
                      url: `${relativeUrlRoot}/api/config_definitions`,
                      headers: {
                        "X-CSRF-Token": this.token
              Severity: Major
              Found in app/javascript/packs/components/owned_plugin_form.js and 4 other locations - About 1 hr to fix
              app/javascript/packs/components/aws_credential.js on lines 44..56
              app/javascript/packs/components/parser_plugin_form.js on lines 72..123
              app/javascript/packs/components/transport_config.js on lines 45..57
              app/javascript/packs/transport_section.js on lines 55..68

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

              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 5 locations. Consider refactoring.
              Open

                    $.ajax({
                      method: "GET",
                      url: `${relativeUrlRoot}/api/config_definitions`,
                      headers: {
                        "X-CSRF-Token": this.token
              Severity: Major
              Found in app/javascript/packs/components/aws_credential.js and 4 other locations - About 1 hr to fix
              app/javascript/packs/components/owned_plugin_form.js on lines 60..73
              app/javascript/packs/components/parser_plugin_form.js on lines 72..123
              app/javascript/packs/components/transport_config.js on lines 45..57
              app/javascript/packs/transport_section.js on lines 55..68

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

              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

              Function updateHighlightedLines has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    updateHighlightedLines: function(matches) {
                      if (!matches) {
                        this.highlightedLines = null;
                        return;
                      }
              Severity: Minor
              Found in app/javascript/packs/in_tail_parse.js - About 1 hr to fix

                Function token has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    token: function(stream, state) {
                      if (stream.eatWhile(/[ \t]/)) {
                        // ignore indenting spaces
                        stream.skipTo(stream.peek());
                        return;
                Severity: Minor
                Found in app/javascript/packs/codemirror.js - About 1 hr to fix

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

                      inputId: function(pluginType, option) {
                        if (pluginType === "output") {
                          return `setting_${option.name}`;
                        } else {
                          return `setting_${_.snakeCase(pluginType)}_0__${option.name}`;
                  Severity: Major
                  Found in app/javascript/packs/components/config_field.js and 1 other location - About 1 hr to fix
                  app/javascript/packs/components/config_field.js on lines 93..99

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

                  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(pluginType, option) {
                        if (pluginType === "output") {
                          return `setting[${option.name}]`;
                        } else {
                          return `setting[${_.snakeCase(pluginType)}[0]][${option.name}]`;
                  Severity: Major
                  Found in app/javascript/packs/components/config_field.js and 1 other location - About 1 hr to fix
                  app/javascript/packs/components/config_field.js on lines 86..92

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

                  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