Patchwork D5995: contrib: enforce wrapping too-long lines with () instead of \

login
register
mail settings
Submitter phabricator
Date Feb. 21, 2019, 9:29 p.m.
Message ID <4618ecd374bb3f6a0b20fcfc89fc8935@localhost.localdomain>
Download mbox | patch
Permalink /patch/38861/
State Not Applicable
Headers show

Comments

phabricator - Feb. 21, 2019, 9:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe2472b12c842: contrib: enforce wrapping too-long lines with () instead of \ (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5995?vs=14165&id=14180

REVISION DETAIL
  https://phab.mercurial-scm.org/D5995

AFFECTED FILES
  contrib/check-code.py
  tests/test-contrib-check-code.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-contrib-check-code.t b/tests/test-contrib-check-code.t
--- a/tests/test-contrib-check-code.t
+++ b/tests/test-contrib-check-code.t
@@ -7,6 +7,9 @@ 
   > def toto( arg1, arg2):
   >     del(arg2)
   >     return ( 5+6, 9)
+  > def badwrap():
+  >     return 1 + \\
+  >        2
   > NO_CHECK_EOF
   $ cat > quote.py <<NO_CHECK_EOF
   > # let's use quote in comments
@@ -42,6 +45,9 @@ 
    >     return ( 5+6, 9)
    gratuitous whitespace in () or []
    missing whitespace in expression
+  ./wrong.py:5:
+   >     return 1 + \
+   Use () to wrap long lines in Python, not \
   ./quote.py:5:
    > '"""', 42+1, """and
    missing whitespace in expression
diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -233,6 +233,7 @@ 
 
 pypats = [
   [
+    (r'\\$', 'Use () to wrap long lines in Python, not \\'),
     (r'^\s*def\s*\w+\s*\(.*,\s*\(',
      "tuple parameter unpacking not available in Python 3+"),
     (r'lambda\s*\(.*,.*\)',