akretion/ooor

View on GitHub

Showing 60 of 60 total issues

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

      def name_search(name='', domain=[], operator='ilike', limit=100, context={})
Severity: Minor
Found in lib/ooor/base.rb - About 35 mins to fix

    Method load_records_page has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_records_page(search_order)
          if @per_value && @page_value
            offset = @per_value * @page_value
            limit = @per_value
          else
    Severity: Minor
    Found in lib/ooor/relation.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 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 load_with_defaults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_with_defaults(attributes, default_get_list)
          defaults = rpc_execute("default_get", default_get_list || self.class.fields.keys + self.class.associations_keys, context)
          self.class.associations_keys.each do |k|
            # m2m with existing records:
            if defaults[k].is_a?(Array) && defaults[k][0].is_a?(Array) && defaults[k][0][2].is_a?(Array)
    Severity: Minor
    Found in lib/ooor/persistence.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

    Avoid too many return statements within this method.
    Open

              return false
    Severity: Major
    Found in lib/ooor/type_casting.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return new(method, faultCode, faultString, *args)
      Severity: Major
      Found in lib/ooor/errors.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return Base64.encode64(v.read())
        Severity: Major
        Found in lib/ooor/type_casting.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return UnAuthorizedError.new(method, faultCode, faultString, *args)
          Severity: Major
          Found in lib/ooor/errors.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return SessionExpiredError.new(method, faultCode, faultString, *args)
            Severity: Major
            Found in lib/ooor/errors.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return InvalidSessionError.new(method, faultCode, faultString, *args)
              Severity: Major
              Found in lib/ooor/errors.rb - About 30 mins to fix

                Method inject_session_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def inject_session_context(service, method, *args)
                      if service == :object && (i = Ooor.irregular_context_position(method)) && args.size >= i
                        c = HashWithIndifferentAccess.new(args[i])
                        args[i] = @session.session_context(c)
                      elsif args[-1].is_a? Hash #context
                Severity: Minor
                Found in lib/ooor/services.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

                Method cast_map_to_ruby! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def cast_map_to_ruby!(map)
                          map.each do |k, v|
                            if self.t.fields[k] && v.is_a?(String) && !v.empty?
                              case self.t.fields[k]['type']
                              when 'datetime'
                Severity: Minor
                Found in lib/ooor/type_casting.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

                Method create has a Cognitive Complexity of 6 (exceeds 5 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')
                      if @session.odoo_serie > 7
                        json_conn = @session.get_client(:json, "#{@session.base_jsonrpc2_url}")
                        x = json_conn.oe_service(@session.web_session, :db, nil, 'create_database', password, db_name, demo, lang, user_password)
                      else # via XMLRPC on v7:
                Severity: Minor
                Found in lib/ooor/services.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

                Method object_service has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def object_service(service, obj, method, *args)
                      @session.login_if_required()
                      args = inject_session_context(service, method, *args)
                      uid = @session.config[:user_id]
                      db = @session.config[:database]
                Severity: Minor
                Found in lib/ooor/services.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

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

                    def initialize(attributes = {}, default_get_list = false, persisted = false, has_changed = false, lazy = false)
                      self.class.reload_fields_definition(false)
                      @attributes = {}
                      @ir_model_data_id = attributes.delete(:ir_model_data_id)
                      @marked_for_destruction = false
                Severity: Minor
                Found in lib/ooor/persistence.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

                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

                Method find_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def find_single(scope, options)
                          context = options[:context] || {}
                          reload_fields_definition(false)
                          fields = options[:fields] || options[:only] || fast_fields(options)
                          fields += options[:include] if options[:include]
                Severity: Minor
                Found in lib/ooor/relation/finder_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

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

                    def load(attributes)
                      self.class.reload_fields_definition(false)
                      raise ArgumentError, "expected an attributes Hash, got #{attributes.inspect}" unless attributes.is_a?(Hash)
                      @associations ||= {}
                      @attributes ||= {}
                Severity: Minor
                Found in lib/ooor/persistence.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

                Method alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def alias(context={})
                        # NOTE in v8, see if we can use ModelConvert here https://github.com/akretion/openerp-addons/blob/trunk-website-al/website/models/ir_http.py#L126
                        if session.config[:aliases]
                          lang = context['lang'] || session.config['lang'] || 'en_US'
                          if alias_data = session.config[:aliases][lang]
                Severity: Minor
                Found in lib/ooor/naming.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

                Method cast_answer_to_ruby! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def cast_answer_to_ruby!(answer)
                        def cast_map_to_ruby!(map)
                          map.each do |k, v|
                            if self.t.fields[k] && v.is_a?(String) && !v.empty?
                              case self.t.fields[k]['type']
                Severity: Minor
                Found in lib/ooor/type_casting.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