yadevteam/mongoid-giza

View on GitHub

Showing 3 of 3 total issues

Method load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def load(path, env)
        yaml_safe_load(File.open(path).read)[env].each do |section, settings|
          section = instance_variable_get("@#{section}")
          next unless section
          settings.each do |setting, value|
Severity: Minor
Found in lib/mongoid/giza/configuration.rb - 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 method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def method_missing(method, *args)
        if args.length == 1
          method_writer = "#{method}="
          super unless respond_to?(method_writer)
          @client.send method_writer, *args
Severity: Minor
Found in lib/mongoid/giza/search.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 attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def attribute(name, type = nil, options = {}, &block)
        unless type
          field = @klass.fields[name.to_s]
          type = if field
                   TYPES_MAP[field.type] || :string
Severity: Minor
Found in lib/mongoid/giza/index.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