OCA/l10n-italy

View on GitHub

Showing 341 of 1,161 total issues

Function action_move_create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def action_move_create(self):
        """Append global rounding move lines"""
        res = super(AccountInvoice, self).action_move_create()
        for invoice in self:
            if invoice.efatt_rounding != 0:
Severity: Minor
Found in l10n_it_fatturapa_in/models/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_move_create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def action_move_create(self):
        for invoice in self:
            # ---- Add a line with payment cost for each due only for fist due
            # ---- of the month
            if invoice.type != 'out_invoice' or not invoice.payment_term \
Severity: Minor
Found in l10n_it_ricevute_bancarie/models/account/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 _prepare_cedente_partner_id has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_cedente_partner_id(self, partner, vals=None):
        vals = {}
        # ----- Get vat
        partner_vat = partner.commercial_partner_id.vat or ''
        if partner.country_id:
Severity: Minor
Found in l10n_it_invoices_data_communication/models/communication.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 lines has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def lines(self, main_account):
        """ Return all the account_move_line of account with their account code counterparts """
        account_ids = self.get_children_accounts(main_account)
        
        move_state = ['draft','posted']
Severity: Minor
Found in l10n_it_prima_nota_cassa/report/prima_nota_cassa.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 _setDatiAnagraficiCessionario has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _setDatiAnagraficiCessionario(self, partner, fatturapa):
        fatturapa.FatturaElettronicaHeader.CessionarioCommittente.\
            DatiAnagrafici = DatiAnagraficiCessionarioType()
        if not partner.vat and not partner.fiscalcode:
            if (
Severity: Minor
Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.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 setDatiGeneraliDocumento has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def setDatiGeneraliDocumento(self, invoice, body):

        # TODO DatiSAL

        body.DatiGenerali = DatiGeneraliType()
Severity: Minor
Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.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 adjust_accounting_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def adjust_accounting_data(self, product, line_vals):
        if product.product_tmpl_id.property_account_expense:
            line_vals['account_id'] = (
                product.product_tmpl_id.property_account_expense.id)
        elif (
Severity: Minor
Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.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 get_wt_taxes_values has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def get_wt_taxes_values(self):
        tax_grouped = {}
        for invoice in self:
            for line in invoice.invoice_line:
                taxes = []
Severity: Minor
Found in l10n_it_withholding_tax/models/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 test_invoice has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_invoice(self):
        invoice = self.invoice_model.create({
            'date_invoice': self.recent_date,
            'partner_id': self.env.ref('base.res_partner_3').id,
            'journal_id': self.sales_journal.id,
Severity: Minor
Found in l10n_it_split_payment/tests/test_splitpayment.py - About 1 hr to fix

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

    def _BuildAutomaton ():
        # Remove this helper function from the namespace after it is invoked
        global _BuildAutomaton
        del _BuildAutomaton
        import pyxb.utils.fac as fac
    Severity: Minor
    Found in l10n_it_fatturapa/bindings/_ds.py - About 1 hr to fix

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

      def _BuildAutomaton_25 ():
          # Remove this helper function from the namespace after it is invoked
          global _BuildAutomaton_25
          del _BuildAutomaton_25
          import pyxb.utils.fac as fac
      Severity: Minor
      Found in l10n_it_fatturapa/bindings/binding.py - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if Summary_datas:
                    for summary in Summary_datas:
                        summary_line = {
                            'tax_rate': summary.AliquotaIVA or 0.0,
                            'non_taxable_nature': summary.Natura or False,
        Severity: Critical
        Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if company.fatturapa_rea_office and company.fatturapa_rea_number:
                      CedentePrestatore.IscrizioneREA = IscrizioneREAType(
                          Ufficio=(
                              company.fatturapa_rea_office and
                              company.fatturapa_rea_office.code or None),
          Severity: Critical
          Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 1 hr to fix

            Function invoiceCreate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def invoiceCreate(
                    self, fatt, fatturapa_attachment, FatturaBody, partner_id
                ):
                    partner_model = self.env['res.partner']
                    invoice_model = self.env['account.invoice']
            Severity: Minor
            Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 1 hr to fix

              Function _BuildAutomaton_20 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def _BuildAutomaton_20 ():
                  # Remove this helper function from the namespace after it is invoked
                  global _BuildAutomaton_20
                  del _BuildAutomaton_20
                  import pyxb.utils.fac as fac
              Severity: Minor
              Found in l10n_it_fatturapa/bindings/binding.py - About 1 hr to fix

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

                    def _prepare_cessionario_partner_id(self, partner, vals=None):
                        vals = {}
                        # ----- Get vat
                        partner_vat = partner.commercial_partner_id.vat or ''
                        if partner.country_id:
                Severity: Minor
                Found in l10n_it_invoices_data_communication/models/communication.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 prepareRelDocsLine has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def prepareRelDocsLine(self, invoice, line):
                        res = False
                        sale_order_name = False
                        if line.origin:
                            # if invoiced from picking, get sale_order from picking
                Severity: Minor
                Found in l10n_it_fatturapa_out_sale/wizard/wizard_export_fatturapa.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 setDettaglioLinea has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def setDettaglioLinea(
                            self, line_no, line, body, price_precision, uom_precision):
                        if not line.invoice_line_tax_id:
                            raise UserError(
                                _("Invoice line %s does not have tax.") % line.name)
                Severity: Minor
                Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.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 _BuildAutomaton_22 has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def _BuildAutomaton_22 ():
                    # Remove this helper function from the namespace after it is invoked
                    global _BuildAutomaton_22
                    del _BuildAutomaton_22
                    import pyxb.utils.fac as fac
                Severity: Minor
                Found in l10n_it_fatturapa/bindings/binding.py - About 1 hr to fix

                  Function test_20_partial_payment has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def test_20_partial_payment(self):
                          self.assertEqual(self.invoice.amount_net_pay, 1164)
                          # pay partially
                          res = self.invoice.invoice_pay_customer()
                          vals = {
                  Severity: Minor
                  Found in l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language