Patchwork [01,of,16] checkcode: only match pushd/popd as word

login
register
mail settings
Submitter Pierre-Yves David
Date April 10, 2017, 3:19 p.m.
Message ID <f45dcc85f9947b29109e.1491837577@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20053/
State Accepted
Headers show

Comments

Pierre-Yves David - April 10, 2017, 3:19 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1491836754 -7200
#      Mon Apr 10 17:05:54 2017 +0200
# Node ID f45dcc85f9947b29109e27a20853a531be86f8dc
# Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
# EXP-Topic exchange.obsmarkers
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r f45dcc85f994
checkcode: only match pushd/popd as word

otherwise it partially match common words like "pushdestination".
Pierre-Yves David - April 10, 2017, 3:23 p.m.
There are 8 others tests case that I'll send after this series is in, 
one call pull them from my wip repo:

    hg pull --rev 847616b4cf07 
https://www.mercurial-scm.org/repo/users/marmoute/mercurial

After that, I'll have 17 other test cases the lives in the evolve 
extension around the computation of heads replacement (issue4354).
They will unlock the move in the core the modern code that fix issue4354.

On 04/10/2017 05:19 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1491836754 -7200
> #      Mon Apr 10 17:05:54 2017 +0200
> # Node ID f45dcc85f9947b29109e27a20853a531be86f8dc
> # Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
> # EXP-Topic exchange.obsmarkers
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r f45dcc85f994
> checkcode: only match pushd/popd as word
>
> otherwise it partially match common words like "pushdestination".
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -100,7 +100,7 @@ def rephere(m):
>
>  testpats = [
>    [
> -    (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
> +    (r'\b(push|pop)d\b', "don't use 'pushd' or 'popd', use 'cd'"),
>      (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
>      (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
>      (r'(?<!hg )grep.* -a', "don't use 'grep -a', use in-line python"),
>
Augie Fackler - April 11, 2017, 3:01 p.m.
On Mon, Apr 10, 2017 at 05:19:37PM +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1491836754 -7200
> #      Mon Apr 10 17:05:54 2017 +0200
> # Node ID f45dcc85f9947b29109e27a20853a531be86f8dc
> # Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
> # EXP-Topic exchange.obsmarkers
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r f45dcc85f994
> checkcode: only match pushd/popd as word

I've taken this one, but will have to come back to the others later.

>
> otherwise it partially match common words like "pushdestination".
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -100,7 +100,7 @@ def rephere(m):
>
>  testpats = [
>    [
> -    (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
> +    (r'\b(push|pop)d\b', "don't use 'pushd' or 'popd', use 'cd'"),
>      (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
>      (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
>      (r'(?<!hg )grep.* -a', "don't use 'grep -a', use in-line python"),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -100,7 +100,7 @@  def rephere(m):
 
 testpats = [
   [
-    (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
+    (r'\b(push|pop)d\b', "don't use 'pushd' or 'popd', use 'cd'"),
     (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
     (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
     (r'(?<!hg )grep.* -a', "don't use 'grep -a', use in-line python"),