OCA/l10n-belgium

View on GitHub

Showing 21 of 21 total issues

Function companyweb_information has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def companyweb_information(self, cr, uid, ids, vat_number, context=None):
        login = self.pool['ir.config_parameter'].get_param(
            cr, uid, 'companyweb.login', False)
        pswd = self.pool['ir.config_parameter'].get_param(
            cr, uid, 'companyweb.pswd', False)
Severity: Minor
Found in account_companyweb/model/res_partner.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 create_openSalesDocs has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def create_openSalesDocs(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        this = self.browse(cr, uid, ids)[0]

Severity: Minor
Found in account_companyweb/wizard/account_companyweb_report_wizard.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

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

    def set_default_companyweb_login(self, cr, uid, ids, context=None):
        config = self.browse(cr, uid, ids[0], context)
        self.pool['ir.config_parameter'].set_param(
            cr, SUPERUSER_ID, 'companyweb.login', config.companyweb_login)
        return True
Severity: Major
Found in account_companyweb/model/res_config.py and 1 other location - About 2 hrs to fix
account_companyweb/model/res_config.py on lines 66..70

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 57.

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

    def set_default_companyweb_pswd(self, cr, uid, ids, context=None):
        config = self.browse(cr, uid, ids[0], context)
        self.pool['ir.config_parameter'].set_param(
            cr, SUPERUSER_ID, 'companyweb.pswd', config.companyweb_pswd)
        return True
Severity: Major
Found in account_companyweb/model/res_config.py and 1 other location - About 2 hrs to fix
account_companyweb/model/res_config.py on lines 60..64

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 57.

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

File account_companyweb_report_wizard.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
##############################################################################
#
#    Authors: Adrien Peiffer
Severity: Minor
Found in account_companyweb/wizard/account_companyweb_report_wizard.py - About 2 hrs to fix

    Function create_openSalesDocs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create_openSalesDocs(self, cr, uid, ids, context=None):
            if context is None:
                context = {}
            this = self.browse(cr, uid, ids)[0]
    
    
    Severity: Minor
    Found in account_companyweb/wizard/account_companyweb_report_wizard.py - About 1 hr to fix

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

                      if len(score) == 1:
                          chiffre = "0" + score[0:]
                      else:
                          chiffre = score[0:]
      Severity: Major
      Found in account_companyweb/model/res_partner.py and 1 other location - About 1 hr to fix
      account_companyweb/model/res_partner.py on lines 103..106

      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 43.

      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 len(score) == 2:
                          chiffre = "0" + score[1:]
                      else:
                          chiffre = score[1:]
      Severity: Major
      Found in account_companyweb/model/res_partner.py and 1 other location - About 1 hr to fix
      account_companyweb/model/res_partner.py on lines 109..112

      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 43.

      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 create_createdSalesDocs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def create_createdSalesDocs(self, cr, uid, ids, context=None):
              if context is None:
                  context = {}
              this = self.browse(cr, uid, ids)[0]
      
      
      Severity: Minor
      Found in account_companyweb/wizard/account_companyweb_report_wizard.py - About 1 hr to fix

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

            def get_default_companyweb_login(self, cr, uid, fields_name, context=None):
                login = self.pool['ir.config_parameter'].get_param(
                    cr, SUPERUSER_ID, 'companyweb.login', False)
                return {'companyweb_login': login}
        Severity: Major
        Found in account_companyweb/model/res_config.py and 1 other location - About 1 hr to fix
        account_companyweb/model/res_config.py on lines 55..58

        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 41.

        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_st_line_note has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_st_line_note(self, line, information_dict):
                """This method returns a formatted note from line information
                """
                note = []
                if line.counterparty_name:

        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

            def get_default_companyweb_pswd(self, cr, uid, fields_name, context=None):
                pswd = self.pool['ir.config_parameter'].get_param(
                    cr, SUPERUSER_ID, 'companyweb.pswd', False)
                return {'companyweb_pswd': pswd}
        Severity: Major
        Found in account_companyweb/model/res_config.py and 1 other location - About 1 hr to fix
        account_companyweb/model/res_config.py on lines 50..53

        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 41.

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

            def companyweb_information(self, cr, uid, ids, vat_number, context=None):
        Severity: Minor
        Found in account_companyweb/model/res_partner.py - About 35 mins to fix

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

              def get_update_values(self, cr, uid, ids, wizard, context=None):
          Severity: Minor
          Found in account_companyweb/wizard/account_companyweb_wizard.py - About 35 mins to fix

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

                    if line.counterparty_name:
                        note.append(_('Counter Party') + ': ' +
                                    line.counterparty_name)
            account_bank_statement_import_coda/wizard/account_bank_statement_import_coda.py on lines 128..130
            account_bank_statement_import_coda/wizard/account_bank_statement_import_coda.py on lines 131..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 33.

            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 3 locations. Consider refactoring.
            Open

                    if line.counterparty_number:
                        note.append(_('Counter Party Account') + ': ' +
                                    line.counterparty_number)
            account_bank_statement_import_coda/wizard/account_bank_statement_import_coda.py on lines 125..127
            account_bank_statement_import_coda/wizard/account_bank_statement_import_coda.py on lines 131..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 33.

            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 3 locations. Consider refactoring.
            Open

                    if line.counterparty_address:
                        note.append(_('Counter Party Address') + ': ' +
                                    line.counterparty_address)
            account_bank_statement_import_coda/wizard/account_bank_statement_import_coda.py on lines 125..127
            account_bank_statement_import_coda/wizard/account_bank_statement_import_coda.py on lines 128..130

            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 33.

            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

                        if amout < 0:
                            sheet1.write(pos, 4, "LC")
                        else:
                            sheet1.write(pos, 4, "I")
            Severity: Minor
            Found in account_companyweb/wizard/account_companyweb_report_wizard.py and 1 other location - About 35 mins to fix
            account_companyweb/wizard/account_companyweb_report_wizard.py on lines 141..144

            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 33.

            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

                        if amout < 0:
                            sheet1.write(pos, 4, "LC")
                        else:
                            sheet1.write(pos, 4, "I")
            Severity: Minor
            Found in account_companyweb/wizard/account_companyweb_report_wizard.py and 1 other location - About 35 mins to fix
            account_companyweb/wizard/account_companyweb_report_wizard.py on lines 293..296

            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 33.

            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_st_vals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_st_vals(self, statement):
                    """
                    This method return a dict of vals that can be passed to
                    create method of statement.
                    :return: dict of vals that represent additional infos for the statement

            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