akretion/ooor

View on GitHub

Showing 60 of 60 total issues

Method sanitize_attribute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def sanitize_attribute(skey, value)
      type = self.class.fields[skey]['type']
      if type == 'boolean' && (value == 1 || value == "1")
        true
      elsif type == 'boolean'&& (value == 0 || value == "0")
Severity: Minor
Found in lib/ooor/type_casting.rb - About 1 hr 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 build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def self.build(faultCode, faultString, method, *args)
      if faultCode =~ /AttributeError: / || faultCode =~ /object has no attribute/
        return UnknownAttributeOrAssociationError.new("method: #{method} - args: #{args.inspect}", faultCode, faultString)
      elsif faultCode =~ /TypeError: /
        return TypeError.new(method, faultCode, faultString, *args)
Severity: Minor
Found in lib/ooor/errors.rb - About 1 hr 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 odoo_serie has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def odoo_serie
      if config.user_id # authenticated session
        if config[:server_version_info] # v10 and onward
          config[:server_version_info][0]
        elsif config['partner_id']
Severity: Minor
Found in lib/ooor/session.rb - About 1 hr 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 oe_service has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def oe_service(session_info, service, obj, method, *args)
          if service == :exec_workflow
            url = '/web/dataset/exec_workflow'
            params = {"model"=>obj, "id"=>args[0], "signal"=>method}
          elsif service == :db || service == :common
Severity: Minor
Found in lib/ooor/transport/json_client.rb - About 1 hr 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_openerp_model has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def define_openerp_model(options) #TODO param to tell if we define constants or not
      if !models[options[:model]] || options[:reload]# || !scope.const_defined?(model_class_name)
        scope_prefix = options[:scope_prefix]
        scope = scope_prefix ? Object.const_get(scope_prefix) : Object
        model_class_name = class_name_from_model_key(options[:model])
Severity: Minor
Found in lib/ooor/session.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 item_to_id has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def item_to_id(item, context)
          if item.is_a?(String)
            if item.to_i == 0#triggers ir_model_data absolute reference lookup
              tab = item.split(".")
              domain = [['name', '=', tab[-1]]]
Severity: Minor
Found in lib/ooor/relation/finder_methods.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 to_a has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def to_a
      if loaded?
        @records
      else
        if @order_values.empty?
Severity: Minor
Found in lib/ooor/relation.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 value_to_openerp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def value_to_openerp(v)
        if v == nil || v == ""
          return false
        elsif !v.is_a?(Integer) && !v.is_a?(Float) && v.is_a?(Numeric) && v.respond_to?(:to_f)
          return v.to_f
Severity: Minor
Found in lib/ooor/type_casting.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 cast_o2m_association has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def cast_o2m_association(v)
      v.collect do |value|
        if value.is_a?(Base)
          if value.new_record?
            [0, 0, value.to_openerp_hash]
Severity: Minor
Found in lib/ooor/type_casting.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 const_get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def const_get(model_key, lang=nil);
      if config[:aliases]
        if lang && alias_data = config[:aliases][lang]
          openerp_model = alias_data[model_key] || model_key
        elsif alias_data = config[:aliases][connection_session['lang'] || :en_US]
Severity: Minor
Found in lib/ooor/session.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 add_autosave_association_callbacks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def add_autosave_association_callbacks(reflection) # TODO add support for m2o
          save_method = :"autosave_associated_records_for_#{reflection.name}"
          validation_method = :"validate_associated_records_for_#{reflection.name}"
          collection = true #reflection.collection?
          unless method_defined?(save_method)
Severity: Minor
Found in lib/ooor/autosave_association.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 oe_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def oe_request(session_info, url, params, method, *args)
          if session_info[:req_id]
             session_info[:req_id] += 1
          else
             session_info[:req_id] = 1
Severity: Minor
Found in lib/ooor/transport/json_client.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 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 search has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def search(domain=[], offset=0, limit=false, order=false, context={}, count=false)
Severity: Minor
Found in lib/ooor/base.rb - About 45 mins to fix

    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 oe_service has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def oe_service(session_info, service, obj, method, *args)
    Severity: Minor
    Found in lib/ooor/transport/json_client.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(attributes = {}, default_get_list = false, persisted = false, has_changed = false, lazy = false)
      Severity: Minor
      Found in lib/ooor/persistence.rb - About 35 mins to fix

        Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create(password=@session.config[:db_password], db_name='ooor_test', demo=true, lang='en_US', user_password=@session.config[:password] || 'admin')
        Severity: Minor
        Found in lib/ooor/services.rb - About 35 mins to fix

          Method oe_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def oe_request(session_info, url, params, method, *args)
          Severity: Minor
          Found in lib/ooor/transport/json_client.rb - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language