chore: Format and lint

From: https://github.com/frappe/hrms/pull/1654
Date: 2024-04-17 20:58:14+05:30

  • Merge pull request #1654 from krantheman/js-formatter
  • refactor(Expense Claim): get rid of cur_frm usage
  • chore: remove unncessary fetch from statements & scripts
  • chore: format Shift Assignment Tool
  • fix: merge conflicts
  • chore: ignore sql and cur_frm semgrep rules for now
  • fix: semgrep errors
  • chore: remove redundant flake8 stuff
  • revert: css formatting for frontend folder
  • chore: ignore formatting commits
  • fix: frontend dir path in pre-commit-config
  • chore: format all JS and SCSS files
  • fix: exclude frontend folder from prettier formatting
  • fix: more ruff linting issues
  • revert: max line length to 99 in editorconfig
  • fix: ruff linting issues
  • chore: format all py files
  • ci: add section ordering
  • ci: swtich from black to ruff for linting and formatting python files
  • ci: remove vue, add css for pre-commit formatting
  • ci: add formatting configs
  • ci: setup prettier for js files



Diagnostics

Conflicts detected for source commit: b68457552bb3540565267f23fbfcee35c9f86e1c
- DU .github/helper/documentation.py
- DU .github/helper/translation.py
Cleaning files from denylist:
 .github/helper/documentation.py | 43 ++++++++++++++++++++++++++
 .github/helper/translation.py   | 68 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)


pre-commit failed for source commit: b68457552bb3540565267f23fbfcee35c9f86e1c
Run ruff linter and apply fixes..........................................Failed
- hook id: ruff
- exit code: 1
- files were modified by this hook

hrms/api/__init__.py:112:15: RUF013 PEP 484 prohibits implicit `Optional`
hrms/api/__init__.py:155:15: RUF013 PEP 484 prohibits implicit `Optional`
hrms/api/__init__.py:294:15: RUF013 PEP 484 prohibits implicit `Optional`
hrms/api/__init__.py:335:15: RUF013 PEP 484 prohibits implicit `Optional`
hrms/hr/doctype/appraisal/test_appraisal.py:118:3: F841 Local variable `child1_1` is assigned to but never used
hrms/hr/doctype/appraisal/test_appraisal.py:119:3: F841 Local variable `child1_2` is assigned to but never used
hrms/hr/doctype/appraisal/test_appraisal.py:122:3: F841 Local variable `child2_1` is assigned to but never used
hrms/hr/doctype/appraisal/test_appraisal.py:123:3: F841 Local variable `child2_2` is assigned to but never used
hrms/hr/doctype/appraisal/test_appraisal.py:162:3: F841 Local variable `child1` is assigned to but never used
hrms/hr/doctype/appraisal/test_appraisal.py:166:3: F841 Local variable `child2_2` is assigned to but never used
hrms/hr/doctype/appraisal/test_appraisal.py:283:3: F841 Local variable `goal` is assigned to but never used
hrms/hr/doctype/attendance/attendance.py:251:21: RUF015 Prefer `next(f for f in filters if "employee" in f)` over single element slice
hrms/hr/doctype/compensatory_leave_request/test_compensatory_leave_request.py:159:57: B008 Do not perform function call `today` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
hrms/hr/doctype/employee_checkin/test_employee_checkin.py:470:33: B008 Do not perform function call `now_datetime` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
hrms/hr/doctype/interview/interview.py:83:6: F811 Redefinition of unused `show_job_applicant_update_dialog` from line 60
hrms/hr/doctype/interview/interview.py:102:6: F811 Redefinition of unused `get_job_applicant_status` from line 79
hrms/hr/doctype/interview/interview.py:235:5: F811 Redefinition of unused `get_interviewers` from line 149
hrms/hr/doctype/interview/interview.py:446:25: UP031 Use format specifiers instead of percent format
hrms/hr/doctype/interview/interview.py:447:23: UP031 Use format specifiers instead of percent format
hrms/hr/doctype/job_opening/job_opening.py:72:4: F841 Local variable `staffing_plan_company` is assigned to but never used
hrms/hr/doctype/leave_allocation/test_earned_leaves.py:398:6: F811 Redefinition of unused `test_backdated_pro_rated_allocation` from line 376
hrms/hr/doctype/leave_allocation/test_earned_leaves.py:560:97: F821 Undefined name `end_date`
hrms/hr/doctype/leave_allocation/test_earned_leaves.py:589:6: B007 Loop control variable `i` not used within loop body
hrms/hr/doctype/leave_allocation/test_leave_allocation.py:213:3: F841 Local variable `leave_type` is assigned to but never used
hrms/hr/doctype/leave_allocation/test_leave_allocation.py:290:3: F841 Local variable `leave_type` is assigned to but never used
hrms/hr/doctype/leave_allocation/test_leave_allocation.py:321:3: F841 Local variable `leave_type` is assigned to but never used
hrms/hr/doctype/leave_application/leave_application.py:5:1: UP035 `typing.Dict` is deprecated, use `dict` instead
hrms/hr/doctype/leave_application/leave_application.py:5:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead
hrms/hr/doctype/leave_application/test_leave_application.py:101:3: F841 Local variable `list_without_weekly_offs` is assigned to but never used
hrms/hr/doctype/leave_application/test_leave_application.py:1056:3: F841 Local variable `application` is assigned to but never used
hrms/hr/doctype/leave_application/test_leave_application.py:1089:3: F841 Local variable `application` is assigned to but never used
hrms/hr/doctype/leave_application/test_leave_application.py:1131:3: F841 Local variable `application` is assigned to but never used
hrms/hr/doctype/leave_encashment/test_leave_encashment.py:65:3: F841 Local variable `leave_policy_assignments` is assigned to but never used
hrms/hr/doctype/leave_encashment/test_leave_encashment.py:69:3: F841 Local variable `salary_structure` is assigned to but never used
hrms/hr/doctype/leave_encashment/test_leave_encashment.py:115:3: F841 Local variable `leave_application` is assigned to but never used
hrms/hr/doctype/leave_encashment/test_leave_encashment.py:160:3: F841 Local variable `leave_application` is assigned to but never used
hrms/hr/doctype/leave_encashment/test_leave_encashment.py:204:3: F841 Local variable `leave_application` is assigned to but never used
hrms/hr/doctype/shift_assignment/shift_assignment.py:6:1: UP035 `typing.Dict` is deprecated, use `dict` instead
hrms/hr/doctype/shift_assignment/shift_assignment.py:6:1: UP035 `typing.List` is deprecated, use `list` instead
hrms/hr/doctype/shift_assignment/shift_assignment.py:161:3: F841 Local variable `company` is assigned to but never used
hrms/hr/doctype/shift_assignment/shift_assignment.py:396:17: RUF013 PEP 484 prohibits implicit `Optional`
hrms/hr/doctype/shift_assignment/shift_assignment.py:398:24: RUF013 PEP 484 prohibits implicit `Optional`
hrms/hr/doctype/shift_assignment/shift_assignment.py:477:32: RUF013 PEP 484 prohibits implicit `Optional`
hrms/hr/doctype/shift_assignment/shift_assignment.py:559:60: RUF013 PEP 484 prohibits implicit `Optional`
hrms/hr/doctype/shift_assignment/test_shift_assignment.py:263:3: F841 Local variable `shift` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:63:3: F841 Local variable `log_in` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:70:3: F841 Local variable `log_out` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:89:3: F841 Local variable `log_in` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:92:3: F841 Local variable `log_out` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:107:6: F811 Redefinition of unused `test_mark_attendance_with_different_shift_start_time` from line 52
hrms/hr/doctype/shift_type/test_shift_type.py:118:3: F841 Local variable `log_in` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:125:3: F841 Local variable `log_out` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:293:3: F841 Local variable `log` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:322:3: F841 Local variable `log` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:419:3: F841 Local variable `log` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:480:3: F841 Local variable `log_in` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:483:3: F841 Local variable `log_out` is assigned to but never used
hrms/hr/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py:159:32: B007 Loop control variable `project` not used within loop body
hrms/hr/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py:179:7: B007 Loop control variable `emp` not used within loop body
hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py:7:1: UP035 `typing.Dict` is deprecated, use `dict` instead
hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py:7:1: UP035 `typing.List` is deprecated, use `list` instead
hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py:7:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead
hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py:616:7: B007 Loop control variable `employee` not used within loop body
hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py:617:8: B007 Loop control variable `shift` not used within loop body
hrms/hr/utils.py:706:5: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
hrms/overrides/employee_payment_entry.py:72:2: F841 Local variable `party_type` is assigned to but never used
hrms/payroll/doctype/payroll_entry/payroll_entry.py:591:27: RUF013 PEP 484 prohibits implicit `Optional`
hrms/payroll/doctype/payroll_entry/payroll_entry.py:1178:41: RUF013 PEP 484 prohibits implicit `Optional`
hrms/payroll/doctype/payroll_entry/payroll_entry.py:1513:10: RUF013 PEP 484 prohibits implicit `Optional`
hrms/payroll/doctype/payroll_entry/payroll_entry.py:1552:2: F841 Local variable `doctype` is assigned to but never used
hrms/payroll/doctype/payroll_entry/test_payroll_entry.py:534:3: F841 Local variable `payroll_entry` is assigned to but never used
hrms/payroll/doctype/salary_component/test_salary_component.py:22:16: RUF015 Prefer `next(...)` over single element slice
hrms/payroll/doctype/salary_component/test_salary_component.py:26:16: RUF015 Prefer `next(...)` over single element slice
hrms/payroll/doctype/salary_component/test_salary_component.py:30:16: RUF015 Prefer `next(...)` over single element slice
hrms/payroll/doctype/salary_slip/salary_slip.py:66:8: UP008 Use `super()` instead of `super(__class__, self)`
hrms/payroll/doctype/salary_slip/salary_slip.py:614:7: F841 Local variable `is_partially_paid_leave` is assigned to but never used
hrms/payroll/doctype/salary_slip/salary_slip.py:1254:6: F841 Local variable `has_overwritten_tax` is assigned to but never used
hrms/payroll/doctype/salary_slip/test_salary_slip.py:313:3: F841 Local variable `leave_type_ppl` is assigned to but never used
hrms/payroll/doctype/salary_slip/test_salary_slip.py:1037:18: UP031 Use format specifiers instead of percent format
hrms/payroll/doctype/salary_slip/test_salary_slip.py:1174:18: UP031 Use format specifiers instead of percent format
hrms/payroll/doctype/salary_slip/test_salary_slip.py:1222:3: F841 Local variable `salary_structure` is assigned to but never used
hrms/payroll/doctype/salary_slip/test_salary_slip.py:1363:3: F841 Local variable `annual_tax` is assigned to but never used
hrms/payroll/doctype/salary_slip/test_salary_slip.py:2150:4: F841 Local variable `pp` is assigned to but never used
hrms/payroll/doctype/salary_structure/salary_structure.py:334:3: UP031 Use format specifiers instead of percent format
hrms/payroll/doctype/salary_structure/salary_structure.py:340:3: RUF005 Consider iterable unpacking instead of concatenation
hrms/payroll/doctype/salary_structure/test_salary_structure.py:165:11: B008 Do not perform function call `erpnext.get_default_currency` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
hrms/payroll/doctype/salary_structure/test_salary_structure.py:227:11: B008 Do not perform function call `erpnext.get_default_currency` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
hrms/payroll/report/income_tax_computation/income_tax_computation.py:406:7: B007 Loop control variable `emp` not used within loop body
hrms/payroll/report/income_tax_computation/income_tax_computation.py:464:7: B007 Loop control variable `emp` not used within loop body
hrms/payroll/report/professional_tax_deductions/professional_tax_deductions.py:54:3: UP031 Use format specifiers instead of percent format
hrms/payroll/report/provident_fund_deductions/provident_fund_deductions.py:120:3: UP031 Use format specifiers instead of percent format
hrms/tests/test_utils.py:117:58: RUF013 PEP 484 prohibits implicit `Optional`
Found 97 errors (5 fixed, 92 remaining).
No fixes available (73 hidden fixes can be enabled with the `--unsafe-fixes` option).

Format Python code.......................................................Failed
- hook id: ruff-format
- files were modified by this hook

4 files reformatted, 96 files left unchanged


pre-commit failed for source commit: 5485e66172d3f7e7f133d645858eb5a6c210140b
Run ruff linter and apply fixes..........................................Failed
- hook id: ruff
- exit code: 1

hrms/hr/doctype/interview/interview.py:83:6: F811 Redefinition of unused `show_job_applicant_update_dialog` from line 60
hrms/hr/doctype/interview/interview.py:102:6: F811 Redefinition of unused `get_job_applicant_status` from line 79
hrms/hr/doctype/interview/interview.py:235:5: F811 Redefinition of unused `get_interviewers` from line 149
hrms/hr/doctype/leave_allocation/test_earned_leaves.py:398:6: F811 Redefinition of unused `test_backdated_pro_rated_allocation` from line 376
hrms/hr/doctype/leave_allocation/test_earned_leaves.py:560:97: F821 Undefined name `end_date`
hrms/hr/doctype/shift_type/test_shift_type.py:111:6: F811 Redefinition of unused `test_mark_attendance_with_different_shift_start_time` from line 52
hrms/hr/doctype/shift_type/test_shift_type.py:122:3: F841 Local variable `log_in` is assigned to but never used
hrms/hr/doctype/shift_type/test_shift_type.py:129:3: F841 Local variable `log_out` is assigned to but never used
Found 8 errors.
No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).


Conflicts detected for source commit: 1ab1d6238171a5cee3263812402a8b82e7131cb1
- DU commitlint.config.js
- DU hrms/hr/report/leave_ledger/leave_ledger.js
- DU hrms/public/js/utils/leave_utils.js
Cleaning files from denylist:
 commitlint.config.js | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)


pre-commit failed for source commit: 1ab1d6238171a5cee3263812402a8b82e7131cb1
prettier.................................................................Failed
- hook id: prettier
- files were modified by this hook

hrms/hr/doctype/leave_application/leave_application.js
hrms/hr/doctype/expense_claim/expense_claim.js
hrms/public/scss/hierarchy_chart.scss
hrms/hr/doctype/leave_encashment/leave_encashment.js
hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
hrms/payroll/doctype/salary_slip/salary_slip.js
hrms/payroll/doctype/payroll_entry/payroll_entry.js
hrms/hr/doctype/attendance/attendance_list.js


Conflicts detected for source commit: 1bc4dea21af22071da4a3a825bc282717adc461c
   Keeping file (updated by them): .config/.flake8_strict
pre-commit failed for source commit: 6409bb19fec509098d3db28c61625279c9c01de8
Run ruff linter and apply fixes..........................................Failed
- hook id: ruff
- exit code: 1

hrms/hr/doctype/interview/interview.py:83:6: F811 Redefinition of unused `show_job_applicant_update_dialog` from line 60
hrms/hr/doctype/interview/interview.py:102:6: F811 Redefinition of unused `get_job_applicant_status` from line 79
hrms/hr/doctype/interview/interview.py:235:5: F811 Redefinition of unused `get_interviewers` from line 149
Found 3 errors.


Conflicts detected for source commit: 5edd809d21dc93c8754938624f266288e37cb7e3
- DU hrms/locale/bs.po
- DU hrms/locale/fa.po
pre-commit failed for source commit: 5edd809d21dc93c8754938624f266288e37cb7e3
prettier.................................................................Failed
- hook id: prettier
- files were modified by this hook

hrms/hr/doctype/shift_assignment_tool/shift_assignment_tool.js

Run ruff linter and apply fixes..........................................Failed
- hook id: ruff
- exit code: 1

hrms/hr/doctype/shift_assignment_tool/test_shift_assignment_tool.py:91:3: F841 Local variable `request2` is assigned to but never used
hrms/hr/doctype/shift_assignment_tool/test_shift_assignment_tool.py:99:3: F841 Local variable `request3` is assigned to but never used
hrms/hr/doctype/shift_assignment_tool/test_shift_assignment_tool.py:107:3: F841 Local variable `request4` is assigned to but never used
hrms/hr/doctype/shift_assignment_tool/test_shift_assignment_tool.py:113:3: F841 Local variable `request5` is assigned to but never used
Found 4 errors.
No fixes available (4 hidden fixes can be enabled with the `--unsafe-fixes` option).

Format Python code.......................................................Failed
- hook id: ruff-format
- files were modified by this hook

1 file reformatted, 6 files left unchanged


Suspicious merge commit detected: 5edd809d21dc93c8754938624f266288e37cb7e3
pre-commit failed for source commit: 73b383368aa25f0a4133000611c1a5d1f6e6eeea
Format Python code.......................................................Failed
- hook id: ruff-format
- files were modified by this hook

1 file reformatted


Conflicts detected for source commit: 56bee15e5fb3123278e910efe05cf93c758fce33
   Keeping file (updated by them): .config/.flake8_strict
- DU .github/helper/documentation.py
- DU .github/helper/translation.py
- DU commitlint.config.js
Cleaning files from denylist:
 .github/helper/documentation.py | 43 ++++++++++++++++++++++++++
 .github/helper/translation.py   | 68 +++++++++++++++++++++++++++++++++++++++++
 commitlint.config.js            | 26 ++++++++++++++++
 3 files changed, 137 insertions(+)


Suspicious merge commit detected: 56bee15e5fb3123278e910efe05cf93c758fce33



Checkout instructions
# Checkout locally
git fetch upstream
git switch ft-pr-1654

# Alternatively, re-take the changes
git switch develop
ft take ft-pr-1654

# Make changes then rebase
git rebase -i develop

# Fix or ignore conflicts
git checkout --theirs .
git rebase --continue

# Force-push changes
git push --force-with-lease

Merge request reports

Loading