Admin/isatest-lint
author wenzelm
Tue Jul 05 16:49:15 2005 +0200 (2005-07-05)
changeset 16693 75f39d66425d
parent 16309 39c793a9b382
permissions -rw-r--r--
fixed regexp grouping;
haftmann@16309
     1
#!/usr/bin/env perl
haftmann@16309
     2
#
haftmann@16309
     3
# $Id$
haftmann@16309
     4
# Author: Florian Haftmann, TUM
haftmann@16309
     5
#
haftmann@16309
     6
# Do consistency and quality checks on the isabelle sources
haftmann@16309
     7
#
haftmann@16309
     8
haftmann@16309
     9
use strict;
haftmann@16309
    10
use File::Find;
haftmann@16309
    11
use File::Basename;
haftmann@16309
    12
haftmann@16309
    13
# configuration
haftmann@16309
    14
my $isabelleRoot = $ENV{'HOME'} . "/isabelle";
haftmann@16309
    15
my @suffices = ('\.thy', '\.ml', '\.ML');
haftmann@16309
    16
haftmann@16309
    17
# lint main procedure
haftmann@16309
    18
sub lint() {
haftmann@16309
    19
    my ($basename, $dirname, $ext) = fileparse($File::Find::name, @suffices);
haftmann@16309
    20
    if ($ext) {
haftmann@16309
    21
        open ISTREAM, $File::Find::name or die("error opening $File::Find::name");
haftmann@16309
    22
        my $found = 0;
haftmann@16309
    23
        while (<ISTREAM>) {
haftmann@16309
    24
            $found ||= m/\$Id[^\$]*\$/;
haftmann@16309
    25
            last if $found;
haftmann@16309
    26
        }
haftmann@16309
    27
        close ISTREAM;
haftmann@16309
    28
        my $relname = substr($File::Find::name, (length $isabelleRoot) + 1);
haftmann@16309
    29
        if (! $found) {
haftmann@16309
    30
            print "Found no CVS id in $relname\n";
haftmann@16309
    31
        }
haftmann@16309
    32
    }
haftmann@16309
    33
}
haftmann@16309
    34
haftmann@16309
    35
# first argument =^= isabelle repository root
haftmann@16309
    36
if (@ARGV) {
haftmann@16309
    37
    $isabelleRoot = $ARGV[0];
haftmann@16309
    38
}
haftmann@16309
    39
haftmann@16309
    40
find(\&lint, $isabelleRoot);
haftmann@16309
    41