All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@foss.st.com>
To: <u-boot@lists.denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Simon Glass <sjg@chromium.org>,
	U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: [PATCH] patman: add warning for invalid tag
Date: Wed, 21 Jul 2021 11:45:41 +0200	[thread overview]
Message-ID: <20210721114521.1.I6630d4cc18870d3e830587ffbcb61898dc045cb6@changeid> (raw)

Add a error in patman tool when the commit message contents an invalid
tag "Serie-.*" instead of "Series-.*".

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
I create this patch to avoid my frequent mistake:
using "Serie-" tag instead of "Series-" as it is done in [1].

RE_INV_TAG can be extended to other frequent errors.

Any "Serie-" tag is refused with the patch, for example:

ValueError: Line 28: Invalid tag =
   'Serie-cc: Marek Behún <marek.behun@nic.cz>'

[1] http://patchwork.ozlabs.org/project/uboot/patch/20210720203353.1.I550b95f6d12d59aeef5b744d837dbb360037d39e@changeid/


 tools/patman/patchstream.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index a44cd861af..b960292427 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -59,6 +59,9 @@ RE_DIFF = re.compile(r'^>.*diff --git a/(.*) b/(.*)$')
 # Detect a context line, like '> @@ -153,8 +153,13 @@ CheckPatch
 RE_LINE = re.compile(r'>.*@@ \-(\d+),\d+ \+(\d+),\d+ @@ *(.*)')
 
+# Detect line with invalid TAG
+RE_INV_TAG = re.compile('^Serie-([a-z-]*): *(.*)')
+
 # States we can be in - can we use range() and still have comments?
 STATE_MSG_HEADER = 0        # Still in the message header
 STATE_PATCH_SUBJECT = 1     # In patch subject (first line of log for a commit)
@@ -318,6 +321,7 @@ class PatchStream:
         leading_whitespace_match = RE_LEADING_WHITESPACE.match(line)
         diff_match = RE_DIFF.match(line)
         line_match = RE_LINE.match(line)
+        invalid_match = RE_INV_TAG.match(line)
         tag_match = None
         if self.state == STATE_PATCH_HEADER:
             tag_match = RE_TAG.match(line)
@@ -471,6 +475,11 @@ class PatchStream:
                 self._add_warn('Line %d: Ignoring Commit-%s' %
                                (self.linenum, name))
 
+        # Detect invalid tags
+        elif invalid_match:
+            raise ValueError("Line %d: Invalid tag = '%s'" %
+                (self.linenum, line))
+
         # Detect the start of a new commit
         elif commit_match:
             self._close_commit()
-- 
2.25.1


             reply	other threads:[~2021-07-21  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  9:45 Patrick Delaunay [this message]
2021-07-21 14:19 ` [PATCH] patman: add warning for invalid tag Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210721114521.1.I6630d4cc18870d3e830587ffbcb61898dc045cb6@changeid \
    --to=patrick.delaunay@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.