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")
- Read upRead up
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)
- Read upRead up
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']
- Read upRead up
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
- Read upRead up
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])
- Read upRead up
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]]]
- Read upRead up
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?
- Read upRead up
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
- Read upRead up
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]
- Read upRead up
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]
- Read upRead up
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)
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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]
- Read upRead up
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)
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 #\
- Read upRead up
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)
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)
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')
Method oe_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def oe_request(session_info, url, params, method, *args)