akretion/ooor

View on GitHub
lib/ooor/field_methods.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method reload_fields_definition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def reload_fields_definition(force=false)
        if force || !fields
          @t.fields = {}
          @columns_hash = {}
          if session.odoo_serie < 10
Severity: Minor
Found in lib/ooor/field_methods.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 get_association has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def get_association(meth, *args)
      return @associations[meth] || :undef if @skip
      lazy_load(meth, *args) if @lazy
      if @loaded_associations.has_key?(meth)
        @loaded_associations[meth]
Severity: Minor
Found in lib/ooor/field_methods.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 set_association has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def set_association(meth, *args)
      value = sanitize_association(meth, args[0])
      if self.class.many2one_associations.has_key?(meth) # TODO detect false positives changes for other associations too
        if @associations[meth].is_a?(Array) && @associations[meth][0] == value \
           || @associations[meth] == value #\
Severity: Minor
Found in lib/ooor/field_methods.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 define_m2o_association_method has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def define_m2o_association_method(meth)
        define_method "#{meth}_id" do |*args|
          if @associations[meth].is_a? Array
            @associations[meth][0]
          else
Severity: Minor
Found in lib/ooor/field_methods.rb - About 35 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 get_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_attribute(meth, *args)
      lazy_load(meth, *args) if @lazy && @attributes["id"] && !@attributes.has_key?(meth)
      if @attributes.has_key?(meth)
        @attributes[meth]
      elsif @attributes["id"] # if field is computed for instance
Severity: Minor
Found in lib/ooor/field_methods.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

There are no issues that match your filters.

Category
Status