open-synergy/opnsynid-hr

View on GitHub

Showing 547 of 547 total issues

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

    @api.multi
    def button_cancel(self):
        for document in self:
            document.write(document._prepare_cancel_data())
            document.restart_validation()
Severity: Major
Found in hr_award/models/hr_award.py and 11 other locations - About 50 mins to fix
hr_attendance_overtime_request/models/hr_overtime_request.py on lines 318..322
hr_attendance_overtime_request/models/hr_overtime_request.py on lines 329..333
hr_award/models/hr_award.py on lines 271..275
hr_career_transition/models/hr_career_transition.py on lines 421..425
hr_dicipline/models/hr_dicipline.py on lines 269..273
hr_dicipline/models/hr_dicipline.py on lines 290..294
hr_employee_training/models/hr_training_partisipant.py on lines 103..107
hr_employee_training/models/hr_training_session.py on lines 132..136
hr_recruitment_request/models/hr_recruitment_request.py on lines 239..243
hr_timesheet_attendance_schedule/models/hr_timesheet_attendance_schedule_change.py on lines 218..222
hr_timesheet_attendance_schedule/models/hr_timesheet_attendance_schedule_change.py on lines 230..234

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

    @api.multi
    @api.depends(
        "job_family_id",
    )
    def _compute_job_grade(self):
Severity: Major
Found in hr_job_family_modelling/models/hr_job_family_level.py and 2 other locations - About 50 mins to fix
hr_award/models/hr_award.py on lines 47..53
hr_dicipline/models/hr_dicipline.py on lines 45..51

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

    @api.multi
    @api.depends(
        "type_id",
    )
    def _compute_allowed_reason_ids(self):
Severity: Major
Found in hr_dicipline/models/hr_dicipline.py and 2 other locations - About 50 mins to fix
hr_award/models/hr_award.py on lines 47..53
hr_job_family_modelling/models/hr_job_family_level.py on lines 13..19

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

    @api.multi
    @api.depends(
        "type_id",
    )
    def _compute_allowed_reason_ids(self):
Severity: Major
Found in hr_award/models/hr_award.py and 2 other locations - About 50 mins to fix
hr_dicipline/models/hr_dicipline.py on lines 45..51
hr_job_family_modelling/models/hr_job_family_level.py on lines 13..19

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

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 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 _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

    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

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

    Severity: Major
    Found in hr_employee_pob_from_home_address/models/hr_employee.py and 7 other locations - About 45 mins to fix
    hr_employee_birthdate_from_home_address/models/hr_employee.py on lines 0..11
    hr_employee_sequence_configurator/models/hr_employment_status.py on lines 0..11
    hr_employee_training_allowance/models/hr_department.py on lines 0..11
    hr_employee_training_allowance/models/hr_employee.py on lines 0..11
    hr_employee_training_allowance/models/hr_job.py on lines 0..11
    hr_employee_training_allowance/models/hr_training_category.py on lines 0..11
    hr_expense_default_journal/models/hr_employee.py on lines 0..11

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

    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

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

      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

      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

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

        Severity: Major
        Found in hr_expense_default_journal/models/hr_employee.py and 7 other locations - About 45 mins to fix
        hr_employee_birthdate_from_home_address/models/hr_employee.py on lines 0..11
        hr_employee_pob_from_home_address/models/hr_employee.py on lines 0..11
        hr_employee_sequence_configurator/models/hr_employment_status.py on lines 0..11
        hr_employee_training_allowance/models/hr_department.py on lines 0..11
        hr_employee_training_allowance/models/hr_employee.py on lines 0..11
        hr_employee_training_allowance/models/hr_job.py on lines 0..11
        hr_employee_training_allowance/models/hr_training_category.py on lines 0..11

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

        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 _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

        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

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

          Severity: Major
          Found in hr_employee_birthdate_from_home_address/models/hr_employee.py and 7 other locations - About 45 mins to fix
          hr_employee_pob_from_home_address/models/hr_employee.py on lines 0..11
          hr_employee_sequence_configurator/models/hr_employment_status.py on lines 0..11
          hr_employee_training_allowance/models/hr_department.py on lines 0..11
          hr_employee_training_allowance/models/hr_employee.py on lines 0..11
          hr_employee_training_allowance/models/hr_job.py on lines 0..11
          hr_employee_training_allowance/models/hr_training_category.py on lines 0..11
          hr_expense_default_journal/models/hr_employee.py on lines 0..11

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

          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 _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 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

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

            Severity: Major
            Found in hr_timesheet_computation_holiday/models/hr_timesheet_sheet.py and 6 other locations - About 45 mins to fix
            hr_career_transition/models/hr_contract.py on lines 0..12
            hr_employee_identification_from_home_address/models/hr_employee.py on lines 0..11
            hr_employee_language_from_home_address/models/hr_employee.py on lines 0..11
            hr_employee_project_experince_from_user/models/hr_employee.py on lines 0..11
            hr_employee_skill_from_home_address/models/hr_employee.py on lines 0..11
            hr_timesheet_computation/models/hr_contract.py on lines 0..11

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

            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