diff options
| author | fukachan <fukachan> | 2002-06-01 05:06:22 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-06-01 05:06:22 +0000 |
| commit | b59bd780d2e1c055cb03dc26c8fd2a321242a0f3 (patch) | |
| tree | be65ccf6bb94342f5c0431c1f891ff08ee0c9a9e | |
| parent | 0c7f1c7d7ac6c46a24c5a7e7e394d0f90bbed883 (diff) | |
| download | fml8-b59bd780d2e1c055cb03dc26c8fd2a321242a0f3.tar.gz fml8-b59bd780d2e1c055cb03dc26c8fd2a321242a0f3.tar.bz2 fml8-b59bd780d2e1c055cb03dc26c8fd2a321242a0f3.zip | |
clean: clean only for fml-devel/fml/
check: run ./find_bad_style.pl for lib/*.pm
| -rw-r--r-- | regress/simulation/Makefile | 7 | ||||
| -rwxr-xr-x | regress/simulation/find_bad_style.pl | 75 | ||||
| -rwxr-xr-x | regress/style/find_bad_style.pl | 75 |
3 files changed, 155 insertions, 2 deletions
diff --git a/regress/simulation/Makefile b/regress/simulation/Makefile index 54c829ab..7686ed8e 100644 --- a/regress/simulation/Makefile +++ b/regress/simulation/Makefile @@ -1,5 +1,5 @@ # -# $FML: Makefile,v 1.52 2002/04/11 10:13:43 fukachan Exp $ +# $FML: Makefile,v 1.53 2002/05/11 08:50:30 fukachan Exp $ # TMPFILE = /tmp/log.fml-devel.test @@ -7,7 +7,7 @@ TMPFILE = /tmp/log.fml-devel.test all: link clean: - @ (cd ../..; make clean) + @ (cd ../..; find fml |grep '~' |perl -nple unlink) allclean: clean clean_link rm -f __scan__ @@ -24,6 +24,9 @@ update: check: @ (cd ../../fml; make check 2>&1 ) | grep -v OK || echo '' + @ mv 33_TODO 33_TODO.bak + @ ./find_bad_style.pl \ + `find lib/ -type f -print | egrep '\.pm$$' ` | tee 33_TODO link: clean_link _link diff --git a/regress/simulation/find_bad_style.pl b/regress/simulation/find_bad_style.pl new file mode 100755 index 00000000..d64949b6 --- /dev/null +++ b/regress/simulation/find_bad_style.pl @@ -0,0 +1,75 @@ +#!/usr/bin/env perl +# +# $FML$ +# + +use strict; + +my $in_sub = 0; +my $in_head = 0; +my $defined = 0; +my $close = 0; +my $count = 0; +my $buf = ''; +my $prev_argv = ''; +my $prev_line = ''; + +while (<>) { + # reset the line number counter + if ($prev_argv ne $ARGV) { + $count = 0; + $prev_argv = $ARGV; + } + $count++; + + if (/^\s*\#/ || /^\s*$/) { + $prev_line = $_; + next; + } + + # ignore documents + if (/^\=\w+/) { + $prev_line = $_; + $in_head = 1; + $in_head = 0 if /^\=cut/; + next; + } + if ($in_head) { + $prev_line = $_; + next; + } + + # + # 1. check the usage of open() and close() under not check of defined() + # + if (/defined/) { $defined = 1;} + if (/\$\S+\-\>(close|open)/ && (!/^sub /) && (!/^=head/) && (!/\$self/)) { + unless ($defined) { + $buf .= " ===> ". $_; + print "<<<($ARGV $count)\n", $buf, "\n>>>\n\n"; + } + } + + + # + # 2. check FNF + # + if (/^sub / && ($prev_line !~ /^\#/)) { + print "$ARGV $count (FNF)> $_"; + } + + # + # last resort: logging buffer + # + if (/^sub |^\}/) { + undef $buf; + $in_sub = 1; + $defined = 0; + } + + if ($in_sub) { + $buf .= $_; + } + + $prev_line = $_; +} diff --git a/regress/style/find_bad_style.pl b/regress/style/find_bad_style.pl new file mode 100755 index 00000000..d64949b6 --- /dev/null +++ b/regress/style/find_bad_style.pl @@ -0,0 +1,75 @@ +#!/usr/bin/env perl +# +# $FML$ +# + +use strict; + +my $in_sub = 0; +my $in_head = 0; +my $defined = 0; +my $close = 0; +my $count = 0; +my $buf = ''; +my $prev_argv = ''; +my $prev_line = ''; + +while (<>) { + # reset the line number counter + if ($prev_argv ne $ARGV) { + $count = 0; + $prev_argv = $ARGV; + } + $count++; + + if (/^\s*\#/ || /^\s*$/) { + $prev_line = $_; + next; + } + + # ignore documents + if (/^\=\w+/) { + $prev_line = $_; + $in_head = 1; + $in_head = 0 if /^\=cut/; + next; + } + if ($in_head) { + $prev_line = $_; + next; + } + + # + # 1. check the usage of open() and close() under not check of defined() + # + if (/defined/) { $defined = 1;} + if (/\$\S+\-\>(close|open)/ && (!/^sub /) && (!/^=head/) && (!/\$self/)) { + unless ($defined) { + $buf .= " ===> ". $_; + print "<<<($ARGV $count)\n", $buf, "\n>>>\n\n"; + } + } + + + # + # 2. check FNF + # + if (/^sub / && ($prev_line !~ /^\#/)) { + print "$ARGV $count (FNF)> $_"; + } + + # + # last resort: logging buffer + # + if (/^sub |^\}/) { + undef $buf; + $in_sub = 1; + $defined = 0; + } + + if ($in_sub) { + $buf .= $_; + } + + $prev_line = $_; +} |
