OCA/l10n-luxemburg

View on GitHub

Showing 27 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        @api.multi
        @api.constrains('company_registry')
        def check_rcs(self):
            '''
            Constraint : regex validation on RCS Number
    Severity: Major
    Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 4 hrs to fix
    l10n_lu_ecdf/wizard/ecdf_report.py on lines 121..133

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        @api.multi
        @api.constrains('vat')
        def check_vat(self):
            '''
            Constraint : regex validation on VAT Number
    Severity: Major
    Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 4 hrs to fix
    l10n_lu_ecdf/wizard/ecdf_report.py on lines 105..117

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if data_prev:
                    # Previous fiscal year
                    for report in data_prev:
                        line_match = rexp.match(report['kpi_technical_name'])
                        if line_match:
    Severity: Major
    Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 3 hrs to fix
    l10n_lu_ecdf/wizard/ecdf_report.py on lines 359..367

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                for report in data_curr:
                    line_match = rexp.match(report['kpi_technical_name'])
                    if line_match:
                        ecdf_code = line_match.group('current')
                        record._append_num_field(
    Severity: Major
    Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 3 hrs to fix
    l10n_lu_ecdf/wizard/ecdf_report.py on lines 369..379

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if self.with_pl:  # Profit and Loss
                if self.reports_type == 'full':
                    reports.append({'type': 'CA_COMPP',
                                    'model': '2',
                                    'templ': templ['CA_COMPP']})
    Severity: Major
    Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 3 hrs to fix
    l10n_lu_ecdf/wizard/ecdf_report.py on lines 657..665

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 65.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if self.with_bs:  # Balance Sheet
                if self.reports_type == 'full':
                    reports.append({'type': 'CA_BILAN',
                                    'model': '1',
                                    'templ': templ['CA_BILAN']})
    Severity: Major
    Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 3 hrs to fix
    l10n_lu_ecdf/wizard/ecdf_report.py on lines 666..674

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 65.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                period_ids = (self.env['account.period'].search(
                    [('special', '=', False),
                        ('fiscalyear_id', '=', self.current_fiscyear.id)]
                )).sorted(key=lambda r: r.date_start)
        Severity: Major
        Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 2 hrs to fix
        l10n_lu_ecdf/wizard/ecdf_report.py on lines 462..465

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 50.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                period_ids = (self.env['account.period'].search(
                    [('special', '=', False),
                        ('fiscalyear_id', '=', self.current_fiscyear.id)]
                )).sorted(key=lambda r: r.date_start)
        Severity: Major
        Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 2 hrs to fix
        l10n_lu_ecdf/wizard/ecdf_report.py on lines 405..408

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 50.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                @api.multi
                def get_matr_agent(self):
                    '''
                    :returns: Agent matricule provided in the form
                    If no agent matricule provided, the company one is returned
            Severity: Major
            Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 1 hr to fix
            l10n_lu_ecdf/wizard/ecdf_report.py on lines 275..287

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 38.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                @api.multi
                def get_rcs_agent(self):
                    '''
                    :returns: RCS number (Numéro de registre de Commerce et des Sociétés)\
                    provided in the form.
            Severity: Major
            Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 1 hr to fix
            l10n_lu_ecdf/wizard/ecdf_report.py on lines 263..273

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 38.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                    self._append_num_field(
                                        form_data, ecdf_codes[0], balance,
                                        comment=" %s - %s " % (comment,
                                                               report['kpi_name'])
            Severity: Minor
            Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 50 mins to fix
            l10n_lu_ecdf/wizard/ecdf_report.py on lines 529..532

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 36.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                    self._append_num_field(
                                        form_data, ecdf_codes[1], balance,
                                        comment=" %s - %s " % (comment,
                                                               report['kpi_name'])
            Severity: Minor
            Found in l10n_lu_ecdf/wizard/ecdf_report.py and 1 other location - About 50 mins to fix
            l10n_lu_ecdf/wizard/ecdf_report.py on lines 524..527

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 36.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language