OCA/l10n-italy

View on GitHub

Showing 341 of 1,161 total issues

Function send_via_pec has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def send_via_pec(self):
        self._check_fetchmail()
        states = self.mapped('state')
        if set(states) != set(['ready']):
            raise UserError(
Severity: Minor
Found in l10n_it_fatturapa_pec/models/fatturapa_attachment_out.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_create_ddt_from_picking has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def test_create_ddt_from_picking(self):
        picking1 = self._create_picking()
        self._create_move(picking1, self.product1, quantity=2)
        picking2 = self._create_picking()
        self._create_move(picking2, self.product2, quantity=3)
Severity: Minor
Found in l10n_it_ddt/tests/test_ddt.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 10 (exceeds 5 allowed). Consider refactoring.
Open

    def action_move_create(self):
        res = super(AccountInvoice, self).action_move_create()
        for inv in self:
            if inv.tax_stamp and not inv.is_tax_stamp_line_present():
                if inv.move_id.state == 'posted':
Severity: Minor
Found in l10n_it_account_stamp/models/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 set_payments_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def set_payments_data(self, FatturaBody, invoice_id, partner_id):
        PaymentsData = FatturaBody.DatiPagamento
        if PaymentsData:
            PaymentDataModel = self.env['fatturapa.payment.data']
            PaymentTermsModel = self.env['fatturapa.payment_term']
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 _align_wt_move has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _align_wt_move(self, cr, uid, ids, context=None):
        """
        Align with wt move lines
        """
        wt_statement_obj = self.pool['withholding.tax.statement']
Severity: Minor
Found in l10n_it_withholding_tax/models/voucher.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 _amount_residual has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _amount_residual(self, cr, uid, ids, name, args, context=None):
        result = {}
        for statement in self.browse(cr, uid, ids, context=context):
            result[statement.id] = 0.0
            if statement.move_id:
Severity: Minor
Found in account_vat_period_end_statement/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 get_wt_competence has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_wt_competence(self, amount_reconcile):
        dp_obj = self.env['decimal.precision']
        amount_wt = 0
        for st in self:
            if st.invoice_id:
Severity: Minor
Found in l10n_it_withholding_tax/models/withholding_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 update_paid_riba_lines has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def update_paid_riba_lines(self):
        # set paid only if not unsolved
        if not self.env.context.get('unsolved_reconciliation'):
            riba_lines = self.get_riba_lines()
            for riba_line in riba_lines:
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 action_cancel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def action_cancel(self):
        for invoice in self:
            # we get move_lines with date_maturity and check if they are
            # present in some riba_distinta_line
            move_line_model = self.env['account.move.line']
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 test_01_xml_import has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_01_xml_import(self):
        res = self.run_wizard('test1', 'IT02780790107_11004.xml')
        invoice_id = res.get('domain')[0][2][0]
        invoice = self.invoice_model.browse(invoice_id)
        self.assertEqual(invoice.reference, '123')
Severity: Minor
Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py - About 1 hr to fix

    Function _BuildAutomaton_3 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function _BuildAutomaton_ has 27 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_4 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function test_00_xml_import has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def test_00_xml_import(self):
                  self.env.user.company_id.cassa_previdenziale_product_id = (
                      self.service.id)
                  res = self.run_wizard('test0', 'IT05979361218_001.xml')
                  invoice_id = res.get('domain')[0][2][0]
          Severity: Minor
          Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py - About 1 hr to fix

            Function _BuildAutomaton_6 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Consider simplifying this complex logical expression.
              Open

                      if taxes:
                          tax = taxes[0]
                          # search for the related base code
                          base_code = (
                              tax.base_code_id or tax.parent_id and
              Severity: Major
              Found in l10n_it_account/models/account_tax.py - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                            if Delivery.IndirizzoResa:
                                delivery_dict['delivery_address'] = (
                                    '{0}, {1}\n{2} - {3}\n{4} {5}'.format(
                                        Delivery.IndirizzoResa.Indirizzo or '',
                                        Delivery.IndirizzoResa.NumeroCivico or '',
                Severity: Major
                Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 1 hr to fix

                  Function voucher_move_line_create has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def voucher_move_line_create(
                  Severity: Major
                  Found in l10n_it_withholding_tax/models/voucher.py - About 1 hr to fix

                    Function onchange_reconcile has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def onchange_reconcile(self, cr, uid, ids, reconcile, amount,
                    Severity: Major
                    Found in l10n_it_withholding_tax/models/voucher.py - About 1 hr to fix

                      Function compute_all has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def compute_all(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, force_excluded=False):
                      Severity: Major
                      Found in l10n_it_partially_deductible_vat/account.py - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language