Title: cppcheck options: add --output-file-type option by RobertWak · Pull Request #3365 · cppcheck-opensource/cppcheck · GitHub
Open Graph Title: cppcheck options: add --output-file-type option by RobertWak · Pull Request #3365 · cppcheck-opensource/cppcheck
X Title: cppcheck options: add --output-file-type option by RobertWak · Pull Request #3365 · cppcheck-opensource/cppcheck
Description: When used with tools such as cmake, cppcheck doesn't provide an convenient way to output into files.
I've added two values for new --output-file-type option:
uniq: this will create a output file name based on the --output-file and the current file(s) that are analyzed
append: this will open the --output-file file in append mode and add the content to it
example:
Not using the new option:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml cli/cmdlineparser.cpp
$ ls -la output_files/
total 12
drwxrwxr-x 2 user user 4096 Jul 22 14:47 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 1283 Jul 22 14:47 cppcheck.xml
Using the option with value "uniq" for one file:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml --output-file-type=uniq cli/cmdlineparser.cpp
$ ls -la output_files/
total 12
drwxrwxr-x 2 user user 4096 Jul 22 14:48 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 1283 Jul 22 14:48 cppcheck_cmdlineparser_cpp.xml
Using the option with value "uniq" for one file without extension:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck --output-file-type=uniq cli/cmdlineparser.cpp
$ ls -la output_files/
total 12
drwxrwxr-x 2 user user 4096 Jul 22 14:48 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 1283 Jul 22 14:48 cppcheck_cmdlineparser_cpp
Using the option with value "uniq" for two files:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml --output-file-type=uniq cli/cmdlineparser.cpp cli/cppcheckexecutor.cpp
$ ls -la output_files/
total 16
drwxrwxr-x 2 user user 4096 Jul 22 14:49 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 4308 Jul 22 14:49 cppcheck_cmdlineparser_cpp_cppcheckexecutor_cpp.xml
Using the option with value "append" for one file on a empty/non-existing file:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml --output-file-type=append cli/cmdlineparser.cpp
$ ls -la output_files/
total 12
drwxrwxr-x 2 user user 4096 Jul 22 14:51 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 1283 Jul 22 14:51 cppcheck.xml
Using the option with value "append" for two files on a empty/non-existing file:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml --output-file-type=append cli/cmdlineparser.cpp cli/cppcheckexecutor.cpp
$ ls -la output_files/
total 16
drwxrwxr-x 2 user user 4096 Jul 22 14:53 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 4308 Jul 22 14:53 cppcheck.xml
Using the option with value twise "append" for one file on a empty/non-existing file:
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml --output-file-type=append cli/cmdlineparser.cpp
$ cppcheck --enable=all --xml --xml-version=2 --output-file=output_files/cppcheck.xml --output-file-type=append cli/cppcheckexecutor.cpp
$ ls -la output_files/
total 16
drwxrwxr-x 2 user user 4096 Jul 22 14:54 .
drwxrwxr-x 26 user user 4096 Jul 22 14:36 ..
-rw-rw-r-- 1 user user 5613 Jul 22 14:55 cppcheck.xml
/!\ the file is a pure concatenation of the files created without the "append" value which means that it's no more a valid XML file as it will have twice the "" entry
$ cat output_files/cppcheck.xml
Open Graph Description: When used with tools such as cmake, cppcheck doesn't provide an convenient way to output into files. I've added two values for new --output-file-type option: uniq: this will create a...
X Description: When used with tools such as cmake, cppcheck doesn't provide an convenient way to output into files. I've added two values for new --output-file-type option: uniq: this will ...
Opengraph URL: https://github.com/cppcheck-opensource/cppcheck/pull/3365
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9406dfc3-4946-907c-dec0-977b17e2e47b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8038:3ADF04:571B89:78CAA5:6A50719A |
| html-safe-nonce | bd382abf615a0a5fccb8ea6b270f31c5e80fbc96c02d3e91c78b3044a73f68c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDM4OjNBREYwNDo1NzFCODk6NzhDQUE1OjZBNTA3MTlBIiwidmlzaXRvcl9pZCI6Ijc4ODQ0NDY2NDU4ODE5NTg4MTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 249ef06575eaf35c3cc4283607f414f64426b6f21bdee7f83557235fe2f6f012 |
| hovercard-subject-tag | pull_request:699339265 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cppcheck-opensource/cppcheck/pull/3365/files |
| twitter:image | https://avatars.githubusercontent.com/u/77058042?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/77058042?s=400&v=4 |
| og:image:alt | When used with tools such as cmake, cppcheck doesn't provide an convenient way to output into files. I've added two values for new --output-file-type option: uniq: this will create a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cppcheck-opensource/cppcheck git https://github.com/cppcheck-opensource/cppcheck.git |
| octolytics-dimension-user_id | 278097703 |
| octolytics-dimension-user_login | cppcheck-opensource |
| octolytics-dimension-repository_id | 143131 |
| octolytics-dimension-repository_nwo | cppcheck-opensource/cppcheck |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143131 |
| octolytics-dimension-repository_network_root_nwo | cppcheck-opensource/cppcheck |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width