Showing 165 of 421 total issues
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, cr, uid, ids, datas, context=False):
Function generate_nfe_proc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_nfe_proc(self):
if self.state in ['cancel', 'done', 'denied']:
recibo = self.env['ir.attachment'].search([
('res_model', '=', 'invoice.eletronic'),
('res_id', '=', self.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
Function zip_search_multi
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def zip_search_multi(self, country_id=False,
state_id=False, city_id=False,
district=False, street=False, zip_code=False):
domain = self.set_domain(
country_id=country_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
Function validate_ie_go
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_ie_go(inscr_est):
inscr_est = re.sub('[^0-9]', '', inscr_est)
# verificando o tamanho da inscrição estadual
if len(inscr_est) != 9:
- 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 _set_taxes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _set_taxes(self):
super(AccountInvoiceLine, self)._set_taxes()
self._update_tax_from_ncm()
fpos = self.invoice_id.fiscal_position_id
if fpos:
- 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_statement_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_statement_data(self, arquivo,
transactions, move_lines):
inicio = final = datetime.now()
valor_total = Decimal('0.0')
if len(transactions):
- 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 tax_line_move_line_get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tax_line_move_line_get(self):
res = super(AccountInvoice, self).tax_line_move_line_get()
done_taxes = []
for tax_line in sorted(self.tax_line_ids, key=lambda x: -x.sequence):
- 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 _compute_state
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _compute_state(self):
for item in self:
if any(line.state == 'rejected' for line in item.line_ids):
item.state = 'pending'
elif all(line.state == 'baixa' for line in item.line_ids):
- 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 validate_cnpj
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_cnpj(cnpj):
""" Rotina para validação do CNPJ - Cadastro Nacional
de Pessoa Juridica.
:param string cnpj: CNPJ para ser validado
- 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_send_eletronic_invoice
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def action_send_eletronic_invoice(self):
super(InvoiceEletronic, self).action_send_eletronic_invoice()
if self.model == '008' and self.state not in ('done', 'cancel'):
self.state = 'error'
- 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 _compute_amount
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _compute_amount(self):
super(AccountInvoice, self)._compute_amount()
lines = self.invoice_line_ids
self.total_tax = sum(l.price_tax for l in lines)
self.icms_base = sum(l.icms_base_calculo for l in lines)
- 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 _checkout_form_save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _checkout_form_save(self, mode, checkout, all_values):
Partner = request.env['res.partner']
if mode[0] == 'new':
partner_id = Partner.sudo().create(checkout)
elif mode[0] == 'edit':
- 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 validate_cpf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_cpf(cpf):
"""Rotina para validação do CPF - Cadastro Nacional
de Pessoa Física.
:Return: True or False
- 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 nfse_export
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def nfse_export(self):
search_vals = []
search_vals.append(('data_emissao', '>=', self.start_date))
search_vals.append(('data_emissao', '<=', self.end_date))
search_vals.append(('state', 'in', ['cancel', 'done', 'denied']))
- 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 _hook_validation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _hook_validation(self):
errors = super(InvoiceEletronic, self)._hook_validation()
if self.model != '65':
return errors
if not self.company_id.partner_id.inscr_est:
- 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_confirm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def action_confirm(self):
for order in self:
prec = order.currency_id.decimal_places
itens = order.order_line
frete = round(sum(x.valor_frete for x in itens), prec)
- 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
Avoid too many return
statements within this function. Open
return sicredi
Avoid too many return
statements within this function. Open
return int(nosso_numero[10:])
Avoid too many return
statements within this function. Open
return Cnab240
Avoid too many return
statements within this function. Open
return -1