summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmgerman <dmg@uvic.ca>2015-01-10 02:17:07 -0800
committerdmgerman <dmg@uvic.ca>2015-01-10 02:17:07 -0800
commit6a536fe1daee1847a8666b620ac59743253d2ccd (patch)
tree264e96c698aab1c69a5b3ceea2fde11fc2084852
parente8c10ab43e31e5882463438900a86f6ffd21177f (diff)
parent76674754389501a4e22fe143f914805a7627bbb5 (diff)
downloadninka-6a536fe1daee1847a8666b620ac59743253d2ccd.tar.gz
Merge pull request #6 from darxriggs/consistent-quoting
use quotes consistently
-rwxr-xr-xextComments/extComments.pl12
-rwxr-xr-xextComments/hashComments.pl2
-rwxr-xr-xfilter/filter.pl12
-rwxr-xr-xmatcher/matcher.pl152
-rwxr-xr-xsplitter/splitter.pl36
5 files changed, 107 insertions, 107 deletions
diff --git a/extComments/extComments.pl b/extComments/extComments.pl
index a270b5a..8fbca63 100755
--- a/extComments/extComments.pl
+++ b/extComments/extComments.pl
@@ -23,13 +23,13 @@ use strict;
my $path = $0;
$path =~ s/\/+[^\/]+$//;
-if ($path eq "") {
- $path = "./";
+if ($path eq '') {
+ $path = './';
}
# set parameters
my %opts = ();
-if (!getopts ("vc:p:",\%opts)) {
+if (!getopts ('vc:p:',\%opts)) {
print STDERR "Usage $0 -v
-v verbose
@@ -81,14 +81,14 @@ sub Determine_Comments_Extractor
return "cat '$f' | head -400 > '${f}.comments'";
# return "$path/hashComments.pl -p '#' '$f'";
- } elsif ($ext eq "jl" or
- $ext eq "el"
+ } elsif ($ext eq 'jl' or
+ $ext eq 'el'
) {
return "cat '$f' | head -400 > '${f}.comments'";
# return "$path/hashComments.pl -p ';' '$f'";;
} elsif ($ext =~ /^(java|c|cpp|h|cxx|c\+\+|cc)$/ ) {
my $comm = `which comments`;
- if ($comm ne "") {
+ if ($comm ne '') {
return "comments -c1 '$f' 2> /dev/null";
} else {
return "cat '$f' | head -400 > '${f}.comments'";
diff --git a/extComments/hashComments.pl b/extComments/hashComments.pl
index ea0fc1b..a4834d4 100755
--- a/extComments/hashComments.pl
+++ b/extComments/hashComments.pl
@@ -26,7 +26,7 @@ use Getopt::Std;
# set parameters
my %opts = ();
-if (!getopts ("vc:p:",\%opts)) {
+if (!getopts ('vc:p:',\%opts)) {
print STDERR "Usage $0 -v
-v verbose
diff --git a/filter/filter.pl b/filter/filter.pl
index 35d8d3b..626904f 100755
--- a/filter/filter.pl
+++ b/filter/filter.pl
@@ -35,10 +35,10 @@ use strict;
# where are we running the program from
my $path = $0;
$path =~ s/[^\/]+$//;
-if ($path eq "") {
- $path = "./";
+if ($path eq '') {
+ $path = './';
}
-my $critWords = $path . "criticalword.dict";
+my $critWords = $path . 'criticalword.dict';
die "Usagee $0 <filename>.sentences" unless $ARGV[0] =~ /\.sentences$/;
@@ -53,10 +53,10 @@ $badfilename =~ s/\.sentences$/\.badsent/;
#print $badfilename;
open (INPUTFILE, "<$ARGV[0]") or die ("Error: $ARGV[0] is not found.");
-open (DICTIONARY, "<$critWords") or die ("Error: criticalword.dict is not found.");
+open (DICTIONARY, "<$critWords") or die ('Error: criticalword.dict is not found.');
-open (GOODOUT, ">$goodfilename") || die ("Error");
-open (BADOUT, ">$badfilename") || die ("Error");
+open (GOODOUT, ">$goodfilename") || die ('Error');
+open (BADOUT, ">$badfilename") || die ('Error');
my @cwordlist=();
# read dictionary into list
diff --git a/matcher/matcher.pl b/matcher/matcher.pl
index c1a46ae..aa01f1a 100755
--- a/matcher/matcher.pl
+++ b/matcher/matcher.pl
@@ -54,72 +54,72 @@ my @gplNonCritical = ('GPLnoVersion',
'GNUurl',
'GPLseeDetailsVer0');
-$NonCriticalRules{"LibraryGPLv3+"} = [@gplNonCritical];
-$NonCriticalRules{"LibraryGPLv3"} = [@gplNonCritical];
-$NonCriticalRules{"LibraryGPLv2+"} = [@gplNonCritical];
-$NonCriticalRules{"LibraryGPLv2"} = [@gplNonCritical];
-$NonCriticalRules{"LesserGPLv3"} = [@gplNonCritical, 'LesserGPLseeVer3','LesserGPLcopyVer3','SeeFileVer3'];
-$NonCriticalRules{"LesserGPLv2.1+"} = [@gplNonCritical];
-$NonCriticalRules{"LesserGPLv2.1"} = [@gplNonCritical];
-$NonCriticalRules{"LGPLv2orv3"}= [@gplNonCritical];
-$NonCriticalRules{"LesserGPLv2"} = [@gplNonCritical];
-$NonCriticalRules{"LesserGPLv2+"} = [@gplNonCritical];
-
-$NonCriticalRules{"GPLv2+"} = [@gplNonCritical];
-$NonCriticalRules{"GPLv2"} = [@gplNonCritical];
-$NonCriticalRules{"GPLv1+"} = [@gplNonCritical];
-$NonCriticalRules{"GPLv1"} = [@gplNonCritical];
-$NonCriticalRules{"GPLv3+"} = [@gplNonCritical];
-$NonCriticalRules{"GPLv3"} = [@gplNonCritical];
-$NonCriticalRules{"AGPLv3"} = [@gplNonCritical, 'AGPLreceivedVer0','AGPLseeVer0'];
-$NonCriticalRules{"AGPLv3+"} = [@gplNonCritical, 'AGPLreceivedVer0','AGPLseeVer0'];
-$NonCriticalRules{"GPLnoVersion"} = [@gplNonCritical];
-
-$NonCriticalRules{"Apachev1.1"} = ['ApacheLic1_1'];
-$NonCriticalRules{"Apachev2"} = ['ApachePre','ApacheSee'];
-
-$NonCriticalRules{"LibGCJLic"} = ['LibGCJSee'];
-$NonCriticalRules{"CDDLicV1"} = ['Compliance','CDDLicWhere','ApachesPermLim','CDDLicIncludeFile','UseSubjectToTerm', 'useOnlyInCompliance'];
-$NonCriticalRules{"CDDLic"} = ['Compliance','CDDLicWhere','ApachesPermLim','CDDLicIncludeFile','UseSubjectToTerm', 'useOnlyInCompliance'];
-
-$NonCriticalRules{"CDDLorGPLv2"}= ["CDDLorGPLv2doNotAlter","AllRights","useOnlyInCompliance", "CDDLorGPLv2whereVer0", "ApachesPermLim", "CDDLorGPLv2include","CDDLorGPLv2IfApplicable", "CDDLorGPLv2Portions", "CDDLorGPLv2ifYouWishVer2", "CDDLorGPLv2IfYouAddVer2"];
-
-$NonCriticalRules{"CPLv1orGPLv2+orLGPLv2+"} = ["licenseBlockBegin", "licenseBlockEnd"];
-
-$NonCriticalRules{"Qt"} = ["Copyright","qtNokiaExtra","QTNokiaContact", "qtDiaTems"];
-$NonCriticalRules{"orLGPLVer2.1"} = ["LesserqtReviewGPLVer2.1","qtLGPLv2.1where"];
-$NonCriticalRules{"orGPLv3"} = ["qtReviewGPLVer3.0","qtReviewGPLVer3","qtGPLwhere"];
-$NonCriticalRules{"digiaQTExceptionNoticeVer1.1"} = ["qtDigiaExtra"];
-
-$NonCriticalRules{"MPLv1_0"} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
-$NonCriticalRules{"MPLv1_1"} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
-$NonCriticalRules{"NPLv1_1"} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
-$NonCriticalRules{"NPLv1_0"} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
-
-$NonCriticalRules{"subversion"} = ['SeeFileSVN','subversionHistory'];
-$NonCriticalRules{"subversion+"} = ['SeeFileSVN','subversionHistory'];
-$NonCriticalRules{"tmate+"} = ['SeeFileSVN'];
-
-$NonCriticalRules{"openSSLvar2"} = ['BSDcondAdvPart2'];
-
-$NonCriticalRules{"MPLv1_1"} = ['licenseBlockBegin','MPLsee','Copyright','licenseBlockEnd','ApacheLicWherePart1','MPLwarranty', 'MPLwarrantyVar'];
-$NonCriticalRules{"MPL1_1andLGPLv2_1"} = ["MPLoptionIfNotDelete2licsVer0",'MPL_LGPLseeVer0'];
-
-$NonCriticalRules{"FreeType"} = ["FreeTypeNotice"];
-
-$NonCriticalRules{"GPLVer2.1or3KDE+"} = [@gplNonCritical];
-$NonCriticalRules{"LGPLVer2.1or3KDE+"} = [@gplNonCritical];
+$NonCriticalRules{'LibraryGPLv3+'} = [@gplNonCritical];
+$NonCriticalRules{'LibraryGPLv3'} = [@gplNonCritical];
+$NonCriticalRules{'LibraryGPLv2+'} = [@gplNonCritical];
+$NonCriticalRules{'LibraryGPLv2'} = [@gplNonCritical];
+$NonCriticalRules{'LesserGPLv3'} = [@gplNonCritical, 'LesserGPLseeVer3','LesserGPLcopyVer3','SeeFileVer3'];
+$NonCriticalRules{'LesserGPLv2.1+'} = [@gplNonCritical];
+$NonCriticalRules{'LesserGPLv2.1'} = [@gplNonCritical];
+$NonCriticalRules{'LGPLv2orv3'}= [@gplNonCritical];
+$NonCriticalRules{'LesserGPLv2'} = [@gplNonCritical];
+$NonCriticalRules{'LesserGPLv2+'} = [@gplNonCritical];
+
+$NonCriticalRules{'GPLv2+'} = [@gplNonCritical];
+$NonCriticalRules{'GPLv2'} = [@gplNonCritical];
+$NonCriticalRules{'GPLv1+'} = [@gplNonCritical];
+$NonCriticalRules{'GPLv1'} = [@gplNonCritical];
+$NonCriticalRules{'GPLv3+'} = [@gplNonCritical];
+$NonCriticalRules{'GPLv3'} = [@gplNonCritical];
+$NonCriticalRules{'AGPLv3'} = [@gplNonCritical, 'AGPLreceivedVer0','AGPLseeVer0'];
+$NonCriticalRules{'AGPLv3+'} = [@gplNonCritical, 'AGPLreceivedVer0','AGPLseeVer0'];
+$NonCriticalRules{'GPLnoVersion'} = [@gplNonCritical];
+
+$NonCriticalRules{'Apachev1.1'} = ['ApacheLic1_1'];
+$NonCriticalRules{'Apachev2'} = ['ApachePre','ApacheSee'];
+
+$NonCriticalRules{'LibGCJLic'} = ['LibGCJSee'];
+$NonCriticalRules{'CDDLicV1'} = ['Compliance','CDDLicWhere','ApachesPermLim','CDDLicIncludeFile','UseSubjectToTerm', 'useOnlyInCompliance'];
+$NonCriticalRules{'CDDLic'} = ['Compliance','CDDLicWhere','ApachesPermLim','CDDLicIncludeFile','UseSubjectToTerm', 'useOnlyInCompliance'];
+
+$NonCriticalRules{'CDDLorGPLv2'}= ['CDDLorGPLv2doNotAlter','AllRights','useOnlyInCompliance', 'CDDLorGPLv2whereVer0', 'ApachesPermLim', 'CDDLorGPLv2include','CDDLorGPLv2IfApplicable', 'CDDLorGPLv2Portions', 'CDDLorGPLv2ifYouWishVer2', 'CDDLorGPLv2IfYouAddVer2'];
+
+$NonCriticalRules{'CPLv1orGPLv2+orLGPLv2+'} = ['licenseBlockBegin', 'licenseBlockEnd'];
+
+$NonCriticalRules{'Qt'} = ['Copyright','qtNokiaExtra','QTNokiaContact', 'qtDiaTems'];
+$NonCriticalRules{'orLGPLVer2.1'} = ['LesserqtReviewGPLVer2.1','qtLGPLv2.1where'];
+$NonCriticalRules{'orGPLv3'} = ['qtReviewGPLVer3.0','qtReviewGPLVer3','qtGPLwhere'];
+$NonCriticalRules{'digiaQTExceptionNoticeVer1.1'} = ['qtDigiaExtra'];
+
+$NonCriticalRules{'MPLv1_0'} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
+$NonCriticalRules{'MPLv1_1'} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
+$NonCriticalRules{'NPLv1_1'} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
+$NonCriticalRules{'NPLv1_0'} = ['ApacheLicWherePart1','MPLwarranty','MPLSee'];
+
+$NonCriticalRules{'subversion'} = ['SeeFileSVN','subversionHistory'];
+$NonCriticalRules{'subversion+'} = ['SeeFileSVN','subversionHistory'];
+$NonCriticalRules{'tmate+'} = ['SeeFileSVN'];
+
+$NonCriticalRules{'openSSLvar2'} = ['BSDcondAdvPart2'];
+
+$NonCriticalRules{'MPLv1_1'} = ['licenseBlockBegin','MPLsee','Copyright','licenseBlockEnd','ApacheLicWherePart1','MPLwarranty', 'MPLwarrantyVar'];
+$NonCriticalRules{'MPL1_1andLGPLv2_1'} = ['MPLoptionIfNotDelete2licsVer0','MPL_LGPLseeVer0'];
+
+$NonCriticalRules{'FreeType'} = ['FreeTypeNotice'];
+
+$NonCriticalRules{'GPLVer2.1or3KDE+'} = [@gplNonCritical];
+$NonCriticalRules{'LGPLVer2.1or3KDE+'} = [@gplNonCritical];
# initialize
my $path = $0;
$path =~ s/[^\/]+$//;
-if ($path eq "") {
- $path = "./";
+if ($path eq '') {
+ $path = './';
}
-my $rules= $path . "rules.dict";
-my $interrules= $path . "interrules.dict";
+my $rules= $path . 'rules.dict';
+my $interrules= $path . 'interrules.dict';
die "Usage $0 <filename>.senttok" unless $ARGV[0] =~ /\.senttok$/;
@@ -160,7 +160,7 @@ Read_Original($ARGV[0], \@licSentNames, \@original);
# matching spdx requires to match strict licenses, with no alternatives...
-my $senttok= "," . join(",",@licSentNames) . ",";
+my $senttok= ',' . join(',',@licSentNames) . ',';
my @result=();
my $countMatches = 0;
@@ -179,8 +179,8 @@ Match_License();
my $match = 0;
for (my $i=0;$i<=$#licSentNames ;$i++) {
if ($licSentNames[$i] == 0 and
- ($licSentNames[$i] ne "UNKNOWN" and
- $licSentNames[$i] ne "")) {
+ ($licSentNames[$i] ne 'UNKNOWN' and
+ $licSentNames[$i] ne '')) {
# print "[$licSentNames[$i]]\n";
$licSentNames[$i] =~ s/Extrict$//;
$match ++;
@@ -200,7 +200,7 @@ if ($match > 0) {
@licSentNames = map { $_ eq $interRuleList[$i][0] ? $interRuleList[$i][1] : $_ } @licSentNames;
}
- $senttok= join(",",@licSentNames) . ',';
+ $senttok= join(',',@licSentNames) . ',';
Match_License();
}
@@ -213,7 +213,7 @@ exit 0;
#print @licSentNames;
-#print join(";",@licSentNames)."\n";
+#print join(';',@licSentNames)."\n";
# 3. matching
@@ -229,14 +229,14 @@ sub Is_Unknown
{
my ($s) = @_;
my @f = split (/,/, $s);
- return $f[0] eq "UNKNOWN";
+ return $f[0] eq 'UNKNOWN';
}
sub Read_Rules
{
my ($rulesF) = @_;
- open (RULES, "<$rulesF") or die ("Error: rules.dict is not found.");
+ open (RULES, "<$rulesF") or die ('Error: rules.dict is not found.');
my $sentence;
my @rules = ();
while ($sentence=<RULES>){
@@ -263,7 +263,7 @@ sub Read_Inter_Rules
my ($interrules) = @_;
my @list;
- open (IRULES, "<$interrules") or die ("Error: interrules.dict is not found.");
+ open (IRULES, "<$interrules") or die ('Error: interrules.dict is not found.');
my $sentence;
while ($sentence=<IRULES>){
chomp $sentence;
@@ -299,7 +299,7 @@ sub Read_Original
exit 0;
}
-#print join(";",@licSentNames)."\n";
+#print join(';',@licSentNames)."\n";
close INPUTFILE;
}
@@ -320,7 +320,7 @@ sub Match_License
$countMatches ++;
push (@result,$rulename);
# print ">>>>$senttok|$rulelist[$j][1]\n";
-# print "Result: ", join(',', @result);
+# print 'Result: ', join(',', @result);
# print "\n";
}
}
@@ -331,13 +331,13 @@ sub Match_License
# ok, at this point we have removed all the matched sentences...
#print STDERR "Ending>>>>>>>$senttok\n";
-#print STDERR "Size>>" , scalar(@result), "\n";
-#print STDERR "Result>>", join(',', @result), "\n";
+#print STDERR 'Size>>' , scalar(@result), "\n";
+#print STDERR 'Result>>', join(',', @result), "\n";
# let us remove allrights
# my $onlyAllRight = 1;
# for my $i (0.. scalar(@licSentNames)-1){
-# if (($licSentNames[$i] eq "AllRights")) {
+# if (($licSentNames[$i] eq 'AllRights')) {
# $licSentNames[$i] = '';
# } else {
# $onlyAllRight = 0;
@@ -390,8 +390,8 @@ sub Print_Result
# ok, so now, what I want to output it:
# licenses; number of licenses matched;number of sentences matched; number of sentences ignored;number of sentences not matched;number of sentences unknown
my @sections = split(',', $senttok);
- die "assertion 1" if $sections[0] ne "";
- die "assertion 2" if $sections[scalar(@sections)] ne "";
+ die 'assertion 1' if $sections[0] ne '';
+ die 'assertion 2' if $sections[scalar(@sections)] ne '';
my $ignoredLines = 0;
my $licenseLines = 0;
@@ -403,7 +403,7 @@ sub Print_Result
$ignoredLines += - $sections[$i];
} elsif ($sections[$i] != 0) {
$licenseLines += $sections[$i];
- } elsif ($sections[$i] eq "UNKNOWN") {
+ } elsif ($sections[$i] eq 'UNKNOWN') {
$unknownLines ++;
} else {
$unmatchedLines++;
@@ -413,7 +413,7 @@ sub Print_Result
# print "$ignoredLines > $licenseLines > $unknownLines > $unmatchedLines\n";
if (scalar (@result) == 0) {
- print "UNKNOWN";
+ print 'UNKNOWN';
} else {
print join(',',@result);
}
diff --git a/splitter/splitter.pl b/splitter/splitter.pl
index 5eab784..4ff1723 100755
--- a/splitter/splitter.pl
+++ b/splitter/splitter.pl
@@ -35,8 +35,8 @@ use strict;
# His ideas, however, linger in here (and his dictionary of abbreviations)
-my $dictionary = "splitter.dict";
-my $abbrv_file = "splitter.abv";
+my $dictionary = 'splitter.dict';
+my $abbrv_file = 'splitter.abv';
my $len = 0;
my %COMMON_TERMS = ();
my %ABBREVIATIONS = ();
@@ -45,8 +45,8 @@ my $output_file = $ARGV[0];
# where are we running the splitter from?
my $path = $0;
$path =~ s/[^\/]+$//;
-if ($path eq "") {
- $path = "./";
+if ($path eq '') {
+ $path = './';
}
$dictionary = $path . $dictionary;
$abbrv_file = $path . $abbrv_file;
@@ -212,7 +212,7 @@ sub Split_Text
my $puctuation;
my @result;
my $after;
- my $currentSentence = "";
+ my $currentSentence = '';
# this breaks the sentence into
# 1. Any text before a separator
# 2. The separator [.!?:\n]
@@ -229,18 +229,18 @@ sub Split_Text
$after = $3;
# if next character is not a space, then we are not in a sentence"
- if ($after ne " " && $after ne "\t") {
+ if ($after ne ' ' && $after ne "\t") {
$currentSentence .= $sentence;
next;
}
#at this point we know that there is a space after
- if ($punctuation eq ":" || $punctuation eq "?" || $punctuation eq "!") {
+ if ($punctuation eq ':' || $punctuation eq '?' || $punctuation eq '!') {
# let us consider this right here a beginning of a sentence
push @result, $currentSentence . $sentence;
- $currentSentence = "";
+ $currentSentence = '';
next;
}
- if ($punctuation eq ".") {
+ if ($punctuation eq '.') {
# we have a bunch of alternatives
# for the time being just consider a new sentence
@@ -259,16 +259,16 @@ sub Split_Text
if (length($lastWord) == 1 ) {
# single character abbreviations are special...
# we will assume they never split the sentence if they are capitalized.
- if (($lastWord ge "A") and
- ($lastWord le "Z")) {
+ if (($lastWord ge 'A') and
+ ($lastWord le 'Z')) {
$currentSentence .= $sentence;
next;
}
print "last word an abbrev $sentenceMatch lastword [$lastWord] before [$before]\n";
# but some are lowercase!
- if (($lastWord eq "e") or
- ($lastWord eq "i")) {
+ if (($lastWord eq 'e') or
+ ($lastWord eq 'i')) {
$currentSentence .= $sentence;
next;
}
@@ -291,14 +291,14 @@ sub Split_Text
}
push @result, $currentSentence . $sentence;
- $currentSentence = "";
+ $currentSentence = '';
next;
}
- die "We have not dealt with this case";
+ die 'We have not dealt with this case';
}
push @result, $currentSentence . $text;
- #Print_Non_Sentence($text,"\n","");
+ #Print_Non_Sentence($text,"\n",'');
return @result;
}
@@ -306,7 +306,7 @@ sub Split_Text
sub loadDictionary {
# Initialise var
- my $common_term = "";
+ my $common_term = '';
if (open(DICT, $dictionary)) {
@@ -328,7 +328,7 @@ sub loadAbbreviations
{
# Initialise var
- my $abbrv_term = "";
+ my $abbrv_term = '';
if (open(ABBRV, $abbrv_file)) {