Showing 165 of 421 total issues
Function _onchange_cnpj_cpf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _onchange_cnpj_cpf(self):
country_code = self.country_id.code or ''
if self.cnpj_cpf and country_code.upper() == 'BR':
val = re.sub('[^0-9]', '', self.cnpj_cpf)
if len(val) == 14:
- 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 _onchange_despesas_frete_seguro
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _onchange_despesas_frete_seguro(self):
amount = 0
for line in self.order_line:
if line.product_id.fiscal_type == 'product':
amount += line.valor_bruto
- 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 _prepare_edoc_item_vals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_edoc_item_vals(self, line):
vals = {
'name': line.name,
'product_id': line.product_id.id,
'tipo_produto': line.product_type,
- 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 unlink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unlink(self):
for item in self:
if item.state in ('paid', 'open'):
state = 'Confirmado'
if item.state == 'paid':
- 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 action_preview_danfe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def action_preview_danfe(self):
docs = self.env['invoice.eletronic'].search(
[('invoice_id', '=', self.id)])
if not docs:
- 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"