-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add try..except block in pre-commit linter #6019
Add try..except block in pre-commit linter #6019
Conversation
Add try..except block to handle the case when there are no Python, JavaScript or CSS files to lint.
scripts/pre_commit_linter.py
Outdated
TIMEOUT_MULTIPLIER * len(file_group) / number_of_files_to_lint)) | ||
|
||
# try..except block is needed to catch ZeroDivisionError | ||
# when there are no Python, JavaScript or CSS files to lint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also count HTML files, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, yes, we include the HTML files to check for the CSS part. Let me modify the comment here then. Thanks!
Codecov Report
@@ Coverage Diff @@
## develop #6019 +/- ##
=======================================
Coverage 45.3% 45.3%
=======================================
Files 520 520
Lines 30667 30667
Branches 4597 4597
=======================================
Hits 13893 13893
Misses 16774 16774 Continue to review full report at Codecov.
|
scripts/pre_commit_linter.py
Outdated
@@ -739,8 +739,14 @@ def _pre_commit_linter(all_files): | |||
for file_group, process in zip(file_groups_to_lint, linting_processes): | |||
# Require timeout parameter to prevent against endless waiting for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably move this comment inside the try block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
Thanks, @nithusha21! Hi @BenHenning, can you please approve this as a code owner? Thanks! |
Add try..except block to handle the case when
there are no Python, JavaScript or CSS files to lint.
Explanation
Checklist
python scripts/pre_commit_linter.py
andbash scripts/run_frontend_tests.sh
.