[PATCH evolve-ext] checks: correct the shebang line filtering for python files

Ryan McElroy rm at fb.com
Tue Mar 21 13:47:03 EDT 2017


On 3/17/17 1:38 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1489713417 14400
> #      Thu Mar 16 21:16:57 2017 -0400
> # Node ID 6a3248558b6929378450b572bb27406afe703ffd
> # Parent  e9d5f54765a27e09d35f48dda23db7e6f5b8320a
> checks: correct the shebang line filtering for python files
>
> As it is, the only related file is docs/test2rst.py, which was covered by **.py.
> Not sure if it matters, but most patterns in core tests are for "#!.*?python".
> (Though there are a couple "#!.*python" tests.)
>
> diff --git a/tests/test-check-flake8.t b/tests/test-check-flake8.t
> --- a/tests/test-check-flake8.t
> +++ b/tests/test-check-flake8.t
> @@ -14,5 +14,5 @@
>   
>   run flake8 if it exists; if it doesn't, then just skip
>   
> -  $ hg files -0 'set:(**.py or grep("^!#.*python")) - removed()' 2>/dev/null \
> +  $ hg files -0 'set:(**.py or grep("^#!.*python")) - removed()' 2>/dev/null \

This looks obviously correct to me. I wouldn't mind a test that prevents 
regressions here but I don't think it's a blocker.

>     > | xargs -0 flake8
> diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
> --- a/tests/test-check-pyflakes.t
> +++ b/tests/test-check-pyflakes.t
> @@ -7,5 +7,5 @@
>   run pyflakes on all tracked files ending in .py or without a file ending
>   (skipping binary file random-seed)
This comment looks out of date? Can you update it?
>   
> -  $ hg locate 'set:(**.py or grep("^!#.*python")) - removed()' 2>/dev/null \
> +  $ hg locate 'set:(**.py or grep("^#!.*python")) - removed()' 2>/dev/null \
>     > | xargs pyflakes 2>/dev/null



More information about the Mercurial-devel mailing list