Messages in this thread Patch in this message | | | Subject | [PATCH] checkpatch: Add test for SPDX-License-Identifier on wrong line # | From | Joe Perches <> | Date | Fri, 08 Feb 2019 12:44:37 -0800 |
| |
Warn when any SPDX-License-Identifier: tag is not created on the proper line number.
Signed-off-by: Joe Perches <joe@perches.com> --- scripts/checkpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 216480ae29d1..d0001fd1112d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3075,6 +3075,14 @@ sub process { # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/); +# check for using SPDX-License-Identifier on the wrong line number + if ($realline != $checklicenseline && + $rawline =~ /\bSPDX-License-Identifier:/ && + substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) { + WARN("SPDX_LICENSE_TAG", + "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr); + } + # line length limit (with some exclusions) # # There are a few types of lines that may extend beyond $max_line_length:
| |