Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to generate cppcheck reports as xml file #100

Open
osechet opened this issue Feb 8, 2019 · 2 comments
Open

Option to generate cppcheck reports as xml file #100

osechet opened this issue Feb 8, 2019 · 2 comments

Comments

@osechet
Copy link
Contributor

osechet commented Feb 8, 2019

It would be nice to have an option to generate ccpcheck reports as an xml file. When calling cppcheck, using the --xml --output-file=<output_file> arguments forces cppcheck to output its report to the given file.

@scheibel
Copy link
Member

My version of cppcheck (1.82 on Ubuntu 18.04) does not document the --output-file parameter. However, the parameter is usable and your suggestion is reasonable.

What I would want to discuss are actual implementation details.

(1) You suggest to add a cmake option. I wonder if such option would toggle the xml-output for all health checks or just for cppcheck. More specifically, would such an option be called OPTION_XML_REPORTS or OPTION_CPPCHECK_XML_REPORTS.

(2) Alternative approaches are the ability to extend the command-line arguments passed to cppcheck at a more visible location in the setup.
Example:

set(CPPCHECK_FLAGS "--enable=all --verbose --suppress=missingIncludeSystem
--xml --output-file="\\${CMAKE_CURRENT_BINARY_DIR}/cppcheck-\\${target}.xml")

(3) What I currently test is the addition of more cmake targets where their names encode the output to xml.
An example of the current health check targets:

  • check-all
  • check-baselib
  • check-fiblib
  • cppcheck-baselib
  • cppcheck-fiblib
  • clang-tidy-baselib
  • clang-tidy-fiblib

I'm thinking of adding these additional cmake targets:

  • check-all-xml
  • check-baselib-xml
  • check-fiblib-xml
  • cppcheck-baselib-xml
  • cppcheck-fiblib-xml
  • clang-tidy-baselib-xml
  • clang-tidy-fiblib-xml

@osechet
Copy link
Contributor Author

osechet commented Feb 21, 2019

The 3 solutions seem interesting. My personal need is only about cppcheck so a OPTION_CPPCHECK_XML_REPORTS would be good. However I agree it would be better to have a more general mechanism.
For that reason, the OPTION_XML_REPORTS could be interesting but what happens if a future health tool cannot generate an XML report?

I don't really like the 2nd suggestion. It forces people to know the arguments. It isn't very flexible neither. When manually building the project, I may want to get normal cppcheck reports and only generate the XML reports when running CI/CD.

I like the 3rd option but I'm afraid it would make the project more and more complex if new health tools are added in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants