diff contrib/check-code.py @ 16965:91284af53508

test-alias: adapt for Windows The test used 'echo' to test '!' style aliases. On Windows 'echo' is handled by cmd and thus behaves very differently from the 'normal' echo command. The simple workaround used here for using the same alias on all platforms is to use 'printf' instead. Msys 'printf' will also handle sh quoting and escaping in cmd. Environment variable expansion with sh syntax is handled by launching sh.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 16 Jun 2012 21:57:42 +0200
parents c2d9ef43ff6c
children bddf1220d7a2
line wrap: on
line diff
--- a/contrib/check-code.py	Fri Jun 15 21:42:47 2012 +0200
+++ b/contrib/check-code.py	Sat Jun 16 21:57:42 2012 +0200
@@ -47,7 +47,7 @@
     (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
     (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
     (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
-    (r'echo.*\\n', "don't use 'echo \\n', use printf"),
+    (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"),
     (r'echo -n', "don't use 'echo -n', use printf"),
     (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
     (r'head -c', "don't use 'head -c', use 'dd'"),