johnthagen / cppcheck-junit Goto Github PK
View Code? Open in Web Editor NEWConverts Cppcheck XML output to JUnit XML.
License: MIT License
Converts Cppcheck XML output to JUnit XML.
License: MIT License
Following on from #13 ..
I uninstalled cppcheck_junit
from Python 2.7's pip, fixed my path to shuffle python versions, and reinstalled into Python 3.9's pip.
I now cannot run cppcheck_junit from the commandline.
The following output is from after some trouble shooting.. hence the "cppcheck_junit is already installed to Python 3.9" message:
E:\repos\Project>python --version
Python 3.9.0
E:\repos\Project>pip install cppcheck_junit --user
Requirement already satisfied: cppcheck_junit in c:\python39\lib\site-packages (2.1.0)
Requirement already satisfied: exitstatus>=1.0.0 in c:\python39\lib\site-packages (from cppcheck_junit) (2.1.0)
WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the 'c:\python39\python.exe -m pip install --upgrade pip' command.
E:\repos\Project>cppcheck_junit cppcheck-result.xml cppcheck-junit.xml
'cppcheck_junit' is not recognized as an internal or external command,
operable program or batch file.
E:\repos\Project>
Please advise any trouble shooting steps I can take.
I have added the following steps to my bamboo plan
cppcheck ... 2> cppcheck-result.xml
cppcheck_junit cppcheck-result.xml cppcheck-junit.xml
I can see a passing test on the dashboard if cppcheck reports no errrors. If there are errors, however, I can only see that JUnit parser failed. No further information is available.
Here are my logs:
build 16-Oct-2017 10:21:36 Running cppcheck:
cppcheck --xml --xml-version=2 --enable=all --
project=compile_commands.json 2> cppcheck-result.xml
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
<cppcheck version="1.80"/>
<errors>
<error id="missingInclude" severity="information" msg="Cppcheck cannot find all the include files (use --check-config for details)" verbose="Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config."/>
</errors>
</results>
build 16-Oct-2017 10:21:36 Running cppcheck_junit:
cppcheck_junit cppcheck-result.xml cppcheck-junit.xml
<?xml version='1.0' encoding='utf-8'?>
<testsuite errors="1" failures="0" hostname="XXX" name="Cppcheck errors" tests="1" time="1" timestamp="2017-10-16T10:21:36.514058">
<testcase classname="" name="" time="1">
<error file="" line="0" message="0: (information) Cppcheck cannot find all the include files (use --check-config for details)" type="" />
</testcase>
</testsuite>
simple 16-Oct-2017 10:21:36 Finished task 'cppcheck' with result: Success
simple 16-Oct-2017 10:21:36 Starting task 'JUnit Parser' of type 'com.atlassian.bamboo.plugins.testresultparser:task.testresultparser.junit'
simple 16-Oct-2017 10:21:36 Parsing test results under <path>
simple 16-Oct-2017 10:21:36 Failing task since 1 failing test cases were found.
simple 16-Oct-2017 10:21:36 Finished task 'JUnit Parser' with result: Failed
Hi,
Just installed this module
E:\repos\TestProject>pip install cppcheck_junit
.. then updated pip because it told me to:
E:\repos\TestProject>python -m pip install --upgrade pip
Then I tried to convert a file as instructed in README.md, got this:
E:\repos\TestProject>cppcheck_junit cppcheck-result.xml cppcheck-junit.xml
Traceback (most recent call last):
File "c:\python27amd64\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27amd64\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27amd64\Scripts\cppcheck_junit.exe\__main__.py", line 5, in <module>
File "c:\python27amd64\lib\site-packages\cppcheck_junit.py", line 16, in <module>
from exitstatus import ExitStatus
File "c:\python27amd64\lib\site-packages\exitstatus.py", line 3, in <module>
import enum
ImportError: No module named enum
E:\repos\TestProject>
I'm using Windows Terminal on Windows 10 Pro, probably Python 2.7.16 (blame googles various build toolings).
In case if cppcheck report contains error without 'location' tag (for example 'missingIncludes') script fails.
If no error in cppcheck no JUnit file generated.
So in that case bamboo JUnit parser marks build as failed.
Probably it is better to create "pseudo" testsuite which is marked as successfull?
Python 3.6 is EOL and support should be dropped.
@PfannenHans since you are a recent contributor, I wanted to check with you first that you do not need Python 3.6 support with your new feature.
cppcheck-junit currently only sets a non-zero exit code when a parsing error occurred.
Similar to cppcheck's --error-exitcode parameter, it would be great if cppcheck-junit also had this.
Usage scenario:
on: [push, pull_request]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.