xref: /aosp_15_r20/external/coreboot/util/lint/lint-stable-027-maintainers-syntax (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0-or-later
3#
4# DESCR: Check that path patterns in MAINTAINERS have trailing slash
5
6use strict;
7use warnings;
8
9open( my $file, "<", "MAINTAINERS" ) or die "Error: could not open file 'MAINTAINERS'\n";
10
11while ( my $line = <$file> ) {
12	if ( $line =~ /^[FX]:\s+([^\s]*[^*\/\s])\s+$/ ) {  # path patterns not ending with / or *
13		my $path = $1;
14
15		if ( -d $path ) {
16			print "MAINTAINERS:$. missing trailing slash for directory match ";
17			print "`$path`\n";
18		}
19	}
20}
21
22close($file);
23