open-synergy/opnsynid-hr

View on GitHub

Showing 88 of 547 total issues

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

class HrAward(models.Model):
    _name = "hr.award"
    _description = "Employee Award"
    _inherit = [
        "mail.thread",
Severity: Minor
Found in hr_award/models/hr_award.py - About 2 hrs to fix

    File hr_overtime_request_batch.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Copyright 2018 OpenSynergy Indonesia
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    from datetime import datetime

      Function setUp has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def setUp(self, *args, **kwargs):
              super(BaseCase, self).setUp()
      
              self.obj_partner = self.env["res.partner"]
              self.obj_user = self.env["res.users"]
      Severity: Minor
      Found in hr_payslip_security/tests/base.py - About 1 hr to fix

        Function _compute_attendance has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_attendance(self):
                obj_attendance = self.env["hr.attendance"]
                for schedule in self:
                    criteria = [
                        ("schedule_id", "=", schedule.id),

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

            def onchange_general_account_id(self):
                account = False
                is_sale_line = False
                obj_substitution = self.env["account.analytic_general_account_substitution"]
        
        
        Severity: Minor
        Found in hr_timesheet_general_account_policy/models/hr_analytic_timesheet.py - About 1 hr 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_att_sign_in_out has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_att_sign_in_out(self):
                for document in self:
                    company = document.employee_id.company_id
        
                    if not document.schedule_id:
        Severity: Minor
        Found in hr_timesheet_attendance_schedule/models/hr_attendance.py - About 1 hr 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 setUp has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def setUp(self):
                super(BaseTestHrPayslip, self).setUp()
                # Object
                self.obj_timesheet = self.env["hr_timesheet_sheet.sheet"]
                self.obj_wd = self.env["hr.payslip.worked_days"]
        Severity: Minor
        Found in hr_worked_days_from_activity/tests/base.py - About 1 hr to fix

          Function _compute_point has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_point(self):
                  for rec in self:
                      if rec.state == "reached":
                          if rec.line_id.reach_point_method == "fixed":
                              rec.point = rec.line_id.reach_point
          Severity: Minor
          Found in gamification_point/models/gamification_goal.py - About 1 hr 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 onchange_pricelist_id has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def onchange_pricelist_id(self):
                  _super = super(HrAnalyticTimesheet, self)
                  _super.onchange_pricelist_id()
                  obj_pricelist = self.env["hr.contract_timesheet_pricelist"]
          
          
          Severity: Minor
          Found in hr_contract_timesheet_pricelist/models/hr_analytic_timesheet.py - About 1 hr 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 onchange_amount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def onchange_amount(self):
                  is_sale_line = False
                  obj_price_type = self.env["product.price.type"]
                  obj_precision = self.env["decimal.precision"]
                  result = 0.0
          Severity: Minor
          Found in hr_timesheet_onchange/models/hr_analytic_timesheet.py - About 1 hr 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 _prepare_contract_update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _prepare_contract_update(self):
                  self.ensure_one()
                  return {
                      "job_id": self.new_job_id and self.new_job_id.id or False,
                      "working_hours": self.new_working_hour_id
          Severity: Minor
          Found in hr_career_transition/models/hr_career_transition.py - About 1 hr 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 button_compute_sheet has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def button_compute_sheet(self):
                  self.ensure_one()
                  obj_hr_payslip = self.env["hr.payslip"]
                  context = self._context
                  record_ids = context["active_ids"]
          Severity: Minor
          Found in hr_payslip_compute_sheet/wizards/hr_compute_sheet.py - About 1 hr 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 _compute_summary_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_summary_info(self):
                  obj_hr_attendance = self.env["hr.attendance"]
                  for sheet_day in self:
                      first_sign_in = False
                      last_sign_out = False

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

              def _prepare_contract_revert(self):
                  self.ensure_one()
                  return {
                      "job_id": self.previous_job_id and self.previous_job_id.id or False,
                      "working_hours": self.previous_working_hour_id
          Severity: Minor
          Found in hr_career_transition/models/hr_career_transition.py - About 1 hr 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 test_import_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def test_import_data(self):
                  # Generate Payslip
                  vals = {
                      "name": "Test Payslip",
                      "date_end": time.strftime("%Y-%m-%d"),
          Severity: Minor
          Found in hr_payslip_import_input/tests/test_import.py - About 1 hr to fix

            Function _batch_create_goal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _batch_create_goal(self, user, line):
                    self.ensure_one()
                    date_start = datetime.strptime(self.date_start, "%Y-%m-%d")
                    date_end = False
                    if self.date_end:
            Severity: Minor
            Found in gamification_manual_goal_creation/wizards/manual_goal_creation.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 test_import_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def test_import_data(self):
                    # Generate Payslip
                    vals = {
                        "name": "Test Payslip",
                        "date_end": time.strftime("%Y-%m-%d"),
            Severity: Minor
            Found in hr_payslip_import_input/tests/test_import.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 _prepare_new_contract has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _prepare_new_contract(self):
                    self.ensure_one()
                    return {
                        "employee_id": self.employee_id.id,
                        "job_id": self.new_job_id and self.new_job_id.id or False,
            Severity: Minor
            Found in hr_career_transition/models/hr_career_transition.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 _compute_policy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _compute_policy(self):
                    for holiday in self:
                        if self.env.user.id == SUPERUSER_ID:
                            holiday.confirm_ok = (
                                holiday.approve_ok
            Severity: Minor
            Found in hr_holiday_workflow_policy/models/hr_holidays.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 _compute_state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _compute_state(self):
                    for attn in self:
                        if attn.start_attendance_id and attn.end_attendance_id:
                            attn.state = "present"
                        elif (attn.start_attendance_id and not attn.end_attendance_id) or (

            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