OCA/l10n-canada

View on GitHub
l10n_ca_account_check_writing/report/l10n_ca_check_print.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function get_lines has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def get_lines(self, voucher_lines):
        result = []
        self.number_lines = len(voucher_lines)
        for i in range(0, min(10, self.number_lines)):
            if i < self.number_lines:
Severity: Minor
Found in l10n_ca_account_check_writing/report/l10n_ca_check_print.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

Consider simplifying this complex logical expression.
Open

                if voucher_line.amount != 0:
                    # In general, the supplier invoice reference number is a
                    # much better description for writing checks than our own
                    # reference number, but if we don't have it, we might as
                    # well use our internal number
Severity: Critical
Found in l10n_ca_account_check_writing/report/l10n_ca_check_print.py - About 1 hr to fix

There are no issues that match your filters.

Category
Status