OCA/l10n-luxemburg

View on GitHub

Showing 13 of 27 total issues

File ecdf_report.py has 643 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
This module provides a wizard able to generate XML annual financial reports
Generated files are ready for eCDF
Reports :
Severity: Major
Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 1 day to fix

    Function print_xml has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def print_xml(self):
            '''
            Generates the selected financial reports in XML format
            The string is written in the base64 field "xml_file"
            '''
    Severity: Minor
    Found in l10n_lu_ecdf/wizard/ecdf_report.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

    Function _append_fr_lines has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def _append_fr_lines(self, data_curr, form_data, data_prev=None):
            '''
            Appends lines "NumericField" in the "form_data" node
            :param data_curr: data of the previous year
            :param form_data: XML node "form_data"
    Severity: Minor
    Found in l10n_lu_ecdf/wizard/ecdf_report.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

    Function _get_chart_ac has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_chart_ac(self, data, report_type, report_model):
            '''
            Generates the chart of accounts in XML format
            :param data: Dictionary of values (name, technical name, value)
            :param report_type: Technical name of the report type
    Severity: Minor
    Found in l10n_lu_ecdf/wizard/ecdf_report.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

    EcdfReport has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class EcdfReport(models.TransientModel):
        '''
        This wizard allows to generate three types of financial reports :
            - Profit & Loss (P&L)
            - Balance Sheet (BS)
    Severity: Minor
    Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 2 hrs to fix

      Function print_xml has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def print_xml(self):
              '''
              Generates the selected financial reports in XML format
              The string is written in the base64 field "xml_file"
              '''
      Severity: Major
      Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 2 hrs to fix

        Function _get_chart_ac has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def _get_chart_ac(self, data, report_type, report_model):
                '''
                Generates the chart of accounts in XML format
                :param data: Dictionary of values (name, technical name, value)
                :param report_type: Technical name of the report type
        Severity: Minor
        Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 1 hr to fix

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

              def _get_finan_report(self, data_current, report_type, report_model,
                                    data_previous=None):
                  '''
                  Generates a financial report (P&L or Balance Sheet) in XML format
                  :param data_current: dictionary of data of the current year
          Severity: Minor
          Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if report['val'] not in (AccountingNone, None):
                                        record._append_num_field(form_data,
                                                                 ecdf_code,
                                                                 0.0)
            
            
            Severity: Major
            Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if balance <= 0.0:
                                          ecdf_codes = ['0118', '2260']
                                      else:
                                          ecdf_codes = ['0117', '2259']
              
              
              Severity: Major
              Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 45 mins to fix

                Function get_vat_declarer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_vat_declarer(self):
                        '''
                        :returns: VAT number of the company, 8 characters, without the two\
                        uppercase letters 'LU'
                        If no VAT number, default value 'NE' is returned
                Severity: Minor
                Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 35 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 get_vat_agent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_vat_agent(self):
                        '''
                        :returns: VAT number provided in the form. If no VAT number has been\
                        provided, the VAT number of the company is returned, without the two\
                        uppercase letters 'LU'.
                Severity: Minor
                Found in l10n_lu_ecdf/wizard/ecdf_report.py - About 35 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 _append_num_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _append_num_field(self, element, ecdf, val, comment=None):
                        '''
                        A numeric field's value can be a integer or a float
                        The only decimal separator accepted is the coma (",")
                        The point (".") is not accepted as a decimal separator nor as a \
                Severity: Minor
                Found in l10n_lu_ecdf/wizard/ecdf_report.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

                Severity
                Category
                Status
                Source
                Language