OCA/l10n-italy

View on GitHub
l10n_it_withholding_tax/models/account.py

Summary

Maintainability
D
1 day
Test Coverage

Function _prepare_wt_values has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_wt_values(self):

        partner = False
        wt_competence = {}
        # First : Partner and WT competence
Severity: Minor
Found in l10n_it_withholding_tax/models/account.py - About 4 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 account.py has 337 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).


Severity: Minor
Found in l10n_it_withholding_tax/models/account.py - About 4 hrs to fix

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

        def action_move_create(self):
            '''
            Split amount withholding tax on account move lines
            '''
            dp_obj = self.env['decimal.precision']
    Severity: Minor
    Found in l10n_it_withholding_tax/models/account.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 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 product_id_change has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def product_id_change(self, product, uom_id, qty=0, name='',
    Severity: Major
    Found in l10n_it_withholding_tax/models/account.py - About 1 hr to fix

      Function _amount_withholding_tax has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _amount_withholding_tax(self):
              dp_obj = self.env['decimal.precision']
              for invoice in self:
                  withholding_tax_amount = 0.0
                  for wt_line in invoice.withholding_tax_line:
      Severity: Minor
      Found in l10n_it_withholding_tax/models/account.py - About 55 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

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

          def compute_amount_withholding_excluded(self):
              total_withholding_tax_excluded = 0.0
              for invoice in self:
                  for line in invoice.invoice_line:
                      if line.withholding_tax_exclude:
      Severity: Minor
      Found in l10n_it_withholding_tax/models/account.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