Trust-Code/odoo-brasil

View on GitHub

Showing 165 of 421 total issues

Function _hook_validation has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def _hook_validation(self):
        errors = super(InvoiceEletronic, self)._hook_validation()
        if self.model == '002':
            issqn_codigo = ''
            if not self.company_id.inscr_mun:
Severity: Minor
Found in br_nfse/models/nfse_ginfes.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function action_send_eletronic_invoice has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def action_send_eletronic_invoice(self):
        super(InvoiceEletronic, self).action_send_eletronic_invoice()
        if self.model == '002' and self.state not in ('done', 'cancel'):
            self.state = 'error'

Severity: Minor
Found in br_nfse/models/nfse_ginfes.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File nfse_ginfes.py has 314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

    File wizard_import_cnab.py has 310 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # © 2017 Danimar Ribeiro, Trustcode
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    import base64
    Severity: Minor
    Found in br_cnab/wizard/wizard_import_cnab.py - About 3 hrs to fix

      File pos_order.py has 307 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      # © 2016 Alessandro Fernandes Martini <alessandrofmartini@gmail.com>, Trustcode
      # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
      
      from datetime import datetime
      Severity: Minor
      Found in br_point_sale/models/pos_order.py - About 3 hrs to fix

        Function _hook_validation has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _hook_validation(self):
                errors = super(InvoiceEletronic, self)._hook_validation()
                if self.model == '009':
                    issqn_codigo = ''
                    if not self.company_id.inscr_mun:
        Severity: Minor
        Found in br_nfse/models/nfse_susesu.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _hook_validation has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _hook_validation(self):
                errors = super(InvoiceEletronic, self)._hook_validation()
                if self.model == '008':
                    issqn_codigo = ''
                    if not self.company_id.inscr_mun:
        Severity: Minor
        Found in br_nfse/models/nfse_simpliss.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _hook_validation has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _hook_validation(self):
                errors = super(InvoiceEletronic, self)._hook_validation()
                if self.model == '010':
                    issqn_codigo = ''
                    if not self.company_id.inscr_mun:
        Severity: Minor
        Found in br_nfse/models/nfse_imperial.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _display_address has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def _display_address(self, without_company=False):
                address = self
        
                if address.country_id and address.country_id.code != 'BR':
                    # this ensure other localizations could do what they want
        Severity: Minor
        Found in br_base/models/res_partner.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function checkout_form_validate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def checkout_form_validate(self, mode, all_form_values, data):
                errors, error_msg = super(L10nBrWebsiteSale, self).\
                    checkout_form_validate(mode, all_form_values, data)
                cnpj_cpf = data.get('cnpj_cpf', '0')
                email = data.get('email', False)
        Severity: Minor
        Found in br_website_sale/controllers/main.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function action_send_eletronic_invoice has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def action_send_eletronic_invoice(self):
                super(InvoiceEletronic, self).action_send_eletronic_invoice()
        
                if self.model not in ('55', '65') or self.state in (
                   'done', 'denied', 'cancel'):
        Severity: Minor
        Found in br_nfe/models/invoice_eletronic.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        File br_account.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        # © 2009 Renato Lima - Akretion
        # © 2014  KMEE - www.kmee.com.br
        # © 2016 Danimar Ribeiro, Trustcode
        # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
        Severity: Minor
        Found in br_account/models/br_account.py - About 2 hrs to fix

          Function _prepare_invoice_line_from_po_line has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _prepare_invoice_line_from_po_line(self, line):
                  res = super(AccountInvoice, self)._prepare_invoice_line_from_po_line(
                      line)
          
                  res['valor_bruto'] = line.valor_bruto
          Severity: Major
          Found in br_purchase/models/account_invoice.py - About 2 hrs to fix

            File invoice_eletronic.py has 284 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            # © 2016 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode
            # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
            
            import re
            Severity: Minor
            Found in br_nfse/models/invoice_eletronic.py - About 2 hrs to fix

              Function _calculate_points has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _calculate_points(self, rule, product, state, partner):
                      """Calcula a pontuação das regras. A pontuação aumenta de acordo
                      com os 'matches'. Não havendo match(exceto quando o campo não está
                      definido) retorna o valor -1, que posteriormente será tratado como
                      uma regra a ser descartada.
              Severity: Minor
              Found in br_account/models/account_fiscal_position.py - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                  def _prepare_eletronic_invoice_values(self):
                      res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
                      if self.model == '010':
                          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_imperial.py - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              File sale.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              # © 2009  Renato Lima - Akretion
              # © 2012  Raphaël Valyi - Akretion
              # © 2016 Danimar Ribeiro, Trustcode
              # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
              Severity: Minor
              Found in br_sale/models/sale.py - About 2 hrs to fix

                AccountInvoiceLine has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class AccountInvoiceLine(models.Model):
                    _inherit = 'account.invoice.line'
                
                    @api.model
                    def _default_company_fiscal_type(self):
                Severity: Minor
                Found in br_account/models/account_invoice_line.py - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if self.model == '009':
                              tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
                              dt_emissao = datetime.strptime(self.data_emissao, DTFT)
                              dt_emissao = pytz.utc.localize(dt_emissao).astimezone(tz)
                              dt_emissao = dt_emissao.strftime('%d/%m/%Y')
                  Severity: Critical
                  Found in br_nfse/models/nfse_susesu.py - About 2 hrs to fix

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

                        def _compute_amount_line_all(self):
                            super(PosOrderLine, self)._compute_amount_line_all()
                            for line in self:
                                currency = line.order_id.pricelist_id.currency_id
                                values = line.order_id.fiscal_position_id.map_tax_extra_values(
                    Severity: Minor
                    Found in br_point_sale/models/pos_order.py - About 2 hrs to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language