[PATCH 4 of 4] check-code: enforce strict spacing around assignment
timeless
timeless at mozdev.org
Tue Jan 5 06:08:14 UTC 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1451583719 0
# Thu Dec 31 17:41:59 2015 +0000
# Node ID d79fdb59e716fdc331c609c146a21c2b72e2f5c1
# Parent d4e2ca0825a567586a461f67b0190611190f9ceb
check-code: enforce strict spacing around assignment
diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -127,6 +127,7 @@
(r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
(r'\butil\.Abort\b', "directly use error.Abort"),
(r'\|&', "don't use |&, use 2>&1"),
+ (r'\w = +\w', "only one space after = allowed"),
],
# warnings
[
@@ -220,6 +221,7 @@
(r'(\w|\)),\w', "missing whitespace after ,"),
(r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
(r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
+ (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
(r'.{81}', "line too long"),
(r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
(r'[^\n]\Z', "no trailing newline"),
@@ -337,6 +339,7 @@
(r'\w+ (\+\+|--)', "use foo++, not foo ++"),
(r'\w,\w', "missing whitespace after ,"),
(r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
+ (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
(r'^#\s+\w', "use #foo, not # foo"),
(r'[^\n]\Z', "no trailing newline"),
(r'^\s*#import\b', "use only #include in standard C code"),
More information about the Mercurial-devel
mailing list