fluent/fluentd-ui

View on GitHub
app/models/concerns/fluentd/setting/configurable.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

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

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

    There are no issues that match your filters.

    Category
    Status