Skip to content

DOC: Patch new flake8 command grep #15749

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,12 @@ 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
Copy link
Contributor

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!)

Copy link
Member Author

@gfyoung gfyoung Mar 20, 2017

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.

Copy link
Contributor

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

Copy link
Member Author

@gfyoung gfyoung Mar 20, 2017

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.

Copy link
Member Author

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

Copy link
Contributor

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?

Copy link
Member Author

@gfyoung gfyoung Mar 20, 2017

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.

Copy link
Contributor

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.


Note that on OSX, the ``-r`` flag is not available, so you have to omit it and
run this slightly modified command::

git diff master --name-only -- '*.py' | grep 'pandas/' | xargs flake8

Backwards Compatibility
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down