The MAINTAINERS file is used to automatically assign reviewers on Gerrit, however as the paths are not checked they can become out of sync with the codebase. This is detrimental to both the uploader and the maintainers, as the change may not get the appropriate attention. Fix this problem by adding a simple check for 'F' and 'X' entries. Change-Id: I7755f6317edda0d8d976e138cfafcc3ef5850ead Signed-off-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/89511 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
35 lines
806 B
Perl
Executable file
35 lines
806 B
Perl
Executable file
#!/usr/bin/env perl
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
# DESCR: Check the syntax of the MAINTAINERS file
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
sub check_path {
|
|
my ($path) = @_;
|
|
|
|
if ( ! -e $path ) {
|
|
print "MAINTAINERS:$. No such file or directory exists ";
|
|
print "`$path`\n";
|
|
}
|
|
}
|
|
|
|
open( my $file, "<", "MAINTAINERS" ) or die "Error: could not open file 'MAINTAINERS'\n";
|
|
|
|
while ( my $line = <$file> ) {
|
|
if ( $line =~ /^[FX]:\s+([^\s]*)\s+$/ ) {
|
|
my $path = $1;
|
|
|
|
# Match path patterns not ending with '/' or '*'. This cannot be done
|
|
# in check_path(), as it only works on pre-globbed paths.
|
|
if ( $path =~ /[^*\/\s]$/ && -d $path ) {
|
|
print "MAINTAINERS:$. missing trailing slash for directory match ";
|
|
print "`$path`\n";
|
|
}
|
|
|
|
check_path($_) foreach ( glob $path );
|
|
}
|
|
}
|
|
|
|
close($file);
|