-
-
Notifications
You must be signed in to change notification settings - Fork 18.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
DOC: Patch new flake8 command grep #15749
Conversation
The grep was initially matching to "pandas," which is incorrect because that was also matching files containing "pandas" in the name but that were not in the main pandas directory (e.g. performance test code) Follow-up to pandas-devgh-15712 [ci skip]
@@ -527,7 +527,7 @@ unused function. However, style-checking the diff will not catch this because | |||
the actual import is not part of the diff. Thus, for completeness, you should | |||
run this command, though it will take longer:: | |||
|
|||
git diff master --name-only -- '*.py' | grep 'pandas' | xargs -r flake8 | |||
git diff master --name-only -- '*.py' | grep 'pandas/' | xargs -r flake8 |
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.
not sure if its worth noting but need to remove the -r
on osx :<
otherwise this command looks good to me (I use it!)
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.
Awesome! But how do you tell xargs
to abort the command if the list is empty on OSX? That's the whole reason why I have the -r
flag there.
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.
it just works
(pandas) bash-3.2$ git diff master --name-only -- '*.py' | grep 'pandas/' | xargs -r flake8
xargs: illegal option -- r
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
[-L number] [-n number [-x]] [-P maxprocs] [-s size]
[utility [argument ...]]
(pandas) bash-3.2$ git diff master --name-only -- '*.py' | grep 'pandas/' | xargs flake8
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.
Oh, interesting. I did not realize it just aborts like that. Okay, then I'll mention that in the docs.
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.
@jreback : Made doc patch regarding OSX compatibility with xargs
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.
what does -r
do anyhow?
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.
On Linux, it means "abort immediately if list is empty." Without that flag, I end up style-checking all Python files in the pandas
repository.
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.
oh I c, ok then.
OSX xargs has no -r, but it still terminates when xargs is empty, which was the whole point of passing in that flag in the first place. [ci skip]
0ea390d
to
d1543b5
Compare
thanks! |
The grep was initially matching to "pandas," which is incorrect because that was also matching files containing "pandas" in the name but that were not in the main `pandas` directory (e.g. performance test code). This change enforces that we match to any Python files in the main `pandas` directory. Also picked up compatibility issue with OSX, in which the `-r` flag does not exist. However, `xargs` terminates if the argument list is empty, which was the whole point of passing in `-r` in the first place. Follow-up to pandas-dev#15712 Author: gfyoung <[email protected]> Closes pandas-dev#15749 from gfyoung/flake8-diff-patch and squashes the following commits: d1543b5 [gfyoung] COMPAT: Do not run xargs with -r on OSX da57857 [gfyoung] DOC: Patch new flake8 command grep
The grep was initially matching to "pandas," which is incorrect because that was also matching files containing "pandas" in the name but that were not in the main `pandas` directory (e.g. performance test code). This change enforces that we match to any Python files in the main `pandas` directory. Also picked up compatibility issue with OSX, in which the `-r` flag does not exist. However, `xargs` terminates if the argument list is empty, which was the whole point of passing in `-r` in the first place. Follow-up to pandas-dev#15712 Author: gfyoung <[email protected]> Closes pandas-dev#15749 from gfyoung/flake8-diff-patch and squashes the following commits: d1543b5 [gfyoung] COMPAT: Do not run xargs with -r on OSX da57857 [gfyoung] DOC: Patch new flake8 command grep
The grep was initially matching to "pandas," which is incorrect because that was also matching files containing "pandas" in the name but that were not in the main
pandas
directory (e.g. performance test code). This change enforces that we match to any Python files in the mainpandas
directory.Also picked up compatibility issue with OSX, in which the
-r
flag does not exist. However,xargs
terminates if the argument list is empty, which was the whole point of passing in-r
in the first place.Follow-up to #15712