Trust-Code/odoo-brasil

View on GitHub

Showing 165 of 421 total issues

Function _prepare_eletronic_invoice_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_eletronic_invoice_values(self):
        res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
        if self.model == '008':
            tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
            dt_emissao = datetime.strptime(self.data_emissao, DTFT)
Severity: Minor
Found in br_nfse/models/nfse_simpliss.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 _create_statement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_statement(self, stmt_values, account_number):
        BankStatement = self.env['account.bank.statement']
        BankStatementLine = self.env['account.bank.statement.line']
        filtered_values = []
        for transaction in stmt_values['transactions']:
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_icms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _compute_icms(self, price_base, ipi_value):
        icms_tax = self.filtered(lambda x: x.domain == 'icms')
        if not icms_tax:
            return []
        vals = self._tax_vals(icms_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 _prepare_eletronic_invoice_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_eletronic_invoice_values(self):
        res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
        if self.model == '001':
            tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
            dt_emissao = datetime.strptime(self.data_emissao, DTFT)
Severity: Minor
Found in br_nfse/models/invoice_eletronic.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 _prepare_eletronic_invoice_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_eletronic_invoice_values(self):
        res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
        if self.model == '002':
            tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
            dt_emissao = datetime.strptime(self.data_emissao, DTFT)
Severity: Minor
Found in br_nfse/models/nfse_ginfes.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 create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def create(self, cr, uid, ids, datas, context=False):
        env = odoo.api.Environment(cr, uid, context or {})
        active_ids = context.get('active_ids')
        active_model = context.get('active_model')

Severity: Minor
Found in br_boleto/reports/report.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_price has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _compute_price(self):
        currency = self.invoice_id and self.invoice_id.currency_id or None
        price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)

        valor_bruto = self.price_unit * self.quantity
Severity: Minor
Found in br_account/models/account_invoice_line.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if self.commercial_partner_id:
                partner = self.commercial_partner_id
                dest = {
                    'tipo': partner.company_type,
                    'cnpj_cpf': re.sub('[^0-9]', '', partner.cnpj_cpf or ''),
    Severity: Major
    Found in br_nfe/models/invoice_eletronic.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if responsavel_tecnico:
                  if len(responsavel_tecnico.child_ids) == 0:
                      raise UserError(
                          "Adicione um contato para o responsável técnico!")
      
      
      Severity: Major
      Found in br_nfe/models/invoice_eletronic.py - About 1 hr to fix

        Function get_bank has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_bank(bank):
                if bank == '237':
                    from .bancos.bradesco import Bradesco240
                    return Bradesco240
                elif bank == '756':
        Severity: Minor
        Found in br_cnab/febraban/cnab_240/cnab_240.py - About 55 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 _check_cnab has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_cnab(self, cnab_file):
                if int(base64.b64decode(cnab_file)[0:3]) != int(
                        self.journal_id.bank_id.bic):
                    raise UserError(u"O banco do arquivo não corresponde ao\
                        banco do Diário Contábil!")
        Severity: Minor
        Found in br_cnab/wizard/wizard_import_cnab.py - About 55 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_result has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_result(self, zip_obj=None):
                if zip_obj:
                    zip_code = zip_obj.zip
                    if len(zip_code) == 8:
                        zip_code = '%s-%s' % (zip_code[0:5], zip_code[5:8])
        Severity: Minor
        Found in br_zip/models/br_zip.py - About 55 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 modulo10 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def modulo10(num):
                if not isinstance(num, basestring):
                    raise TypeError
                soma = 0
                peso = 2
        Severity: Minor
        Found in br_cnab/febraban/cnab_240/bancos/itau.py - About 55 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_cancel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def action_cancel(self):
                res = super(AccountInvoice, self).action_cancel()
                for item in self:
                    edocs = self.env['invoice.eletronic'].search(
                        [('invoice_id', '=', item.id)])
        Severity: Minor
        Found in br_account_einvoice/models/account_invoice.py - About 55 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 _onchange_despesas_frete_seguro has a Cognitive Complexity of 9 (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 - line.valor_desconto
        Severity: Minor
        Found in br_sale_stock/models/sale.py - About 55 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_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def validate_ie_to(inscr_est):
            inscr_est = re.sub('[^0-9]', '', inscr_est)
        
            # verificando o tamanho da inscrição estadual
            if len(inscr_est) == 11:
        Severity: Minor
        Found in br_base/tools/fiscal.py - About 45 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 get_bank has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_bank(self):
                bank = self.journal_id.bank_id.bic
        
                if bank == '237':
                    from cnab240.bancos import bradesco
        Severity: Minor
        Found in br_cnab/wizard/wizard_import_cnab.py - About 45 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 get_taxes_values has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_taxes_values(self):
                tax_grouped = {}
                for line in self.invoice_line_ids:
                    other_taxes = line.invoice_line_tax_ids.filtered(
                        lambda x: not x.domain)
        Severity: Minor
        Found in br_account/models/account_invoice.py - About 45 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 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def zip_search_multi(self, country_id=False,
        Severity: Minor
        Found in br_zip/models/br_zip.py - About 45 mins to fix

          Function validate_ie_ap has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def validate_ie_ap(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 45 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

          Severity
          Category
          Status
          Source
          Language