diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-09-10 10:41:17 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-09-10 11:20:03 +0200 |
commit | 1b0ee8756ba08c2334a89c162722f6bdd13718de (patch) | |
tree | d1903cab4c014db5fdf87ec94ed27cb2f529daaa | |
parent | 24028a22467275671df71cc6a8054036b37d8f03 (diff) | |
download | NetworkManager-1b0ee8756ba08c2334a89c162722f6bdd13718de.tar.gz |
contrib/checkpatch: check for SPDX tags
-rwxr-xr-x | contrib/scripts/checkpatch.pl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index 34c4f91ed3..a6942d53b5 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -48,6 +48,7 @@ our $filename; our $line_no; our $indent; our $check_is_todo; +our $expect_spdx; sub new_hunk { @@ -57,6 +58,7 @@ sub new_hunk sub new_file { + $expect_spdx = 0; $check_is_todo = 1; $filename = shift; @functions_seen = (); @@ -170,12 +172,17 @@ next if $filename =~ /\bsrc\/systemd\// and not $filename =~ /\/nm-/; next if $filename =~ /\/(n-acd|c-list|c-siphash|n-dhcp4)\//; +$expect_spdx = 1 if $line_no == 1; +$expect_spdx = 0 if $line =~ /SPDX-License-Identifier/; +complain ('Missing a SPDX-License-Identifier') if $line_no == 2 and $expect_spdx; + complain ('Tabs are only allowed at the beginning of a line') if $line =~ /[^\t]\t/; complain ('Trailing whitespace') if $line =~ /[ \t]$/; complain ('Don\'t use glib typedefs for char/short/int/long/float/double') if $line =~ /\bg(char|short|int|long|float|double)\b/; complain ("Don't use \"$1 $2\" instead of \"$2 $1\"") if $line =~ /\b(char|short|int|long) +(unsigned|signed)\b/; complain ("Don't use \"unsigned int\" but just use \"unsigned\"") if $line =~ /\b(unsigned) +(int)\b/; -complain ("Please use LGPL2+ for new files") if $is_patch and $line =~ /under the terms of the GNU General Public License/; +complain ("Please use LGPL-2.1+ SPDX tag for new files") if $is_patch and $line =~ /SPDX-License-Identifier/ and not /LGPL-2.1\+/; +complain ("Use a SPDX-License-Identifier instead of Licensing boilerplate") if $is_patch and $line =~ /under the terms of/; complain ("Don't use space inside elvis operator ?:") if $line =~ /\?[\t ]+:/; complain ("Don't add Emacs editor formatting hints to source files") if $line_no == 1 and $line =~ /-\*-.+-\*-/; complain ("XXX marker are reserved for development while work-in-progress. Use TODO or FIXME comment instead?") if $line =~ /\bXXX\b/; |