The Warnings Plugin already provides a
Clang (LLVM based) warnings parser, but in my case I needed to set high priority to specific class of warnings. It’s a small post on how to create a custom parser for
I assume the aforementioned plugin is already installed on your Jenkins. Go to
Manage Jenkins >
Configure System. Find the
Compiler Warnings section somewhere towards the bottom, press
Add to add a new parser. Here are the parameters:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
That’s it! You can customize it to set different categories and priorities in the lines between parsing a line and returning a new
Warning object. In this case, all messages containing
deprecated will have the
deprecation category, and all messages mentioning
not implemented will have a high priority.
Important note: the plugin de-duplicates the warnings. Since the parser is one line only (although
Clang’s warnings are multiline), you can bump into a weird issue when the plugin displays fewer warnings than the Xcode generates. It happens if there is a warning in a header included from different files, in this case the actual warning in the header will be exactly the same, and the difference is in the context (above and/or below lines, which are not parsed). The plugin apparently supports multiline regular expressions, but they are quite slow, and I haven’t tried that approach. (See also: https://issues.jenkins-ci.org/browse/JENKINS-8399 and https://issues.jenkins-ci.org/browse/JENKINS-17132).