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

Augie Fackler raf at durin42.com
Fri Oct 9 10:04:23 CDT 2015


On Thu, Oct 08, 2015 at 12:56:15PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at 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 at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list