summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-04-28 12:55:44 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-04-28 12:55:44 +0000
commitde78701d02ead12353fdb70af275ff67a502b1f0 (patch)
tree81796b6218c3d6db16e78ed6f68e9854d34c1c42 /perl_checker.src/parser_helper.ml
parent213d18c0842317ae689d860d2882aac0543aeeea (diff)
downloadperl_checker-de78701d02ead12353fdb70af275ff67a502b1f0.tar
perl_checker-de78701d02ead12353fdb70af275ff67a502b1f0.tar.gz
perl_checker-de78701d02ead12353fdb70af275ff67a502b1f0.tar.bz2
perl_checker-de78701d02ead12353fdb70af275ff67a502b1f0.tar.xz
perl_checker-de78701d02ead12353fdb70af275ff67a502b1f0.zip
various detection of join() misuse
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index fc578a1..113d57b 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -832,6 +832,15 @@ let call_raw force_non_builtin_func (e, para) =
| [ Ident(None, s, pos) ] -> Some [ Raw_string(s, pos) ]
| _ -> None)
+
+ | "join" ->
+ (match un_parenthesize_full_l para with
+ | e :: _ when not (is_a_scalar e) -> warn_rule "first argument of join() must be a scalar";
+ | [_] -> warn_rule "not enough parameters"
+ | [_; e] when is_a_scalar e -> warn_rule "join('...', $foo) is the same as $foo"
+ | _ -> ());
+ None
+
| "last" | "next" | "redo" when not force_non_builtin_func ->
(match para with
| [ Ident(None, s, pos) ] -> Some [ Raw_string(s, pos) ]