Skip to content

chore: switch to ruff for python formatting/linting by barredterra [frappe] PR#40681

Bot Dokos requested to merge ft-pr-40681 into develop

From: https://github.com/frappe/erpnext/pull/40681
Date: 2024-03-27 16:23:00+05:30

  • Merge pull request #40681 from barredterra/ruff
  • ci: sync up action versions with framework
  • chore: update list of revisions for git blame to ignore
  • fix(treewide): manual ruff fixes
  • refactor(treewide): formatting and ruff fixes, + manually enabled F401
  • chore: switch to ruff for python formatting/linting



Diagnostics

Conflicts detected for source commit: 3effaf21ef60a50a20f1bbc15e9289ceaf80cc1a
- DU .github/helper/documentation.py
- DU .github/helper/translation.py
- DU erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
- DU erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py
- DU erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
- DU erpnext/accounts/doctype/process_subscription/process_subscription.py
- DU erpnext/assets/dashboard_fixtures.py
- DU erpnext/assets/doctype/asset_shift_allocation/asset_shift_allocation.py
- DU erpnext/assets/doctype/asset_shift_factor/asset_shift_factor.py
- DU erpnext/patches/v11_0/merge_land_unit_with_location.py
- DU erpnext/patches/v11_0/set_update_field_and_value_in_workflow_state.py
- DU erpnext/patches/v12_0/fix_quotation_expired_status.py
- DU erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py
- DU erpnext/patches/v12_0/rename_bank_reconciliation_fields.py
- DU erpnext/patches/v13_0/agriculture_deprecation_warning.py
- DU erpnext/patches/v13_0/delete_bank_reconciliation_detail.py
- DU erpnext/patches/v13_0/enable_provisional_accounting.py
- DU erpnext/patches/v13_0/healthcare_deprecation_warning.py
- DU erpnext/patches/v13_0/hospitality_deprecation_warning.py
- DU erpnext/patches/v13_0/move_branch_code_to_bank_account.py
- DU erpnext/patches/v13_0/non_profit_deprecation_warning.py
- DU erpnext/patches/v13_0/update_subscription.py
- DU erpnext/patches/v13_0/wipe_serial_no_field_for_0_qty.py
- DU erpnext/patches/v14_0/delete_agriculture_doctypes.py
- DU erpnext/patches/v14_0/delete_healthcare_doctypes.py
- DU erpnext/patches/v14_0/delete_hub_doctypes.py
- DU erpnext/patches/v14_0/delete_non_profit_doctypes.py
- DU erpnext/patches/v14_0/fix_crm_no_of_employees.py
- DU erpnext/patches/v14_0/update_flag_for_return_invoices.py
- DU erpnext/setup/demo.py
- DU erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
- DU erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
Cleaning files from denylist:
 .github/helper/documentation.py | 64 ++++++++++++++++++++++++++++++++++++++
 .github/helper/translation.py   | 68 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 132 insertions(+)


pre-commit failed for source commit: 3effaf21ef60a50a20f1bbc15e9289ceaf80cc1a
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1

erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py: failed parsing with CPython 3.10.14:

    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/usr/local/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py", line 890
        		pos_inv.ignore_pricing_rule = 1
        		^^^^^^^
    SyntaxError: expected 'except' or 'finally' block

erpnext/setup/setup_wizard/operations/taxes_setup.py: failed parsing with CPython 3.10.14:

    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/usr/local/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "erpnext/setup/setup_wizard/operations/taxes_setup.py", line 124
        	"""Create Taxes and Charges Templates from detailed data."""
        	                                                         ^
    SyntaxError: unterminated triple-quoted string literal (detected at line 275)

erpnext/accounts/doctype/subscription/subscription.py: failed parsing with CPython 3.10.14:

    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/usr/local/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "erpnext/accounts/doctype/subscription/subscription.py", line 415
        				if (
        			^
    IndentationError: unexpected indent

erpnext/accounts/doctype/subscription/test_subscription.py: failed parsing with CPython 3.10.14:

    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/usr/local/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "erpnext/accounts/doctype/subscription/test_subscription.py", line 125
        			flt(
        			   ^
    SyntaxError: '(' was never closed

debug statements (python)................................................Failed
- hook id: debug-statements
- exit code: 1

erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py - Could not parse ast

	Traceback (most recent call last):
	  File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/debug_statement_hook.py", line 56, in check_file
	    ast_obj = ast.parse(f.read(), filename=filename)
	  File "/usr/local/lib/python3.10/ast.py", line 50, in parse
	    return compile(source, filename, mode, flags,
	  File "erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py", line 890
	    		pos_inv.ignore_pricing_rule = 1
	    		^^^^^^^
	SyntaxError: expected 'except' or 'finally' block


erpnext/setup/setup_wizard/operations/taxes_setup.py - Could not parse ast

	Traceback (most recent call last):
	  File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/debug_statement_hook.py", line 56, in check_file
	    ast_obj = ast.parse(f.read(), filename=filename)
	  File "/usr/local/lib/python3.10/ast.py", line 50, in parse
	    return compile(source, filename, mode, flags,
	  File "erpnext/setup/setup_wizard/operations/taxes_setup.py", line 124
	    	"""Create Taxes and Charges Templates from detailed data."""
	    	                                                         ^
	SyntaxError: unterminated triple-quoted string literal (detected at line 275)


erpnext/accounts/doctype/subscription/subscription.py - Could not parse ast

	Traceback (most recent call last):
	  File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/debug_statement_hook.py", line 56, in check_file
	    ast_obj = ast.parse(f.read(), filename=filename)
	  File "/usr/local/lib/python3.10/ast.py", line 50, in parse
	    return compile(source, filename, mode, flags,
	  File "erpnext/accounts/doctype/subscription/subscription.py", line 415
	    				if (
	    			^
	IndentationError: unexpected indent


erpnext/accounts/doctype/subscription/test_subscription.py - Could not parse ast

	Traceback (most recent call last):
	  File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/debug_statement_hook.py", line 56, in check_file
	    ast_obj = ast.parse(f.read(), filename=filename)
	  File "/usr/local/lib/python3.10/ast.py", line 50, in parse
	    return compile(source, filename, mode, flags,
	  File "erpnext/accounts/doctype/subscription/test_subscription.py", line 125
	    			flt(
	    			   ^
	SyntaxError: '(' was never closed

Run ruff linter and apply fixes..........................................Failed
- hook id: ruff
- exit code: 1
- files were modified by this hook

error: Failed to parse erpnext/accounts/doctype/subscription/subscription.py:415:1: Unexpected token Indent
error: Failed to parse erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py:890:3: Unexpected token 'pos_inv'
error: Failed to parse erpnext/accounts/doctype/subscription/test_subscription.py:130:5: Unexpected token 'self'
error: Failed to parse erpnext/setup/setup_wizard/operations/taxes_setup.py:124:5: Unexpected token 'Create'
erpnext/accounts/doctype/account/account.py:634:5: F811 Redefinition of unused `sync_update_account_number_in_child` from line 570
erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py:30:3: F821 Undefined name `if_lending_app_installed`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:289:26: F821 Undefined name `get_unreconciled_amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:431:2: F841 Local variable `gles` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:431:9: F821 Undefined name `get_related_bank_gl_entries`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:432:2: F841 Local variable `bt_allocations` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:432:19: F821 Undefined name `get_total_allocated_amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:434:2: F841 Local variable `unallocated_amount` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:516:27: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:517:32: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:518:31: F821 Undefined name `amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:519:35: F821 Undefined name `amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:523:6: F821 Undefined name `amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:526:28: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:531:30: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:538:5: F811 Redefinition of unused `get_doctypes_for_bank_reconciliation` from line 418
erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py:20:3: F841 Local variable `fcontent` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py:126:12: B007 Loop control variable `dummy` not used within loop body
erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py:227:86: F821 Undefined name `gl_account`
erpnext/accounts/doctype/budget/budget.py:345:16: UP032 Use f-string instead of `format` call
erpnext/accounts/doctype/budget/test_budget.py:225:13: F821 Undefined name `project`
erpnext/accounts/doctype/gl_entry/test_gl_entry.py:43:3: F821 Undefined name `rename_gle_sle_docs`
erpnext/accounts/doctype/gl_entry/test_gl_entry.py:44:19: F821 Undefined name `parse_naming_series`
erpnext/accounts/doctype/gl_entry/test_gl_entry.py:62:3: F821 Undefined name `rename_gle_sle_docs`
erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py:79:11: B020 Loop control variable `gle` overrides iterable it iterates
erpnext/accounts/doctype/payment_entry/payment_entry.py:1284:26: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1285:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1285:26: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1286:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1286:25: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1287:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1287:50: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1288:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1290:29: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1291:24: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1292:21: F821 Undefined name `posting_date`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1296:4: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1301:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1302:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1304:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1305:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1305:25: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1306:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1306:50: F821 Undefined name `invoice`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1307:3: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1314:4: F821 Undefined name `args_dict`
erpnext/accounts/doctype/payment_entry/payment_entry.py:1495:11: RUF015 Prefer `next(...)` over single element slice
erpnext/accounts/doctype/payment_entry/test_payment_entry.py:1346:21: F821 Undefined name `create_account`
erpnext/accounts/doctype/payment_entry/test_payment_entry.py:1535:21: F821 Undefined name `create_account`
erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py:174:39: B008 Do not perform function call `nowdate` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py:203:39: B008 Do not perform function call `nowdate` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
erpnext/accounts/doctype/payment_request/payment_request.py:402:3: F841 Local variable `company_currency` is assigned to but never used
erpnext/accounts/doctype/payment_request/payment_request.py:698:2: F841 Local variable `bank_account` is assigned to but never used
erpnext/accounts/doctype/payment_request/payment_request.py:699:3: F821 Undefined name `get_party_bank_account`
erpnext/accounts/doctype/payment_request/payment_request.py:702:2: F841 Local variable `draft_payment_request` is assigned to but never used
erpnext/accounts/doctype/payment_request/payment_request.py:712:5: F821 Undefined name `existing_payment_request`
erpnext/accounts/doctype/payment_request/payment_request.py:714:23: F821 Undefined name `existing_payment_request`
erpnext/accounts/doctype/payment_request/payment_request.py:716:42: F821 Undefined name `existing_payment_request`
erpnext/accounts/doctype/payment_request/payment_request.py:899:2: B028 No explicit `stacklevel` keyword argument found
erpnext/accounts/doctype/payment_request/test_payment_request.py:71:12: F821 Undefined name `make_purchase_invoice`
erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py:890:3: E999 SyntaxError: Unexpected token 'pos_inv'
erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:461:7: E721 Do not compare types, use `isinstance()`
erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.py:479:6: E721 Do not compare types, use `isinstance()`
erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:1178:21: F821 Undefined name `stock_rbnb`
erpnext/accounts/doctype/sales_invoice/sales_invoice.py:577:4: F821 Undefined name `update_coupon_code_count`
erpnext/accounts/doctype/shipping_rule/shipping_rule.py:90:10: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
erpnext/accounts/doctype/shipping_rule/shipping_rule.py:101:10: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
erpnext/accounts/doctype/subscription/subscription.py:415:1: E999 SyntaxError: Unexpected token Indent
erpnext/accounts/doctype/subscription/test_subscription.py:130:5: E999 SyntaxError: Unexpected token 'self'
erpnext/accounts/general_ledger.py:463:33: RUF015 Prefer `next(...)` over single element slice
erpnext/accounts/party.py:375:59: F821 Undefined name `down_payment`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:212:70: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:213:59: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:214:58: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:231:6: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:243:9: F821 Undefined name `details`
erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py:195:13: B007 Loop control variable `period` not used within loop body
erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py:349:13: B007 Loop control variable `period` not used within loop body
erpnext/accounts/report/general_ledger/general_ledger.py:537:6: B007 Loop control variable `key` not used within loop body
erpnext/accounts/report/general_ledger/general_ledger.py:725:5: F601 Dictionary key literal `"options"` repeated
erpnext/accounts/report/general_ledger/general_ledger.py:741:5: F601 Dictionary key literal `"options"` repeated
erpnext/accounts/report/gross_profit/gross_profit.py:497:9: B007 Loop control variable `i` not used within loop body
erpnext/accounts/report/share_balance/share_balance.py:22:59: F821 Undefined name `query_filters`
erpnext/accounts/report/share_ledger/share_ledger.py:79:3: F821 Undefined name `query`
erpnext/accounts/report/share_ledger/share_ledger.py:80:5: F821 Undefined name `share_transfer`
erpnext/accounts/report/share_ledger/share_ledger.py:81:7: F821 Undefined name `share_transfer`
erpnext/accounts/report/share_ledger/share_ledger.py:84:9: F821 Undefined name `query`
erpnext/accounts/utils.py:607:2: F841 Local variable `update_advance_paid` is assigned to but never used
erpnext/buying/doctype/supplier/supplier.py:234:2: F821 Undefined name `erpnext`
erpnext/controllers/accounts_controller.py:1220:8: UP030 Use implicit references for positional format fields
erpnext/controllers/accounts_controller.py:1237:8: UP030 Use implicit references for positional format fields
erpnext/controllers/buying_controller.py:606:8: F601 Dictionary key literal `"incoming_rate"` repeated
erpnext/controllers/tests/test_accounts_controller.py:173:76: B008 Do not perform function call `nowdate` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
erpnext/controllers/tests/test_accounts_controller.py:337:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:393:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:745:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:1023:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:1078:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_subcontracting_controller.py:563:7: B007 Loop control variable `key` not used within loop body
erpnext/controllers/tests/test_subcontracting_controller.py:573:7: B007 Loop control variable `key` not used within loop body
erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.py:13:15: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
erpnext/crm/doctype/opportunity/test_opportunity.py:15:23: F821 Undefined name `FrappeTestCase`
erpnext/manufacturing/doctype/production_plan/production_plan.py:1584:19: B007 Loop control variable `item_code` not used within loop body
erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py:90:7: B007 Loop control variable `key` not used within loop body
erpnext/projects/doctype/project/project.py:400:2: F841 Local variable `fields` is assigned to but never used
erpnext/projects/doctype/project/project.py:421:9: F821 Undefined name `get_list`
erpnext/projects/doctype/timesheet/timesheet.py:620:15: UP031 Use format specifiers instead of percent format
erpnext/projects/doctype/timesheet/timesheet.py:621:13: UP031 Use format specifiers instead of percent format
erpnext/selling/doctype/quotation/quotation.py:272:8: UP030 Use implicit references for positional format fields
erpnext/selling/doctype/quotation/quotation.py:491:5: F811 Redefinition of unused `set_expired_status` from line 361
erpnext/selling/doctype/sales_order/sales_order.py:544:8: UP008 Use `super()` instead of `super(__class__, self)`
erpnext/selling/page/sales_funnel/sales_funnel.py:103:8: B007 Loop control variable `source` not used within loop body
erpnext/selling/report/address_and_contacts/address_and_contacts.py:51:21: UP030 Use implicit references for positional format fields
erpnext/selling/report/address_and_contacts/address_and_contacts.py:55:21: UP030 Use implicit references for positional format fields
erpnext/setup/doctype/holiday_list/test_holiday_list.py:115:39: B008 Do not perform function call `getdate` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
erpnext/setup/doctype/holiday_list/test_holiday_list.py:115:79: B008 Do not perform function call `getdate` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
erpnext/setup/doctype/party_type/party_type.py:19:2: F841 Local variable `query_filter` is assigned to but never used
erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py:496:3: F841 Local variable `not_allowed` is assigned to but never used
erpnext/setup/setup_wizard/operations/company_setup.py:66:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:67:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:80:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:81:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:88:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:89:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:96:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/company_setup.py:97:20: F821 Undefined name `_`
erpnext/setup/setup_wizard/operations/taxes_setup.py:124:5: E999 SyntaxError: Unexpected token 'Create'
erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py:40:66: E711 Comparison to `None` should be `cond is None`
erpnext/stock/doctype/batch/test_batch.py:120:7: B020 Loop control variable `receipt` overrides iterable it iterates
erpnext/stock/doctype/delivery_note/test_delivery_note.py:1123:81: F821 Undefined name `packed_name`
erpnext/stock/doctype/item_variant_settings/item_variant_settings.py:10:47: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
erpnext/stock/doctype/packed_item/test_packed_item.py:183:13: B020 Loop control variable `returned` overrides iterable it iterates
erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py:2431:7: B007 Loop control variable `i` not used within loop body
erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py:2451:3: F841 Local variable `data` is assigned to but never used
erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py:918:12: B007 Loop control variable `rate` not used within loop body
erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py:925:7: B007 Loop control variable `rate` not used within loop body
erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py:954:7: B007 Loop control variable `rate` not used within loop body
erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:718:7: B007 Loop control variable `key` not used within loop body
erpnext/stock/doctype/warehouse/warehouse.py:197:9: RUF005 Consider `[*children, warehouse]` instead of concatenation
erpnext/stock/get_item_details.py:83:2: F841 Local variable `basic_details` is assigned to but never used
erpnext/stock/get_item_details.py:1498:20: E712 Comparison to `True` should be `cond is True` or `if cond:`
erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py:18:12: UP007 Use `X | Y` for type annotations
erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py:186:3: F821 Undefined name `make_subcontracted_item`
Found 162 errors (19 fixed, 143 remaining).
No fixes available (31 hidden fixes can be enabled with the `--unsafe-fixes` option).

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

error: Failed to parse erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py:890:3: Unexpected token 'pos_inv'
error: Failed to parse erpnext/accounts/doctype/subscription/subscription.py:415:1: Unexpected token Indent
error: Failed to parse erpnext/accounts/doctype/subscription/test_subscription.py:130:5: Unexpected token 'self'
error: Failed to parse erpnext/setup/setup_wizard/operations/taxes_setup.py:124:5: Unexpected token 'Create'
37 files reformatted, 522 files left unchanged


pre-commit failed for source commit: f63396ef47abc6f667f4fd3fb96c52a0a6bd218a
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1

erpnext/accounts/doctype/subscription/subscription.py: failed parsing with CPython 3.10.14:

    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/usr/local/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "erpnext/accounts/doctype/subscription/subscription.py", line 418
        				if (
        			^
    IndentationError: unexpected indent

debug statements (python)................................................Failed
- hook id: debug-statements
- exit code: 1

erpnext/accounts/doctype/subscription/subscription.py - Could not parse ast

	Traceback (most recent call last):
	  File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/debug_statement_hook.py", line 56, in check_file
	    ast_obj = ast.parse(f.read(), filename=filename)
	  File "/usr/local/lib/python3.10/ast.py", line 50, in parse
	    return compile(source, filename, mode, flags,
	  File "erpnext/accounts/doctype/subscription/subscription.py", line 418
	    				if (
	    			^
	IndentationError: unexpected indent

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

error: Failed to parse erpnext/accounts/doctype/subscription/subscription.py:418:1: Unexpected token Indent
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:285:24: F821 Undefined name `to_remove`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:290:26: F821 Undefined name `get_unreconciled_amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:430:2: F841 Local variable `gles` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:430:9: F821 Undefined name `get_related_bank_gl_entries`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:431:2: F841 Local variable `bt_allocations` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:431:19: F821 Undefined name `get_total_allocated_amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:433:2: F841 Local variable `unallocated_amount` is assigned to but never used
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:517:27: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:518:32: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:519:31: F821 Undefined name `amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:520:35: F821 Undefined name `amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:524:6: F821 Undefined name `amount`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:527:28: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:532:30: F821 Undefined name `bank_account`
erpnext/accounts/doctype/bank_transaction/bank_transaction.py:539:5: F811 Redefinition of unused `get_doctypes_for_bank_reconciliation` from line 417
erpnext/accounts/doctype/subscription/subscription.py:418:1: E999 SyntaxError: Unexpected token Indent
erpnext/accounts/report/general_ledger/general_ledger.py:722:5: F601 Dictionary key literal `"options"` repeated
erpnext/accounts/report/general_ledger/general_ledger.py:738:5: F601 Dictionary key literal `"options"` repeated
erpnext/controllers/tests/test_accounts_controller.py:343:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:399:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:751:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:1029:3: F821 Undefined name `change_settings`
erpnext/controllers/tests/test_accounts_controller.py:1084:3: F821 Undefined name `change_settings`
Found 23 errors.
No fixes available (5 hidden fixes can be enabled with the `--unsafe-fixes` option).

Format Python code.......................................................Failed
- hook id: ruff-format
- exit code: 2

error: Failed to parse erpnext/accounts/doctype/subscription/subscription.py:418:1: Unexpected token Indent
30 files left unchanged


Conflicts detected for source commit: 89b5e061af014236bee2e259c88c832b845fdc3b
- DU .github/workflows/patch.yml
- DU .github/workflows/server-tests-mariadb.yml
- DU .github/workflows/server-tests-postgres.yml
Cleaning files from denylist:
 .github/workflows/patch.yml                 | 160 ++++++++++++++++++++++++++++
 .github/workflows/server-tests-mariadb.yml  | 158 +++++++++++++++++++++++++++
 .github/workflows/server-tests-postgres.yml | 112 +++++++++++++++++++
 3 files changed, 430 insertions(+)


Conflicts detected for source commit: a4dd1c2bf6dedebcd2bcc271b34901e54608538c
- DU .github/helper/documentation.py
- DU .github/helper/translation.py
- DU .github/workflows/patch.yml
- DU .github/workflows/server-tests-mariadb.yml
- DU .github/workflows/server-tests-postgres.yml
Cleaning files from denylist:
 .github/helper/documentation.py             |  64 +++++++++++
 .github/helper/translation.py               |  68 ++++++++++++
 .github/workflows/patch.yml                 | 160 ++++++++++++++++++++++++++++
 .github/workflows/server-tests-mariadb.yml  | 158 +++++++++++++++++++++++++++
 .github/workflows/server-tests-postgres.yml | 112 +++++++++++++++++++
 5 files changed, 562 insertions(+)


pre-commit failed for source commit: a4dd1c2bf6dedebcd2bcc271b34901e54608538c
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1

erpnext/accounts/doctype/subscription/test_subscription.py: failed parsing with CPython 3.10.14:

    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/usr/local/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "erpnext/accounts/doctype/subscription/test_subscription.py", line 125
        			flt(
        			   ^
    SyntaxError: '(' was never closed

debug statements (python)................................................Failed
- hook id: debug-statements
- exit code: 1

erpnext/accounts/doctype/subscription/test_subscription.py - Could not parse ast

	Traceback (most recent call last):
	  File "/root/.cache/pre-commit/repo6ikslg24/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/debug_statement_hook.py", line 56, in check_file
	    ast_obj = ast.parse(f.read(), filename=filename)
	  File "/usr/local/lib/python3.10/ast.py", line 50, in parse
	    return compile(source, filename, mode, flags,
	  File "erpnext/accounts/doctype/subscription/test_subscription.py", line 125
	    			flt(
	    			   ^
	SyntaxError: '(' was never closed

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

error: Failed to parse erpnext/accounts/doctype/subscription/test_subscription.py:130:5: Unexpected token 'self'
erpnext/accounts/doctype/subscription/test_subscription.py:130:5: E999 SyntaxError: Unexpected token 'self'
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:212:70: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:213:59: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:214:58: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:231:6: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:243:9: F821 Undefined name `details`
erpnext/accounts/report/budget_variance_report/budget_variance_report.py:300:6: F821 Undefined name `account_condition`
erpnext/selling/doctype/sales_order/sales_order.py:537:8: UP008 Use `super()` instead of `super(__class__, self)`
Found 8 errors.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

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

error: Failed to parse erpnext/accounts/doctype/subscription/test_subscription.py:130:5: Unexpected token 'self'
1 file reformatted, 4 files left unchanged


Suspicious merge commit detected: a4dd1c2bf6dedebcd2bcc271b34901e54608538c


Suspicious changes found (dokos|telemetry|shipping_rule|capture_doc):
  53a58dc4b40816d85a5188eda914186521c7e355 Merge pull request #40681 from barredterra/ruff
  40083c2c8c2aae913488c866fd4f9b69807d9d60 refactor(treewide): formatting and ruff fixes, + manually enabled F401



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

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

# 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