Created
August 4, 2011 03:56
-
-
Save dalinaum/1124471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use File::Find; | |
die "arguments: <temp project file> <result.xml>" if @ARGV != 2; | |
my $temp_file = $ARGV[0]; | |
open my $rule, '>', $temp_file; | |
say $rule '<Project projectName="">'; | |
find(\&get_a_rule, "."); | |
print $rule <<"LOT"; | |
<SuppressionFilter> | |
<LastVersion value="-1" relOp="NEQ"/> | |
</SuppressionFilter> | |
</Project> | |
LOT | |
close $rule; | |
sub get_a_rule | |
{ | |
return if -d $_; | |
if (/^classes\.jar/) { | |
my $fullname = $File::Find::name; | |
# return if /$fullname =~ | |
# return unless $fullname =~ /APP/; | |
say "... $fullname"; | |
say $rule " <Jar>$fullname</Jar>"; | |
} | |
} | |
my $result_file = $ARGV[1]; | |
say "FindBugs:"; | |
my $command = | |
"findbugs -project $temp_file -textui -xml -output $result_file"; | |
if (system($command) != 0) { | |
die "Failed to run findbugs."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment