open-synergy/opnsynid-hr

View on GitHub

Showing 88 of 547 total issues

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

    def action_move_create(self):
        """Reconcile supplier invoice payables with the created move lines."""
        res = super(HrExpense, self).action_move_create()
        for expense in self:
            for line in expense.account_move_id.line_id:
Severity: Minor
Found in hr_expense_header_account/models/hr_expense.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 _create_attendance_schedule has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_attendance_schedule(self):
        self.ensure_one()
        obj_schedule = self.env["hr.timesheet_attendance_schedule"]
        tz = self.employee_id.user_id.tz or self.env.user.tz

Severity: Minor
Found in hr_timesheet_attendance_schedule/models/hr_timesheet_sheet.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 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _compute_policy(self):
        for batch in self:
            if self.env.user.id == SUPERUSER_ID:
                batch.close_ok = batch.generate_ok = batch.set2draft_ok = True
                continue
Severity: Minor
Found in hr_payslip_workflow_policy/models/hr_payslip_run.py - About 45 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

Avoid deeply nested control flow statements.
Open

                        if abs(1 - rounded_start_hour) < 0.01:
                            attendance_start = datetime(
                                attendance_start.year,
                                attendance_start.month,
                                attendance_start.day,
Severity: Major
Found in hr_attendance_computation/models/hr_attendance.py - About 45 mins to fix

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

        def get_name_data(
    Severity: Minor
    Found in hr_attendance_import_from_machine/wizards/hr_attendance_import.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if matched_schedules:
                                  intervals_within += 1
                                  # sign in tolerance
                                  if intervals_within == 1:
                                      att = matched_schedules[0]
      Severity: Major
      Found in hr_attendance_computation/models/hr_attendance.py - About 45 mins to fix

        Function _compute_policy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_policy(self):
                for batch in self:
                    if self.env.user.id == SUPERUSER_ID:
                        batch.confirm_ok = (
                            batch.valid_ok
        Severity: Minor
        Found in hr_attendance_overtime_request_batch/models/hr_overtime_request_batch.py - About 45 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_hour has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_hour(self):
                for ovt in self:
                    ovt_hour = 0.0
                    dt_start = dt_end = False
                    if ovt.date_start:
        Severity: Minor
        Found in hr_attendance_overtime_request/models/hr_overtime_request.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                if len(matched_schedules) > 1:
                                    raise UserError(
                                        _("Wrongly configured working schedule with " "id %s")
                                        % unicode(calendar_id)  # noqa: F821
                                    )
        Severity: Major
        Found in hr_attendance_computation/models/hr_attendance.py - About 45 mins to fix

          Function get_csv_detail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_csv_detail(self):
                  dict_field = {}
                  dict_date = {}
                  obj_csv_detail = self.env["hr.attendance_machine_csv_detail"]
          
          
          Severity: Minor
          Found in hr_attendance_import_from_machine/wizards/hr_attendance_import.py - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_policy(self):
                  for batch in self:
                      if self.env.user.id == SUPERUSER_ID:
                          batch.confirm_ok = (
                              batch.refund_ok
          Severity: Minor
          Found in hr_payslip_workflow_policy/models/hr_payslip.py - About 45 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 action_cancel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def action_cancel(self):
                  for transition in self:
                      if not transition._check_cant_cancel_latest_transition():
                          msg = _("You can only cancel valid latest transition")
                          raise UserError(msg)
          Severity: Minor
          Found in hr_career_transition/models/hr_career_transition.py - About 45 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 onchange_amount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def onchange_amount(self):
                  _super = super(HrAnalyticTimesheet, self)
                  _super.onchange_amount()
          
                  is_sale_line = False
          Severity: Minor
          Found in hr_timesheet_pricelist/models/hr_analytic_timesheet.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                                  if attendance.outside_calendar_duration:
                                      overtime = attendance.outside_calendar_duration
                                      cal = reference_calendar
                                      if cal.overtime_rounding_tolerance:
                                          overtime = self.time_sum(
          Severity: Major
          Found in hr_attendance_computation/models/hr_attendance.py - About 45 mins to fix

            Function _compute_policy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _compute_policy(self):
                    for batch in self:
                        if self.env.user.id == SUPERUSER_ID:
                            batch.submit_ok = (
                                batch.approve_ok
            Severity: Minor
            Found in hr_timesheet_workflow_policy/models/hr_timesheet_sheet.py - About 45 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

            Consider simplifying this complex logical expression.
            Open

                        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 (
                            not attn.start_attendance_id and attn.end_attendance_id
                        ):

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

                  def search(self, args, offset=0, limit=None, order=None, count=False):
              Severity: Minor
              Found in hr_join_transition/models/hr_join_transition.py - About 35 mins to fix

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

                    def search(self, args, offset=0, limit=None, order=None, count=False):
                Severity: Minor
                Found in hr_demotion_transition/models/hr_demotion_transition.py - About 35 mins to fix

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

                      def search(self, args, offset=0, limit=None, order=None, count=False):
                  Severity: Minor
                  Found in hr_termination_transition/models/hr_termination_transition.py - About 35 mins to fix

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

                        def search(self, args, offset=0, limit=None, order=None, count=False):
                    Severity: Minor
                    Found in hr_mutation_transition/models/hr_mutation_transition.py - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language