From 5bcf75087eda4a08eab850d1f921deb9be4944e9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 15 Nov 2018 20:06:58 +0100 Subject: [PATCH 1/5] DOC: more consistent flake8-commands in contributing.rst --- doc/source/contributing.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index b44bd1cfd9007..9667c82d6a94f 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -575,7 +575,7 @@ the `flake8 `_ tool and report any stylistic errors in your code. Therefore, it is helpful before submitting code to run the check yourself on the diff:: - git diff master -u -- "*.py" | flake8 --diff + git diff upstream/master -u -- "pandas/*.py" | flake8 --diff This command will catch any stylistic errors in your changes specifically, but be beware it may not catch all of them. For example, if you delete the only @@ -584,21 +584,22 @@ 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 upstream/master --name-only -- "pandas/*.py" | xargs -r flake8 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 + git diff upstream/master --name-only -- "pandas/*.py" | xargs flake8 -Windows does not support the ``grep`` and ``xargs`` commands (unless installed -for example via the `MinGW `__ toolchain), but one can -imitate the behaviour as follows:: +Windows does not support the ``xargs`` command (unless installed for example +via the `MinGW `__ toolchain), but one can imitate the +behaviour as follows:: - for /f %i in ('git diff upstream/master --name-only ^| findstr pandas/') do flake8 %i + for /f %i in ('git diff upstream/master --name-only -- "pandas/*.py"') do flake8 %i -This will also get all the files being changed by the PR (and within the -``pandas/`` folder), and run ``flake8`` on them one after the other. +This will get all the files being changed by the PR (with are also within the +``pandas/`` folder and ending with ``.py``), and run ``flake8`` on them, +one after the other. .. _contributing.import-formatting: From c9c64dd7ae2353fc9820ab47b3306f649af0741d Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 15 Nov 2018 20:13:17 +0100 Subject: [PATCH 2/5] Typo --- doc/source/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 9667c82d6a94f..d72422bcbe43e 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -597,7 +597,7 @@ behaviour as follows:: for /f %i in ('git diff upstream/master --name-only -- "pandas/*.py"') do flake8 %i -This will get all the files being changed by the PR (with are also within the +This will get all the files being changed by the PR (which are also within the ``pandas/`` folder and ending with ``.py``), and run ``flake8`` on them, one after the other. From 87f2edbdb99dab92be3eac9afc90d165c16fcfc3 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 16 Nov 2018 02:18:50 +0100 Subject: [PATCH 3/5] Review (datapythonista) --- doc/source/contributing.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index d72422bcbe43e..9b886ab7c2f15 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -575,7 +575,7 @@ the `flake8 `_ tool and report any stylistic errors in your code. Therefore, it is helpful before submitting code to run the check yourself on the diff:: - git diff upstream/master -u -- "pandas/*.py" | flake8 --diff + git diff upstream/master -u -- "*.py" | flake8 --diff This command will catch any stylistic errors in your changes specifically, but be beware it may not catch all of them. For example, if you delete the only @@ -584,22 +584,21 @@ 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 upstream/master --name-only -- "pandas/*.py" | xargs -r flake8 + git diff upstream/master --name-only -- "*.py" | xargs -r flake8 Note that on OSX, the ``-r`` flag is not available, so you have to omit it and run this slightly modified command:: - git diff upstream/master --name-only -- "pandas/*.py" | xargs flake8 + git diff upstream/master --name-only -- ".py" | xargs flake8 Windows does not support the ``xargs`` command (unless installed for example via the `MinGW `__ toolchain), but one can imitate the behaviour as follows:: - for /f %i in ('git diff upstream/master --name-only -- "pandas/*.py"') do flake8 %i + for /f %i in ('git diff upstream/master --name-only -- "*.py"') do flake8 %i -This will get all the files being changed by the PR (which are also within the -``pandas/`` folder and ending with ``.py``), and run ``flake8`` on them, -one after the other. +This will get all the files being changed by the PR (and ending with ``.py``), +and run ``flake8`` on them, one after the other. .. _contributing.import-formatting: From 3d0a2f579fc120443c5edc783ac1bba790e5ad3b Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 16 Nov 2018 07:41:09 +0100 Subject: [PATCH 4/5] Typo --- doc/source/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 9b886ab7c2f15..6fdb5bdbb6b1d 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -589,7 +589,7 @@ run this command, though it will take longer:: Note that on OSX, the ``-r`` flag is not available, so you have to omit it and run this slightly modified command:: - git diff upstream/master --name-only -- ".py" | xargs flake8 + git diff upstream/master --name-only -- "*.py" | xargs flake8 Windows does not support the ``xargs`` command (unless installed for example via the `MinGW `__ toolchain), but one can imitate the From 54cbc299ff94e328e23b3a7206669308ad764b2a Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Mon, 19 Nov 2018 07:37:43 +0100 Subject: [PATCH 5/5] Also harmonize makefile lint-diff --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4a4aca21e1b78..d2bd067950fd0 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ build: clean_pyc python setup.py build_ext --inplace lint-diff: - git diff master --name-only -- "*.py" | grep -E "pandas|scripts" | xargs flake8 + git diff upstream/master --name-only -- "*.py" | xargs flake8 develop: build -python setup.py develop