Trust-Code/odoo-brasil

View on GitHub

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):
Severity: Minor
Found in br_boleto/reports/report.py - About 35 mins to fix

    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),
    Severity: Minor
    Found in br_nfe/models/invoice_eletronic.py - About 35 mins 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 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,
    Severity: Minor
    Found in br_zip/models/br_zip.py - About 35 mins 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_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:
    Severity: Minor
    Found in br_base/tools/fiscal.py - About 35 mins 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_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:
    Severity: Minor
    Found in br_account/models/account_invoice_line.py - About 35 mins 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_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):
    Severity: Minor
    Found in br_cnab/wizard/wizard_import_cnab.py - About 35 mins 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 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):
    Severity: Minor
    Found in br_account/models/account_invoice.py - About 35 mins 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_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):
    Severity: Minor
    Found in br_cnab/models/payment_order.py - About 35 mins 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_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
    Severity: Minor
    Found in br_base/tools/fiscal.py - About 35 mins 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 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'
    
    
    Severity: Minor
    Found in br_nfse/models/nfse_simpliss.py - About 35 mins 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_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)
    Severity: Minor
    Found in br_account/models/account_invoice.py - About 35 mins 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 _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':
    Severity: Minor
    Found in br_website_sale/controllers/main.py - About 35 mins 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_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
    Severity: Minor
    Found in br_base/tools/fiscal.py - About 35 mins 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 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']))
    Severity: Minor
    Found in br_nfe/wizard/export_nfe.py - About 35 mins 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 _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:
    Severity: Minor
    Found in br_point_sale/models/invoice_eletronic.py - About 35 mins 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_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)
    Severity: Minor
    Found in br_sale_stock/models/sale.py - About 35 mins 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

    Avoid too many return statements within this function.
    Open

                return sicredi
    Severity: Major
    Found in br_cnab/wizard/wizard_import_cnab.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return int(nosso_numero[10:])
      Severity: Major
      Found in br_cnab/wizard/wizard_import_cnab.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return Cnab240
        Severity: Major
        Found in br_cnab/febraban/cnab_240/cnab_240.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return -1
          Severity: Major
          Found in br_account/models/account_fiscal_position.py - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language