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

login
register
mail settings
Submitter Matt Harbison
Date March 17, 2017, 1:38 a.m.
Message ID <6a3248558b6929378450.1489714720@Envy>
Download mbox | patch
Permalink /patch/19412/
State Changes Requested
Headers show

Comments

Matt Harbison - March 17, 2017, 1:38 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.)
Ryan McElroy - March 21, 2017, 5:47 p.m.
On 3/17/17 1:38 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@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
Pierre-Yves David - March 23, 2017, 7:14 a.m.
On 03/21/2017 06:47 PM, Ryan McElroy wrote:
> On 3/17/17 1:38 AM, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@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

Pushed, thanks.

Patch

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 \
   > | 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)
 
-  $ 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