#!/usr/bin/perl # $Id$ use Switch; # Check usage # if ($#ARGV < 1) { print "Usage: pylint_global.pl \n"; exit; } $inFile = $ARGV[0]; $batchNumber = $ARGV[1]; $outFile = $ARGV[2]; $A_F_link = "A-F"; $G_L_link = "G-L"; $M_R_link = "M-R"; $S_X_link = "S-X"; $Y_Z_link = "Y-Z"; $dna_model_link = "dna_model"; $dna_updater_link = "dna_updater"; $exprs_link = "exprs"; $gui_link = "gui"; $model_link = "model"; $PM_link = "PM"; $startup_link = "startup"; $utilities_link = "utilities"; print "

Pylint Results
\n"; print "Back to the SEMBot\n"; print "

\n"; print "

\n"; print "Module Batches
\n"; print "$A_F_link | $G_L_link | $M_R_link | $S_X_link | $Y_Z_link\n"; print "

\n"; print "Packages
\n"; print "$dna_model_link | $dna_updater_link | $exprs_link | $gui_link | "; print "$model_link | $PM_link | $startup_link | $utilities_link\n"; print "

\n";

$fragOpen = 0;
open (INFILE, $inFile) || die "Can't open $inFile: $!\n";
while ($line = readline(INFILE)) {
  if ($fragOpen == 1) {
    if ($line =~ /Messages/) {
      $fragOpen = 0;
      print $line

    } else {
      # |atombasetests        |53.14 |11.21   |27.52    |6.53       |
      if ($line =~ /^\|(\S+)(\s+.+)/) {
        print "|$1$2\n";
		#&sortMessages($1)

      } else {
        print $line
      }
    }

  } else {
    # |module   |error |warning |refactor |convention |
    if ($line =~ /^\|module\s+\|error/) {
      $fragOpen = 1;

    } elsif ($line =~ /Your code has been rated at (\S+)\//) {
      $outFile = "> $outFile";
      open (OUTFILE, $outFile) || die "Can't open $outFile for writing: $!\n";
      print OUTFILE $1;
      close (OUTFILE);
    }
    print $line
  }
}

print "
\n"; unlink"tmp.txt"; # # SUBROUTINE: sortMessages # # TODO: This needs to keep the code snipits associated with some lines, with # the line. # sub sortMessages { local ($module) = pop(@_); system "sort -r -k 2 SVN-D/cad/src/pylint_$module.txt > tmp.txt"; system "mv tmp.txt SVN-D/cad/src/pylint_$module.txt"; }