From 955fc5ac33ae37222d61579f85dd3638ae6294ab Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 5 Apr 2004 13:52:49 +0000 Subject: add perl_checker.html --- perl_checker.src/.cvsignore | 1 + perl_checker.src/Makefile | 7 +- perl_checker.src/perl_checker.html.pl | 155 ++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 perl_checker.src/perl_checker.html.pl diff --git a/perl_checker.src/.cvsignore b/perl_checker.src/.cvsignore index 2bd7e98..8c0f1f4 100644 --- a/perl_checker.src/.cvsignore +++ b/perl_checker.src/.cvsignore @@ -5,6 +5,7 @@ *.cmo *.cmx perl_checker +perl_checker.html perl_checker_debug gmon.out lexer.ml diff --git a/perl_checker.src/Makefile b/perl_checker.src/Makefile index 75a375e..b6d716d 100644 --- a/perl_checker.src/Makefile +++ b/perl_checker.src/Makefile @@ -9,7 +9,7 @@ LIBS = unix VENDORLIB = $(shell dirname `pwd`) DEBUG = 1 -default: TAGS build_ml build.ml debug-code native-code +default: TAGS build_ml build.ml debug-code native-code perl_checker.html build_ml: rm -f build.ml @@ -20,6 +20,11 @@ build.ml: echo 'let fake_packages_dir = "'$(VENDORLIB)'/perl_checker_fake_packages"' >> $@ echo 'let debugging = $(DEBUG) > 0' >> $@ +%.html: %.html.pl + rm -f $@ + perl $< > $@ + chmod a-w $@ + tags: ocamltags *.ml diff --git a/perl_checker.src/perl_checker.html.pl b/perl_checker.src/perl_checker.html.pl new file mode 100644 index 0000000..5928f70 --- /dev/null +++ b/perl_checker.src/perl_checker.html.pl @@ -0,0 +1,155 @@ +$s = <<'EOF'; +perl_checker +

Goals of perl_checker

+ + + +

Get it

+ +CVS source + +

Implemented features

+ +
+
white space normalization +
enforce a similar coding style. In many languages you can find a coding + style document (eg: the GNU one). + + TESTS=force_layout.t + +
+
disallow complex expressions +
perl_checker try to ban some weird-not-used-a-lot features. + + TESTS=syntax_restrictions.t + +
+
suggest simpler expressions +
when there is a simpler way to write an expression, suggest it. It can + also help detecting errors. + + TESTS=suggest_better.t + +
+
context checks +
Perl has types associated with variables names, the so-called "context". + Some expressions mixing contexts are stupid, perl_checker detects them. + + TESTS=context.t + +
+
function call check +
detection of unknown functions or mismatching prototypes (warning: since + perl is a dynamic language, some spurious warnings may occur when a function + is defined using stashes). + + TESTS=prototype.t + +
+
method call check +
detection of unknown methods or mismatching prototypes. perl_checker + doesn't have any idea what the object type is, it simply checks if a method + with that name and that number of parameters exists. + + TESTS=method.t + +
+
return value check +
dropping the result of a functionnally pure function is stupid. + using the result of a function returning void is stupid too. + + TESTS=return_value.t + +
+
detect some Perl traps +
some Perl expressions are stupid, and one gets a warning when running + them with perl -w. The drawback are perl -w is the lack of + code coverage, it only detects expressions which are evaluated. + + TESTS=various_errors.t + +
+ +

Todo

+ +Functionalities that would be nice: + +EOF + +my $_rationale = <<'EOF'; +

Rationale

+ +Perl is a big language, there is ThereIsMoreThanOneWayToDoIt. +It has advantages but also some drawbacks for team project: +