Added some documentation, updated line counting code

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1359 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-01-22 15:44:43 +00:00
parent c1a3abf154
commit de7a7ea4ff
5 changed files with 39 additions and 9 deletions

31
pmd-web/readme.txt Normal file
View File

@ -0,0 +1,31 @@
INSTALL
This should work on pretty much any CVS server, however, all the server names and directories are hardcoded.
- install Perl and Ruby (http://www.ruby-lang.org/) if they're not already installed
- check out the code from Sourceforge
- put webpmd.pl and PMD/Project.pm in your cgi-bin directory
- create a cgi-bin/jobs directory and put jobs in there in the format:
File name: something unique, usually reponame_modulename.txt, i.e., pmd_pmd-jedit.txt
File contents: Sourceforge:PMD-JEdit:pmd:pmd-jedit:pmd-jedit/src
- create a reports/ directory under htdocs
- put processor.rb and pmd.rb in your home directory
- edit processor.rb and point it to your reports directory and your jobs directory
- set up a cron job:
10 0,3,6,9,12,15,18,21 * * * nice -n 19 /path/to/processor.rb
- let the fun begin!
I realize these are lousy instructions, but I'm not sure if anyone other than I will ever read them. Thus, updates are welcome.
CHANGELOG
1/22/03 - Added this file
1/21/03 - Updated to use new SF CVS configuration

View File

@ -35,12 +35,11 @@ sub getLines() {
open(FILE,getRptFile($self));
my @x = <FILE>;
close(FILE);
my $y = @x;
my $lines = sprintf("%0.f", ($y-5)/4);
if ($lines == "-0" || $lines == "-1") {
$lines = "0";
my $lines;
foreach (@x) {
$lines = $lines + 1 if $_ =~ "<td ";
}
return $lines;
return sprintf("%0.f", $lines/3);
}
sub getLocation() {
my $self = shift;

Binary file not shown.

View File

@ -14,7 +14,7 @@ jobsDir.each { |candidate|
next
end
job = PMD::Job.new(location,title,unixname,moduleDir,srcDir)
puts "Processing #{job}"
#puts "Processing #{job}"
File.open("/home/groups/p/pm/pmd/cgi-bin/currentjob.txt", "w") { |file| file.syswrite(job.unixName) }
job.checkout_code
job.run_pmd

View File

@ -20,7 +20,7 @@ sub default() {
print h3("<center>PMD-WEB</center>");
print "PMD is a Java source code analysis tool - it checks your code for unused fields, empty try/catch/finally/if/while blocks, unused method parameters, and stuff like that. There's much more info <a href=\"http://pmd.sf.net/\">here</a>.<p>This table contains the results of running PMD's <a href=\"http://pmd.sourceforge.net/rules/unusedcode.html\">unused code ruleset</a> against a bunch of Sourceforge and Jakarta projects.";
print "<p><b>1/21/03: This page has been down for a few days due to Sourceforge CVS migrations, but it's back on the hourly cycle now</b>";
print "<p><b>1/21/03: This page has been down for a few days due to Sourceforge CVS migrations, but it's back on the three hour cycle now</b>";
print hr();
if (param("location")) {
@ -66,14 +66,14 @@ sub printStats() {
print br();
print "The last run took ", sprintf("%.0f", $lastruntime/60), " minutes";
print br();
print "This report is regenerated every two hours at 10 minutes past the hour";
print "This report is regenerated every three hours at 10 minutes past the hour";
print br();
}
sub getTimeUntil() {
# we're starting each build at 10 past the hour, so...
my $offset = 10;
my $everyXHours = 2;
my $everyXHours = 3;
my $minutes = ((60 + $offset) - localtime()->min) % 60;
if (localtime()->hour % $everyXHours != 0) {
$minutes += 60;