Trust-Code/odoo-brasil

View on GitHub

Showing 165 of 421 total issues

Function _compute_amount has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _compute_amount(self):
        super(AccountInvoice, self)._compute_amount()
        lines = self.invoice_line_ids
        self.total_tax = sum(l.price_tax for l in lines)
        self.icms_base = sum(l.icms_base_calculo for l in lines)
Severity: Minor
Found in br_account/models/account_invoice.py - About 1 hr to fix

    Function action_cancel_document has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def action_cancel_document(self, context=None, justificativa=None):
            if self.model not in ('55', '65'):
                return super(InvoiceEletronic, self).action_cancel_document(
                    justificativa=justificativa)
    
    
    Severity: Minor
    Found in br_nfe/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 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _prepare_eletronic_invoice_values(self):
            res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
            if self.model not in ('55', '65'):
                return res
    
    
    Severity: Minor
    Found in br_nfe/models/invoice_eletronic.py - About 1 hr to fix

      Function validate_ie_pe has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

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

          def _compute_difal(self, price_base, ipi_value):
              icms_inter = self.filtered(lambda x: x.domain == 'icms_inter')
              icms_intra = self.filtered(lambda x: x.domain == 'icms_intra')
              icms_fcp = self.filtered(lambda x: x.domain == 'fcp')
              if not icms_inter or not icms_intra:
      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 _compute_tax_id has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_tax_id(self):
              res = super(SaleOrderLine, self)._compute_tax_id()
              for line in self:
                  line._update_tax_from_ncm()
                  fpos = line.order_id.fiscal_position_id or \
      Severity: Minor
      Found in br_sale/models/sale.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 validate_ie_sp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def validate_ie_sp(inscr_est):
          def gera_digito_sp(nova_ie, prod):
              r = sum([x * y for (x, y) in zip(nova_ie, prod)]) % 11
              if r < 10:
                  return r
      Severity: Minor
      Found in br_base/tools/fiscal.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_update_boletos has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_update_boletos(self):
              for item in self:
                  if item.state != 'open':
                      item.update_boleto = False
                  else:
      Severity: Minor
      Found in br_boleto/models/account_invoice.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 _change_boleto_state has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _change_boleto_state(self, evento):
              nosso_numero = self._get_nosso_numero(evento.nosso_numero)
      
              payment_order_lines = self._get_order_line(
                  nosso_numero, 'payment.order.line')
      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 validate_hook has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_hook(self):
              errors = []
              docs = self.env['invoice.eletronic'].search([
                  ('numero', '>=', self.numeration_start),
                  ('numero', '<=', self.numeration_end)
      Severity: Minor
      Found in br_nfe/models/inutilized_nfe.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 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def create(self, cr, uid, ids, datas, context=False):
      
              env = odoo.api.Environment(cr, uid, context or {})
      
              nfes = env['invoice.eletronic'].search([('id', 'in', context.get(
      Severity: Minor
      Found in br_nfe/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 action_send_eletronic_invoice has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def action_send_eletronic_invoice(self):
              super(InvoiceEletronic, self).action_send_eletronic_invoice()
              if self.model == '001' and self.state not in ('done', 'cancel'):
                  self.state = 'error'
      
      
      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 _compute_tax_id has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_tax_id(self):
              for line in self:
                  line._update_tax_from_ncm()
                  fpos = line.order_id.fiscal_position_id or \
                      line.order_id.partner_id.property_account_position_id
      Severity: Minor
      Found in br_purchase/models/purchase.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_payment_entry has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _create_payment_entry(self, amount):
              self = self.with_context(move_line_to_reconcile=self.move_line_id)
              if self.invoice_ids:
                  return super(AccountPayment, self)._create_payment_entry(amount)
      
      
      Severity: Minor
      Found in br_account_payment/models/account_payment.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 _check_ie has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_ie(self):
              check_ie = True
              if self.inscr_est:
                  uf = self.state_id and self.state_id.code.lower() or ''
                  try:
      Severity: Minor
      Found in br_account/models/br_account.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 action_register_boleto has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def action_register_boleto(self):
              boleto_list = []
              for move in self:
                  if not move.payment_mode_id:
                      raise UserError(u'A fatura ' + move.move_id.name + u' - ' +
      Severity: Minor
      Found in br_boleto/models/account_move_line.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 _parse_ofx has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _parse_ofx(self, data_file):
              data_file = data_file.replace('\r\n', '\n').replace('\r', '\n')
              ofx = OfxParser.parse(StringIO.StringIO(data_file))
              transacoes = []
              total = 0.0
      Severity: Minor
      Found in br_bank_statement_import/models/account_bank_statement_import.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_edoc_vals has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _prepare_edoc_vals(self, inv):
              res = super(AccountInvoice, self)._prepare_edoc_vals(inv)
      
              res['payment_mode_id'] = inv.payment_mode_id.id
              res['ind_pres'] = inv.fiscal_position_id.ind_pres
      Severity: Minor
      Found in br_nfe/models/account_invoice.py - About 1 hr to fix

        Function create_wizard has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create_wizard(self, object_name, address_id, country_id=False,
        Severity: Major
        Found in br_zip/models/br_zip.py - About 1 hr to fix

          Function _compute_difal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _compute_difal(self, price_base, ipi_value):
                  icms_inter = self.filtered(lambda x: x.domain == 'icms_inter')
                  icms_intra = self.filtered(lambda x: x.domain == 'icms_intra')
                  icms_fcp = self.filtered(lambda x: x.domain == 'fcp')
                  if not icms_inter or not icms_intra:
          Severity: Minor
          Found in br_account/models/account_tax.py - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language