Showing 119 of 160 total issues
Avoid deeply nested control flow statements. Open
if field_type == "serialized":
import json
vals[column] = json.dumps(field_val)
elif field_type == "jsonb":
Function _change_many2many_refs_orm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _change_many2many_refs_orm(
env, model_name, record_ids, target_record_id, exclude_columns
):
fields = env["ir.model.fields"].search(
[
- 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
Function add_xmlid
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_xmlid(cr, module, xmlid, model, res_id, noupdate=False):
Avoid deeply nested control flow statements. Open
if data and data != "None":
attachment_model.create(
{
"name": field,
"res_model": model_name,
Function _adjust_merged_values_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _adjust_merged_values_sql(
Avoid deeply nested control flow statements. Open
if api and isinstance(pool, api.Environment):
value = obj.default_get([field]).get(field)
else:
value = obj.default_get(cr, SUPERUSER_ID, [field]).get(field)
if value:
Function set_partner_id_from_partner_address_id
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_partner_id_from_partner_address_id(
Function invalidate_cache
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def invalidate_cache(env, flush=True):
"""Version-independent cache invalidation.
:param flush: whether pending updates should be flushed before invalidation.
It is ``True`` by default, which ensures cache consistency.
- 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
Function _change_many2one_refs_orm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _change_many2one_refs_orm(
env, model_name, record_ids, target_record_id, exclude_columns
):
fields = env["ir.model.fields"].search(
[
- 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
Consider simplifying this complex logical expression. Open
if (
[...excludedTerms].some(
(term) =>
terms[term] === file ||
titleTerms[term] === file ||
Function convert_field_to_html
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def convert_field_to_html(cr, table, field_name, html_field_name, verbose=True):
Function date_to_datetime_tz
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def date_to_datetime_tz(
Function _change_many2one_refs_orm
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _change_many2one_refs_orm(
Function convert_field_html_string_13to14
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def convert_field_html_string_13to14(
Function _adjust_merged_values_orm
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _adjust_merged_values_orm(
Function m2o_to_m2m
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def m2o_to_m2m(cr, model, table, field, source_field):
Function update_module_moved_fields
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_module_moved_fields(cr, model, moved_fields, old_module, new_module):
Function _change_translations_orm
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _change_translations_orm(
Function _change_translations_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _change_translations_sql(
Function _delete_records_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _delete_records_sql(