-
Notifications
You must be signed in to change notification settings - Fork 501
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
[dev] restrict pylint to changed files #4184
Conversation
|
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.
Thanks @cg505!
format.sh
Outdated
@@ -77,7 +81,7 @@ format_changed() { | |||
MERGEBASE="$(git merge-base origin/master HEAD)" | |||
|
|||
if ! git diff --diff-filter=ACM --quiet --exit-code "$MERGEBASE" -- '*.py' '*.pyi' &>/dev/null; then | |||
git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.py' '*.pyi' | xargs -P 5 \ | |||
git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.py' '*.pyi' | xargs -P 5 -d '\n' \ |
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.
Looks like -d
is not available on mac:
xargs: invalid option -- d
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements] [-S replsize]]
[-J replstr] [-L number] [-n number [-x]] [-P maxprocs]
[-s size] [utility [argument ...]]
Any other fix than having all macos users install gnu xargs? https://superuser.com/questions/467176/replacement-for-xargs-d-in-osx
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.
Thanks for the catch! This only matters if there are filenames with spaces, which we probably don't expect but should still handle.
I think we can use tr '\n' '\0' | xargs -0
instead. Will update.
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.
Thanks @cg505! Excited that pylint is much faster now :)
* [dev] restrict pylint to changed files * fix glob * avoid use of xargs -d
Use a similar approach to what we do with yapf to limit pylint to only files that have changed from master.
On my machine this shaves about a minute off pylint runtime, making pylint 7-8x faster and format.sh 3-4x faster.
Tested (run the relevant ones):
bash format.sh
:)pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
conda deactivate; bash -i tests/backward_compatibility_tests.sh