Admin/isatest/isatest-lint
author kleing
Mon, 05 Mar 2007 22:12:20 +0100
changeset 22410 da313b67a04d
child 31582 4753c317d5c1
permissions -rw-r--r--
moved all isatest/cron job related files to own directory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22410
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     1
#!/usr/bin/env perl
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     2
#
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     3
# $Id$
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     4
# Author: Florian Haftmann, TUM
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     5
#
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     6
# Do consistency and quality checks on the isabelle sources
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     7
#
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     8
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     9
use strict;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    10
use File::Find;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    11
use File::Basename;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    12
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    13
# configuration
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    14
my $isabelleRoot = $ENV{'HOME'} . "/isabelle";
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    15
my @suffices = ('\.thy', '\.ml', '\.ML');
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    16
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    17
# lint main procedure
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    18
sub lint() {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    19
    my ($basename, $dirname, $ext) = fileparse($File::Find::name, @suffices);
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    20
    if ($ext) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    21
        open ISTREAM, $File::Find::name or die("error opening $File::Find::name");
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    22
        my $found = 0;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    23
        while (<ISTREAM>) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    24
            $found ||= m/\$Id[^\$]*\$/;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    25
            last if $found;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    26
        }
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    27
        close ISTREAM;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    28
        my $relname = substr($File::Find::name, (length $isabelleRoot) + 1);
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    29
        if (! $found) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    30
            print "Found no CVS id in $relname\n";
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    31
        }
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    32
    }
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    33
}
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    34
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    35
# first argument =^= isabelle repository root
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    36
if (@ARGV) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    37
    $isabelleRoot = $ARGV[0];
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    38
}
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    39
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    40
find(\&lint, $isabelleRoot);
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    41