odoo-brazil/odoo-brazil-hr

View on GitHub
l10n_br_hr_payroll/model/hr_contract.py

Summary

Maintainability
C
1 day
Test Coverage

Function _get_wage_ir has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_wage_ir(self, cr, uid, ids, fields, arg, context=None):
        res = {}
        obj_employee = self.pool.get('hr.employee')
        employee_ids = obj_employee.search(
            cr, uid, [
Severity: Minor
Found in l10n_br_hr_payroll/model/hr_contract.py - About 5 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 _check_voucher has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_voucher(self, cr, uid, ids, context=None):
        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)

        for contract in self.browse(cr, uid, ids):
            if user.company_id.check_benefits:
Severity: Minor
Found in l10n_br_hr_payroll/model/hr_contract.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 _get_worked_days has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _get_worked_days(self, cr, uid, ids, fields, arg, context=None):
Severity: Minor
Found in l10n_br_hr_payroll/model/hr_contract.py - About 45 mins to fix

    Function _get_wage_ir has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _get_wage_ir(self, cr, uid, ids, fields, arg, context=None):
    Severity: Minor
    Found in l10n_br_hr_payroll/model/hr_contract.py - About 45 mins to fix

      Function _check_date has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _check_date(self, cr, uid, ids, fields, arg, context=None):
      Severity: Minor
      Found in l10n_br_hr_payroll/model/hr_contract.py - About 45 mins to fix

        Avoid too many return statements within this function.
        Open

                                return 0
        Severity: Major
        Found in l10n_br_hr_payroll/model/hr_contract.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status