summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-10-25 10:37:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-10-25 10:37:51 +0000
commit8a6d1c8da3cb14e004ce863a861cf1fc5490a7f0 (patch)
tree720ccb49d51cabdcbd51e6779de12b3a2cee9fe2
parentfc6f2bfca5695bd36bedbb10d782fcb28a7492e6 (diff)
downloadperl_checker-8a6d1c8da3cb14e004ce863a861cf1fc5490a7f0.tar
perl_checker-8a6d1c8da3cb14e004ce863a861cf1fc5490a7f0.tar.gz
perl_checker-8a6d1c8da3cb14e004ce863a861cf1fc5490a7f0.tar.bz2
perl_checker-8a6d1c8da3cb14e004ce863a861cf1fc5490a7f0.tar.xz
perl_checker-8a6d1c8da3cb14e004ce863a861cf1fc5490a7f0.zip
detect "cond ? $v1 = XX1 : $v2 = XX2" error
-rwxr-xr-xperl_checker3
1 files changed, 3 insertions, 0 deletions
diff --git a/perl_checker b/perl_checker
index 12cf3a2..1785269 100755
--- a/perl_checker
+++ b/perl_checker
@@ -70,6 +70,9 @@ if (/\bsub\b\s*\{[^{}]*\$_(?!\[)/) {
if ((my ($op) = /([<>]{2})/) && (/[+-]\s*[\w\$]+\s*[<>]{2}/ || /[<>]{2}\s*[\w\$]+\s*[+-]/) && !/\<\<[A-Z]/) { # don't warn for here-document alike
err(qq(parentheses needed around operator $op), info());
}
+if (/=.*:\s*\$\w+\s*=/) {
+ err(q(do not use ``cond ? $v1 = XX1 : $v2 = XX2'' which is parted as ``(cond ? $v1 = XX1 : $v2) = XX2''), info());
+}
if (/^\s*package ([\w:]+)/) {
$package = $1;