Patchwork [4,of,4] check-code: detect and ban 'util.Abort'

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 8, 2015, 7:56 p.m.
Message ID <3e81cd0e0e8705f5b243.1444334175@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10892/
State Accepted
Commit b3f7516fa50ef4bd6080bc7a7ce715373933872a
Headers show

Comments

Pierre-Yves David - Oct. 8, 2015, 7:56 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1444333989 25200
#      Thu Oct 08 12:53:09 2015 -0700
# Node ID 3e81cd0e0e8705f5b243ef24829638684b135929
# Parent  e7caec61599aa3f169741ea98950b10c4808f6c9
check-code: detect and ban 'util.Abort'

We have seen the light, please use the new way.
Augie Fackler - Oct. 9, 2015, 3:04 p.m.
On Thu, Oct 08, 2015 at 12:56:15PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1444333989 25200
> #      Thu Oct 08 12:53:09 2015 -0700
> # Node ID 3e81cd0e0e8705f5b243ef24829638684b135929
> # Parent  e7caec61599aa3f169741ea98950b10c4808f6c9
> check-code: detect and ban 'util.Abort'

I'm unable to apply these, as it looks like patch 3 got damaged
in-flight. Can you give me a pull URL?

>
> We have seen the light, please use the new way.
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -121,11 +121,12 @@ testpats = [
>      (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
>      (r'^( *)\t', "don't use tabs to indent"),
>      (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
>       "put a backslash-escaped newline after sed 'i' command"),
>      (r'^diff *-\w*u.*$\n(^  \$ |^$)', "prefix diff -u with cmp"),
> -    (r'seq ', "don't use 'seq', use $TESTDIR/seq.py")
> +    (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
> +    (r'\butil.Abort\b', "directly use error.Abort"),
>    ],
>    # warnings
>    [
>      (r'^function', "don't use 'function', use old style"),
>      (r'^diff.*-\w*N', "don't use 'diff -N'"),
> @@ -291,10 +292,11 @@ pypats = [
>      (r'os\.path\.join\(.*, *(""|\'\')\)',
>       "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
>      (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
>      # XXX only catch mutable arguments on the first line of the definition
>      (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
> +    (r'\butil.Abort\b', "directly use error.Abort"),
>    ],
>    # warnings
>    [
>      (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"),
>    ]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Yuya Nishihara - Oct. 9, 2015, 3:07 p.m.
On Thu, 08 Oct 2015 12:56:15 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1444333989 25200
> #      Thu Oct 08 12:53:09 2015 -0700
> # Node ID 3e81cd0e0e8705f5b243ef24829638684b135929
> # Parent  e7caec61599aa3f169741ea98950b10c4808f6c9
> check-code: detect and ban 'util.Abort'
> 
> We have seen the light, please use the new way.
> 
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -121,11 +121,12 @@ testpats = [
>      (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
>      (r'^( *)\t', "don't use tabs to indent"),
>      (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
>       "put a backslash-escaped newline after sed 'i' command"),
>      (r'^diff *-\w*u.*$\n(^  \$ |^$)', "prefix diff -u with cmp"),
> -    (r'seq ', "don't use 'seq', use $TESTDIR/seq.py")
> +    (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
> +    (r'\butil.Abort\b', "directly use error.Abort"),
>    ],
>    # warnings
>    [
>      (r'^function', "don't use 'function', use old style"),
>      (r'^diff.*-\w*N', "don't use 'diff -N'"),
> @@ -291,10 +292,11 @@ pypats = [
>      (r'os\.path\.join\(.*, *(""|\'\')\)',
>       "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
>      (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
>      # XXX only catch mutable arguments on the first line of the definition
>      (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
> +    (r'\butil.Abort\b', "directly use error.Abort"),

Missing \ before dot.
Pierre-Yves David - Oct. 9, 2015, 5:44 p.m.
On 10/09/2015 08:04 AM, Augie Fackler wrote:
> On Thu, Oct 08, 2015 at 12:56:15PM -0700, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1444333989 25200
>> #      Thu Oct 08 12:53:09 2015 -0700
>> # Node ID 3e81cd0e0e8705f5b243ef24829638684b135929
>> # Parent  e7caec61599aa3f169741ea98950b10c4808f6c9
>> check-code: detect and ban 'util.Abort'
>
> I'm unable to apply these, as it looks like patch 3 got damaged
> in-flight. Can you give me a pull URL?

patch3 is touching +100 files and bit-rote quickly. Should I just rebase 
and push them to the clowncopter?
Augie Fackler - Oct. 9, 2015, 5:46 p.m.
> On Oct 9, 2015, at 13:44, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> 
> 
> 
> On 10/09/2015 08:04 AM, Augie Fackler wrote:
>> On Thu, Oct 08, 2015 at 12:56:15PM -0700, Pierre-Yves David wrote:
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>>> # Date 1444333989 25200
>>> #      Thu Oct 08 12:53:09 2015 -0700
>>> # Node ID 3e81cd0e0e8705f5b243ef24829638684b135929
>>> # Parent  e7caec61599aa3f169741ea98950b10c4808f6c9
>>> check-code: detect and ban 'util.Abort'
>> 
>> I'm unable to apply these, as it looks like patch 3 got damaged
>> in-flight. Can you give me a pull URL?
> 
> patch3 is touching +100 files and bit-rote quickly. Should I just rebase and push them to the clowncopter?

Sure.


> -- 
> Pierre-Yves David

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -121,11 +121,12 @@  testpats = [
     (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
     (r'^( *)\t', "don't use tabs to indent"),
     (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
      "put a backslash-escaped newline after sed 'i' command"),
     (r'^diff *-\w*u.*$\n(^  \$ |^$)', "prefix diff -u with cmp"),
-    (r'seq ', "don't use 'seq', use $TESTDIR/seq.py")
+    (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
+    (r'\butil.Abort\b', "directly use error.Abort"),
   ],
   # warnings
   [
     (r'^function', "don't use 'function', use old style"),
     (r'^diff.*-\w*N', "don't use 'diff -N'"),
@@ -291,10 +292,11 @@  pypats = [
     (r'os\.path\.join\(.*, *(""|\'\')\)',
      "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
     (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
     # XXX only catch mutable arguments on the first line of the definition
     (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
+    (r'\butil.Abort\b', "directly use error.Abort"),
   ],
   # warnings
   [
     (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"),
   ]