Showing 165 of 421 total issues
Function _hook_validation
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _hook_validation(self):
errors = super(InvoiceEletronic, self)._hook_validation()
if self.model == '002':
issqn_codigo = ''
if not self.company_id.inscr_mun:
- 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 25 (exceeds 5 allowed). Consider refactoring. Open
def action_send_eletronic_invoice(self):
super(InvoiceEletronic, self).action_send_eletronic_invoice()
if self.model == '002' 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
File nfse_ginfes.py
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# © 2016 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
File wizard_import_cnab.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
File pos_order.py
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# © 2016 Alessandro Fernandes Martini <alessandrofmartini@gmail.com>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
Function _hook_validation
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def _hook_validation(self):
errors = super(InvoiceEletronic, self)._hook_validation()
if self.model == '009':
issqn_codigo = ''
if not self.company_id.inscr_mun:
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
def _hook_validation(self):
errors = super(InvoiceEletronic, self)._hook_validation()
if self.model == '008':
issqn_codigo = ''
if not self.company_id.inscr_mun:
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
def _hook_validation(self):
errors = super(InvoiceEletronic, self)._hook_validation()
if self.model == '010':
issqn_codigo = ''
if not self.company_id.inscr_mun:
- 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 _display_address
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def _display_address(self, without_company=False):
address = self
if address.country_id and address.country_id.code != 'BR':
# this ensure other localizations could do what they want
- 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_validate
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def checkout_form_validate(self, mode, all_form_values, data):
errors, error_msg = super(L10nBrWebsiteSale, self).\
checkout_form_validate(mode, all_form_values, data)
cnpj_cpf = data.get('cnpj_cpf', '0')
email = data.get('email', 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 action_send_eletronic_invoice
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def action_send_eletronic_invoice(self):
super(InvoiceEletronic, self).action_send_eletronic_invoice()
if self.model not in ('55', '65') or self.state in (
'done', 'denied', 'cancel'):
- 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
File br_account.py
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# © 2009 Renato Lima - Akretion
# © 2014 KMEE - www.kmee.com.br
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
Function _prepare_invoice_line_from_po_line
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _prepare_invoice_line_from_po_line(self, line):
res = super(AccountInvoice, self)._prepare_invoice_line_from_po_line(
line)
res['valor_bruto'] = line.valor_bruto
File invoice_eletronic.py
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# © 2016 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
Function _calculate_points
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_points(self, rule, product, state, partner):
"""Calcula a pontuação das regras. A pontuação aumenta de acordo
com os 'matches'. Não havendo match(exceto quando o campo não está
definido) retorna o valor -1, que posteriormente será tratado como
uma regra a ser descartada.
- 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_eletronic_invoice_values
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_eletronic_invoice_values(self):
res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
if self.model == '010':
tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
dt_emissao = datetime.strptime(self.data_emissao, DTFT)
- 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
File sale.py
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# © 2009 Renato Lima - Akretion
# © 2012 Raphaël Valyi - Akretion
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
AccountInvoiceLine
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
@api.model
def _default_company_fiscal_type(self):
Consider simplifying this complex logical expression. Open
if self.model == '009':
tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
dt_emissao = datetime.strptime(self.data_emissao, DTFT)
dt_emissao = pytz.utc.localize(dt_emissao).astimezone(tz)
dt_emissao = dt_emissao.strftime('%d/%m/%Y')
Function _compute_amount_line_all
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _compute_amount_line_all(self):
super(PosOrderLine, self)._compute_amount_line_all()
for line in self:
currency = line.order_id.pricelist_id.currency_id
values = line.order_id.fiscal_position_id.map_tax_extra_values(
- 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"