Trust-Code/odoo-brasil

View on GitHub

Showing 165 of 421 total issues

Function br_boleto_onchange_boleto_type has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def br_boleto_onchange_boleto_type(self):
        vals = {}

        if self.boleto_type not in IMPLEMENTADOS:
            vals['warning'] = {
Severity: Minor
Found in br_boleto/models/payment_mode.py - About 2 hrs to fix

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_imperial.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import re
Severity: Minor
Found in br_nfse/models/nfse_imperial.py - About 2 hrs to fix

    Function _prepare_invoice_line has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _prepare_invoice_line(self, qty):
            res = super(SaleOrderLine, self)._prepare_invoice_line(qty)
    
            res['valor_desconto'] = self.valor_desconto
            res['valor_bruto'] = self.valor_bruto
    Severity: Major
    Found in br_sale/models/sale.py - About 2 hrs to fix

      Function invoice_line_move_line_get has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def invoice_line_move_line_get(self):
              res = super(AccountInvoice, self).invoice_line_move_line_get()
      
              contador = 0
      
      
      Severity: Minor
      Found in br_account/models/account_invoice.py - About 2 hrs to fix

      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_item has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _prepare_eletronic_invoice_item(self, item, invoice):
              res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_item(
                  item, invoice)
              if self.model not in ('55', '65'):
                  return res
      Severity: Minor
      Found in br_nfe/models/invoice_eletronic.py - About 2 hrs to fix

      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

      InvoiceEletronic has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class InvoiceEletronic(models.Model):
          _name = 'invoice.eletronic'
      
          _inherit = ['mail.thread']
      
      
      Severity: Minor
      Found in br_account_einvoice/models/invoice_eletronic.py - About 2 hrs to fix

        Function validate_ie_param has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def validate_ie_param(uf, inscr_est):
        
            if uf not in PARAMETERS:
                return True
        
        
        Severity: Minor
        Found in br_base/tools/fiscal.py - About 2 hrs to fix

        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_vals has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def _prepare_edoc_vals(self, inv):
                res = super(AccountInvoice, self)._prepare_edoc_vals(inv)
        
                res['payment_mode_id'] = inv.payment_mode_id.id
                res['ind_pres'] = inv.fiscal_position_id.ind_pres
        Severity: Minor
        Found in br_nfe/models/account_invoice.py - About 2 hrs to fix

        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_segmento has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def _prepare_segmento(self, line):
                vals = super(Sicredi240, self)._prepare_segmento(line)
                if not line.payment_mode_id.bank_account_id.codigo_convenio or \
                   not line.payment_mode_id.bank_account_id.bra_number:
                    raise UserError(
        Severity: Minor
        Found in br_cnab/febraban/cnab_240/bancos/sicredi.py - About 2 hrs to fix

        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_pis_pasep has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def _validate_pis_pasep(self):
                if not self.pis_pasep:
                    return True
        
                digits = []
        Severity: Minor
        Found in br_hr/model/hr_employee.py - About 2 hrs to fix

        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_icms_st has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_icms_st(self, price_base, ipi_value, icms_value):
                icmsst_tax = self.filtered(lambda x: x.domain == 'icmsst')
                if not icmsst_tax:
                    return []
                vals = self._tax_vals(icmsst_tax)
        Severity: Minor
        Found in br_account/models/account_tax.py - About 1 hr to fix

        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 _parse_cnab has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def _parse_cnab(self, cnab_file):
                arquivo = self._create_arquivo_cnab(cnab_file)
                transactions = []
                move_lines = []
                payment_line_ids = []
        Severity: Minor
        Found in br_cnab/wizard/wizard_import_cnab.py - About 1 hr to fix

        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_pis_cofins has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_pis_cofins(self, price_base):
                pis_cofins_tax = self.filtered(lambda x: x.domain in ('pis', 'cofins'))
                if not pis_cofins_tax:
                    return []
                taxes = []
        Severity: Minor
        Found in br_account/models/account_tax.py - About 1 hr to fix

        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_domain has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_domain(self, country_id=False, state_id=False,
                           city_id=False, district=False,
                           street=False, zip_code=False):
                domain = []
                if zip_code:
        Severity: Minor
        Found in br_zip/models/br_zip.py - About 1 hr to fix

        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_ba has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def validate_ie_ba(inscr_est):
            inscr_est = re.sub('[^0-9]', '', inscr_est)
            inscr_est = map(int, inscr_est)
        
            # verificando o tamanho da inscrição estadual
        Severity: Minor
        Found in br_base/tools/fiscal.py - About 1 hr to fix

        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 import_ncm has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def import_ncm(self):
                if not self.product_fiscal_class_csv:
                    raise UserError(u'Nenhum Arquivo Selecionado!')
                ncm_string = base64.decodestring(self.product_fiscal_class_csv)
                temp = tempfile.NamedTemporaryFile(delete=False)
        Severity: Minor
        Found in br_account/wizard/br_product_fiscal_classification_wizard.py - About 1 hr to fix

        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_detalhes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_detalhes(self):
                for line in self:
                    msg = []
                    if line.cfop_id:
                        msg += [u'CFOP: %s' % line.cfop_id.code]
        Severity: Minor
        Found in br_sale/models/sale.py - About 1 hr to fix

        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 _preview_cnab has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def _preview_cnab(self):
                codigos_movimentacao = {
                    0: u'Evento Desconhecido',
                    2: u'Entrada Confirmada',
                    3: u'Entrada Rejeitada',
        Severity: Minor
        Found in br_cnab/wizard/wizard_import_cnab.py - About 1 hr to fix

        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 _get_pair_to_reconcile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_pair_to_reconcile(self):
                # field is either 'amount_residual' or 'amount_residual_currency'
                # (if the reconciled account has a secondary currency set)
                field = self[0].account_id.currency_id and 'amount_residual_currency'\
                    or 'amount_residual'
        Severity: Minor
        Found in br_account/models/account_move.py - About 1 hr to fix

        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 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def action_send_eletronic_invoice(self):
                super(InvoiceEletronic, self).action_send_eletronic_invoice()
                if self.model != '010' or self.state in ('done', 'cancel'):
                    return
        
        
        Severity: Minor
        Found in br_nfse/models/nfse_imperial.py - About 1 hr to fix

        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

        Severity
        Category
        Status
        Source
        Language