nixpkgs-lint: Warn against capitalised package names and missing versions

This commit is contained in:
Eelco Dolstra 2013-07-30 16:51:32 +02:00
parent 1e6b14e8a4
commit f3a17b04e6

View File

@ -42,6 +42,7 @@ my $info = XMLin($xml, KeyAttr => { 'item' => '+attrPath', 'meta' => 'name' }, F
# Check meta information.
print "=== Package meta information ===\n\n";
my $nrBadNames = 0;
my $nrMissingMaintainers = 0;
my $nrMissingDescriptions = 0;
my $nrBadDescriptions = 0;
@ -51,7 +52,11 @@ foreach my $attr (sort keys %{$info->{item}}) {
my $pkg = $info->{item}->{$attr};
my $pkgName = $pkg->{name};
$pkgName =~ s/-[0-9].*//;
my $pkgVersion = "";
if ($pkgName =~ /(.*)(-[0-9].*)$/) {
$pkgName = $1;
$pkgVersion = $2;
}
# Check the maintainers.
my @maintainers;
@ -72,6 +77,17 @@ foreach my $attr (sort keys %{$info->{item}}) {
$nrMissingMaintainers++;
}
# Package names should not be capitalised.
if ($pkgName =~ /^[A-Z]/) {
print "$attr: package name $pkgName should not be capitalised\n";
$nrBadNames++;
}
if ($pkgVersion eq "") {
print "$attr: package has no version\n";
$nrBadNames++;
}
# Check the license.
if (!defined $pkg->{meta}->{license}) {
print "$attr: Lacks a license\n";
@ -104,6 +120,7 @@ foreach my $attr (sort keys %{$info->{item}}) {
$nrBadDescriptions++ if $bad;
}
}
print "\n";
# Find packages that have the same name.
@ -140,6 +157,7 @@ foreach my $name (sort keys %pkgsByName) {
print "=== Bottom line ===\n";
print "Number of packages: ", scalar(keys %{$info->{item}}), "\n";
print "Number of bad names: $nrBadNames\n";
print "Number of missing maintainers: $nrMissingMaintainers\n";
print "Number of missing licenses: $nrMissingLicenses\n";
print "Number of missing descriptions: $nrMissingDescriptions\n";