Skip to contentSkip to conversation

patman: Format checkpatch messages for IDE throwback

PATCH New Simon Glass 1 participant 2 messages Jan 17, 2017 – Feb 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 patman: Format checkpatch messages for IDE throwback

It is convenient to be able to deal with checkpatch warnings in the same way as build warnings. Tools such as emacs and kate can quickly locate the source file and line automatically.

To achieve this, adjust the format to match the C compiler, and output to stderr.

---

 tools/patman/checkpatch.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/patman/checkpatch.py +3 -2
index be78fc510b8..2915d97950d 100644
@@ -138,7 +138,7 @@ def GetWarningMsg(col, msg_type, fname, line, msg):
         msg_type = col.Color(col.RED, msg_type)
     elif msg_type == 'check':
         msg_type = col.Color(col.MAGENTA, msg_type)
-    return '%s: %s,%d: %s' % (msg_type, fname, line, msg)
+    return '%s:%d: %s: %s\n' % (fname, line, msg_type, msg)
 
 def CheckPatches(verbose, args):
     '''Run the checkpatch.pl script on each patch'''
@@ -157,7 +157,8 @@ def CheckPatches(verbose, args):
                     result.checks):
                 print("Internal error: some problems lost")
             for item in result.problems:
-                print(GetWarningMsg(col, item.get('type', '<unknown>'),
+                sys.stderr.write(
+                    GetWarningMsg(col, item.get('type', '<unknown>'),
                         item.get('file', '<unknown>'),
                         item.get('line', 0), item.get('msg', 'message')))
             print
Signature · 1 line
2.11.0.483.g087da7b7c-goog
#1 lore raw

PATCH 1/1 patman: Format checkpatch messages for IDE throwback

Quoted 4 lines · Simon Glass

It is convenient to be able to deal with checkpatch warnings in the same way as build warnings. Tools such as emacs and kate can quickly locate the source file and line automatically.

Quoted 8 lines

To achieve this, adjust the format to match the C compiler, and output to stderr.

---

 tools/patman/checkpatch.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Applied to u-boot-dm, thanks!