Change in osmo-ci[master]: lint: checkpatch.pl: allow spaces below (g)DEFUN

laforge gerrit-no-reply at lists.osmocom.org
Fri Jul 16 16:01:14 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/24918 )

Change subject: lint: checkpatch.pl: allow spaces below (g)DEFUN
......................................................................

lint: checkpatch.pl: allow spaces below (g)DEFUN

Do not complain if indenting with exactly 6/7 spaces below (g)DEFUN(,
as it's often done in VTY-related code in Osmocom. This patch assumes
that if the line starts with 6/7 spaces and " or a word, it's probably
below DEFUN( or gDEFUN(. I've considered implementing a more accurate
check, but that would be too much effort (e.g. when more macros are
involved).

Other related macros, such as DEFUN_ATTR are longer. Indentation below
those should be done with one tab (+ spaces for padding), the linter
doesn't need to be adjusted for those.

Related: OS#5087
Change-Id: I0934b63a62500e7a3e09c753cc63aa331e580cc6
---
M lint/checkpatch/checkpatch.pl
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved; Verified



diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl
index ad99e0c..4da42a9 100755
--- a/lint/checkpatch/checkpatch.pl
+++ b/lint/checkpatch/checkpatch.pl
@@ -3973,7 +3973,9 @@
 #  1) within comments
 #  2) indented preprocessor commands
 #  3) hanging labels
-		if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/)  {
+		if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/ &&
+		    # Osmocom specific, below 'DEFUN(' or 'gDEFUN('
+		    $line !~ /^\+ {6,7}["\w].*$/)  {
 			my $herevet = "$here\n" . cat_vet($rawline) . "\n";
 			if (WARN("LEADING_SPACE",
 				 "please, no spaces at the start of a line\n" . $herevet) &&

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/24918
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I0934b63a62500e7a3e09c753cc63aa331e580cc6
Gerrit-Change-Number: 24918
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210716/234e90c8/attachment.htm>


More information about the gerrit-log mailing list