diff --git a/util/lint/lint-stable-027-maintainers-syntax b/util/lint/lint-stable-027-maintainers-syntax new file mode 100755 index 0000000000..85245d1247 --- /dev/null +++ b/util/lint/lint-stable-027-maintainers-syntax @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +# SPDX-License-Identifier: GPL-2.0-or-later +# +# DESCR: Check that path patterns in MAINTAINERS have trailing slash + +use strict; +use warnings; + +open( my $file, "<", "MAINTAINERS" ) or die "Error: could not open file 'MAINTAINERS'\n"; + +while ( my $line = <$file> ) { + if ( $line =~ /^[FX]:\s+([^\s]*[^*\/\s])\s+$/ ) { # path patterns not ending with / or * + my $path = $1; + + if ( -d $path ) { + print "MAINTAINERS:$. missing trailing slash for directory match "; + print "`$path`\n"; + } + } +} + +close($file);