Trust-Code/odoo-brasil

View on GitHub

Showing 421 of 421 total issues

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

        num_controle = int(''.join([str(SystemRandom().randrange(9))
                                    for i in range(8)]))
Severity: Major
Found in br_account_einvoice/models/account_invoice.py and 1 other location - About 1 hr to fix
br_point_sale/models/pos_order.py on lines 33..34

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 39.

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 _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 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

      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

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

            @api.onchange('tax_ipi_id')
            def _onchange_tax_ipi_id(self):
                if self.tax_ipi_id:
                    self.ipi_aliquota = self.tax_ipi_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_icms_st_id')
            def _onchange_tax_icms_st_id(self):
                if self.tax_icms_st_id:
                    self.icms_st_aliquota = self.tax_icms_st_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_pis_id')
            def _onchange_tax_pis_id(self):
                if self.tax_pis_id:
                    self.pis_aliquota = self.tax_pis_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_inss_id')
            def _onchange_tax_inss_id(self):
                if self.tax_inss_id:
                    self.inss_aliquota = self.tax_inss_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_csll_id')
            def _onchange_tax_csll_id(self):
                if self.tax_csll_id:
                    self.csll_aliquota = self.tax_csll_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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

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

                    vals['views'] = [vals['views'][1], vals['views'][0]]
        Severity: Major
        Found in br_account_einvoice/models/account_invoice.py and 1 other location - About 1 hr to fix
        br_point_sale/models/pos_order.py on lines 199..199

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_ii_id')
            def _onchange_tax_ii_id(self):
                if self.tax_ii_id:
                    self.ii_aliquota = self.tax_ii_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_cofins_id')
            def _onchange_tax_cofins_id(self):
                if self.tax_cofins_id:
                    self.cofins_aliquota = self.tax_cofins_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_issqn_id')
            def _onchange_tax_issqn_id(self):
                if self.tax_issqn_id:
                    self.issqn_aliquota = self.tax_issqn_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_icms_id')
            def _onchange_tax_icms_id(self):
                if self.tax_icms_id:
                    self.icms_aliquota = self.tax_icms_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 640..644
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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 10 locations. Consider refactoring.
        Open

            @api.onchange('tax_irrf_id')
            def _onchange_tax_irrf_id(self):
                if self.tax_irrf_id:
                    self.irrf_aliquota = self.tax_irrf_id.amount
                self._update_invoice_line_ids()
        Severity: Major
        Found in br_account/models/account_invoice_line.py and 9 other locations - About 1 hr to fix
        br_account/models/account_invoice_line.py on lines 576..580
        br_account/models/account_invoice_line.py on lines 582..586
        br_account/models/account_invoice_line.py on lines 604..608
        br_account/models/account_invoice_line.py on lines 610..614
        br_account/models/account_invoice_line.py on lines 616..620
        br_account/models/account_invoice_line.py on lines 622..626
        br_account/models/account_invoice_line.py on lines 628..632
        br_account/models/account_invoice_line.py on lines 634..638
        br_account/models/account_invoice_line.py on lines 646..650

        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 38.

        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

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

                    vals['views'] = [vals['views'][1], vals['views'][0]]
        Severity: Major
        Found in br_point_sale/models/pos_order.py and 1 other location - About 1 hr to fix
        br_account_einvoice/models/account_invoice.py on lines 63..63

        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 38.

        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 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

        Severity
        Category
        Status
        Source
        Language