violations-plugin
violations-plugin copied to clipboard
Feature Request: cppcheck integration
Would be nice to have an integration of cppcheck within Violations-Plugin. Today there is a seperate plugin: https://wiki.jenkins-ci.org/display/JENKINS/Cppcheck+Plugin to visualize details, however having cppcheck within the violations graph would be great.
Do you have a sample report that we can use when creating a parser?
I can't upload a xml file here(only images are supported), but you can do this:
git clone https://github.com/u-boot/u-boot.git && cd u-boot
cppcheck --quiet --enable=all --force --inline-suppr --xml --xml-version=2 . 2> cppcheck-result.xml
all the best! -roger
Nice, I'll paste some of it here to use it later.
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
<cppcheck version="1.52"/>
<errors>
<error id="variableScope" severity="style" msg="The scope of the variable 'i' can be reduced" verbose="The scope of the variable 'i' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
 int i = 0;
 if (x) {
 // it's safe to move 'int i = 0' here
 for (int n = 0; n < 10; ++n) {
 // it is possible but not safe to move 'int i = 0' here
 do_something(&i);
 }
 }
}
When you see this message it is always safe to reduce the variable scope 1 level.">
<location file="api.c" line="498"/>
</error>
<error id="variableScope" severity="style" msg="The scope of the variable 'n' can be reduced" verbose="The scope of the variable 'n' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
 int i = 0;
 if (x) {
 // it's safe to move 'int i = 0' here
 for (int n = 0; n < 10; ++n) {
 // it is possible but not safe to move 'int i = 0' here
 do_something(&i);
 }
 }
}
When you see this message it is always safe to reduce the variable scope 1 level.">
<location file="api.c" line="498"/>
</error>
<error id="variableScope" severity="style" msg="The scope of the variable 'i' can be reduced" verbose="The scope of the variable 'i' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
 int i = 0;
 if (x) {
 // it's safe to move 'int i = 0' here
 for (int n = 0; n < 10; ++n) {
 // it is possible but not safe to move 'int i = 0' here
 do_something(&i);
 }
 }
}
When you see this message it is always safe to reduce the variable scope 1 level.">
<location file="api_storage.c" line="104"/>
</error>
</errors>
</results>