Autofix both black and isort

This commit is contained in:
Mikhail f. Shiryaev 2024-09-26 23:42:26 +02:00
parent d396ec3310
commit bed8a9ae07
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -214,13 +214,13 @@ def main():
state, description, test_results, additional_files = process_result(temp_path) state, description, test_results, additional_files = process_result(temp_path)
autofix_description = "" autofix_description = ""
fail_cnt = 0 push_fix = args.push
for result in test_results: for result in test_results:
if result.status in (FAILURE, FAIL): if result.status in (FAILURE, FAIL) and push_fix:
# do not autofix if not only black failed # do not autofix if something besides isort and black is failed
fail_cnt += 1 push_fix = any(result.name.endswith(check) for check in ("isort", "black"))
if args.push and fail_cnt == 1: if push_fix:
try: try:
commit_push_staged(pr_info) commit_push_staged(pr_info)
except subprocess.SubprocessError: except subprocess.SubprocessError: