OCA/l10n-italy

View on GitHub
l10n_it_withholding_tax/models/voucher.py

Summary

Maintainability
F
5 days
Test Coverage

Function recompute_voucher_lines has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

    def recompute_voucher_lines(self, cr, uid, ids, partner_id, journal_id,
                                price, currency_id, ttype, date, context=None):
        """
        Compute original amount of WT of rate
        """
Severity: Minor
Found in l10n_it_withholding_tax/models/voucher.py - About 1 day 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 voucher_move_line_create has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

    def voucher_move_line_create(
            self, cr, uid, voucher_id, line_total, move_id, company_currency,
            current_currency, context=None):
        """
        Add WT line to registration and change amount on debit/credit line of
Severity: Minor
Found in l10n_it_withholding_tax/models/voucher.py - About 1 day 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 voucher.py has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Copyright © 2015 Alessandro Camilli (<http://www.openforce.it>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp.osv import orm, fields
Severity: Minor
Found in l10n_it_withholding_tax/models/voucher.py - About 7 hrs to fix

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

        def recompute_withholding_tax_voucher_line(
                self, cr, uid, voucher_line_id, context=None):
            """
            Split amount voucher line second WT lines invoice
            """
    Severity: Minor
    Found in l10n_it_withholding_tax/models/voucher.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 _compute_balance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_balance(self, cr, uid, ids, name, args, context=None):
            """
            Extends the compute of original amounts for exclude from total the WT
            amount
            """
    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 recompute_voucher_lines has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      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 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 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_amount has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def onchange_amount(self, cr, uid, ids, amount, amount_unreconciled,
          Severity: Major
          Found in l10n_it_withholding_tax/models/voucher.py - About 50 mins to fix

            Function _amount_withholding_tax has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _amount_withholding_tax(self, cr, uid, ids, name, args, context=None):
            Severity: Minor
            Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (
                                              (line['amount'] + amount_overflow_residual) <=
                                              (
                                                  line['amount_unreconciled'] -
                                                  line['amount_residual_withholding_tax']
              Severity: Major
              Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for wt_invoice_line in inv.withholding_tax_line.\
                                                filtered(lambda x: x == wt_tax):
                                            i += 1
                                            if i == rate_num:
                                                wt_amount = wt_residual
                Severity: Major
                Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

                  Function compute_amount_withholdin_tax has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def compute_amount_withholdin_tax(
                  Severity: Minor
                  Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if debit:
                                                p_debit = payment_line[1]
                                            else:
                                                p_credit = payment_line[1]
                                            val_move_line = {
                    Severity: Major
                    Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

                      Function _compute_balance has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def _compute_balance(self, cr, uid, ids, name, args, context=None):
                      Severity: Minor
                      Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

                        Function write has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def write(self, cr, uid, ids, vals, context=None):
                        Severity: Minor
                        Found in l10n_it_withholding_tax/models/voucher.py - About 35 mins to fix

                          Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def create(self, cr, uid, vals, *args, **kwargs):
                          Severity: Minor
                          Found in l10n_it_withholding_tax/models/voucher.py - About 35 mins to fix

                            Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def create(self, cr, uid, vals, *args, **kwargs):
                            Severity: Minor
                            Found in l10n_it_withholding_tax/models/voucher.py - About 35 mins to fix

                              Function write has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def write(self, cr, uid, ids, vals, context=None):
                              Severity: Minor
                              Found in l10n_it_withholding_tax/models/voucher.py - About 35 mins to fix

                                Function action_move_line_create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def action_move_line_create(self, cr, uid, ids, context=None):
                                        """
                                        Assign payment move to wt lines
                                        """
                                        res = super(AccountVoucher, self).action_move_line_create(
                                Severity: Minor
                                Found in l10n_it_withholding_tax/models/voucher.py - About 25 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

                                There are no issues that match your filters.

                                Category
                                Status