Trust-Code/odoo-brasil

View on GitHub

Showing 421 of 421 total issues

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            'PIS': {
                'CST': item.pis_cst,
                'vBC': "%.02f" % item.pis_base_calculo,
                'pPIS': "%.02f" % item.pis_aliquota,
                'vPIS': "%.02f" % item.pis_valor
Severity: Minor
Found in br_nfe/models/invoice_eletronic.py and 1 other location - About 55 mins to fix
br_nfe/models/invoice_eletronic.py on lines 353..357

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            'COFINS': {
                'CST': item.cofins_cst,
                'vBC': "%.02f" % item.cofins_base_calculo,
                'pCOFINS': "%.02f" % item.cofins_aliquota,
                'vCOFINS': "%.02f" % item.cofins_valor
Severity: Minor
Found in br_nfe/models/invoice_eletronic.py and 1 other location - About 55 mins to fix
br_nfe/models/invoice_eletronic.py on lines 347..351

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            last_inv = self.env['invoice.eletronic'].search([
                ('serie', '=', self.serie.id)],
Severity: Minor
Found in br_nfe/models/inutilized_nfe.py and 1 other location - About 50 mins to fix
br_cnab/wizard/wizard_import_cnab.py on lines 158..159

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            last_bank_stmt = self.env['account.bank.statement'].search(
                [('journal_id', '=', self.journal_id.id)],
Severity: Minor
Found in br_cnab/wizard/wizard_import_cnab.py and 1 other location - About 50 mins to fix
br_nfe/models/inutilized_nfe.py on lines 168..169

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    def _check_cnpj_cpf(self):
        check_cnpj_cpf = True
        if self.cnpj_cpf:
            if self.cpfcnpj_type == 'cnpj':
                if not fiscal.validate_cnpj(self.cnpj_cpf):
Severity: Minor
Found in br_account/models/br_account.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 modulo11 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def modulo11(self, num, base=9, r=0):
        if not isinstance(num, basestring):
            raise TypeError
        soma = 0
        fator = 2
Severity: Minor
Found in br_cnab/febraban/cnab_240/bancos/bradesco.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 compute_all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_all(self, price_unit, currency=None, quantity=1.0,
                    product=None, partner=None):

        exists_br_tax = len(self.filtered(lambda x: x.domain)) > 0
        if not exists_br_tax:
Severity: Minor
Found in br_account/models/account_tax.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_worked_day_lines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def get_worked_day_lines(self, contract_ids, date_from, date_to):
        res = super(HrPayslip, self).get_worked_day_lines(
            contract_ids, date_from, date_to)
        for contract in contract_ids:
            leaves = self.env['hr.holidays'].search(
Severity: Minor
Found in br_hr_payroll/model/hr_payslip.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 set_domain has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    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 seach_by_address has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

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

          def modulo11(num, base=9, r=0):
              if not isinstance(num, basestring):
                  raise TypeError
              soma = 0
              fator = 2
      Severity: Minor
      Found in br_cnab/febraban/cnab_240/bancos/santander.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 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

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

            def _compute_ipi(self, price_base):
                ipi_tax = self.filtered(lambda x: x.domain == 'ipi')
                if not ipi_tax:
                    return []
                vals = self._tax_vals(ipi_tax)
        Severity: Minor
        Found in br_account/models/account_tax.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 _process_order has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _process_order(self, pos_order):
                num_controle = int(''.join([str(SystemRandom().randrange(9))
                                            for i in range(8)]))
                res = super(PosOrder, self)._process_order(pos_order)
                res.numero_controle = str(num_controle)
        Severity: Minor
        Found in br_point_sale/models/pos_order.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 _check_cnpj_cpf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_cnpj_cpf(self):
                country_code = self.country_id.code or ''
                if self.cnpj_cpf and country_code.upper() == 'BR':
                    if self.is_company:
                        if not fiscal.validate_cnpj(self.cnpj_cpf):
        Severity: Minor
        Found in br_base/models/res_partner.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