[ci] chore: update pre-commit scripts#1562
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the pre-commit scripts, modernizing the toolchain and adding several new custom checks to improve code quality and maintainability. The changes are generally positive, replacing older tools like yapf and isort with ruff, and codespell with typos. I've found one issue in a new script that appears to be incomplete and non-functional.
| with open(input_file) as f: | ||
| lines = f.readlines() | ||
|
|
||
| skip_next = False | ||
|
|
||
| for line in lines: | ||
| if skip_next: | ||
| if line.startswith((" ", "\t")) or line.strip() == "": | ||
| continue | ||
| skip_next = False | ||
|
|
||
| if any(k in line.lower() for k in white_list): | ||
| skip_next = True | ||
| continue |
There was a problem hiding this comment.
This script reads from input_file but never writes to output_file, making it non-functional. The logic to filter out packages from the white_list is present, but the filtered lines are not written to any file. Additionally, the docstring mentions splitting content into two files, but there is no logic for the second file (torch_nightly_test.txt). The script needs to be updated to write the processed lines to the output file to be functional.
| with open(input_file) as f: | |
| lines = f.readlines() | |
| skip_next = False | |
| for line in lines: | |
| if skip_next: | |
| if line.startswith((" ", "\t")) or line.strip() == "": | |
| continue | |
| skip_next = False | |
| if any(k in line.lower() for k in white_list): | |
| skip_next = True | |
| continue | |
| with open(input_file) as f, open(output_file, "w") as out_f: | |
| lines = f.readlines() | |
| skip_next = False | |
| for line in lines: | |
| if skip_next: | |
| if line.startswith((" ", "\t")) or line.strip() == "": | |
| continue | |
| skip_next = False | |
| if any(k in line.lower() for k in white_list): | |
| skip_next = True | |
| continue | |
| out_f.write(line) |
No description provided.