tools: Added cppcheck for C/C++ files.

This commit is contained in:
Andrew Hamilton 2017-12-13 19:03:21 +10:00
parent 257eae4e73
commit 45a3f1ede8
3 changed files with 11 additions and 4 deletions

View file

@ -30,9 +30,9 @@ Extensions | Tools
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/) .pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
.pod .pod6 | [perldoc](http://perldoc.perl.org/) .pod .pod6 | [perldoc](http://perldoc.perl.org/)
.java | [uncrustify](https://github.com/uncrustify/uncrustify) .java | [uncrustify](https://github.com/uncrustify/uncrustify)
.c .h | [c_syntax_gcc](https://gcc.gnu.org/) • [splint](http://www.splint.org/) • [uncrustify](https://github.com/uncrustify/uncrustify) .c .h | [c_syntax_gcc](https://gcc.gnu.org/) • [splint](http://www.splint.org/) • [uncrustify](https://github.com/uncrustify/uncrustify) • [cppcheck](http://sourceforge.net/p/cppcheck/wiki/Home/)
.o | [objdump_headers](https://en.wikipedia.org/wiki/Objdump) • [objdump_disassemble](https://en.wikipedia.org/wiki/Objdump) • [readelf](https://en.wikipedia.org/wiki/Objdump) .o | [objdump_headers](https://en.wikipedia.org/wiki/Objdump) • [objdump_disassemble](https://en.wikipedia.org/wiki/Objdump) • [readelf](https://en.wikipedia.org/wiki/Objdump)
.cc .cpp .hpp | [cpp_syntax_gcc](https://gcc.gnu.org/) • bcpp • [uncrustify](https://github.com/uncrustify/uncrustify) .cc .cpp .hpp | [cpp_syntax_gcc](https://gcc.gnu.org/) • bcpp • [uncrustify](https://github.com/uncrustify/uncrustify) • [cppcheck](http://sourceforge.net/p/cppcheck/wiki/Home/)
.pdf | [pdf2txt](http://www.unixuser.org/~euske/python/pdfminer/) .pdf | [pdf2txt](http://www.unixuser.org/~euske/python/pdfminer/)
.html | [html_syntax](http://www.html-tidy.org/) • [tidy](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/) .html | [html_syntax](http://www.html-tidy.org/) • [tidy](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/)
.php | [php7_syntax](https://en.wikipedia.org/wiki/PHP) .php | [php7_syntax](https://en.wikipedia.org/wiki/PHP)

2
TODO
View file

@ -6,6 +6,7 @@ Todo (tool related)
- Report on python doctests. (also coverage of) - Report on python doctests. (also coverage of)
- Cache tools._python_version. - Cache tools._python_version.
- Colourise git_diff. - Colourise git_diff.
- Add shellcheck tool for shell scripts.
Done Done
@ -164,6 +165,7 @@ Done
<- Yes, but wait for it to be included in python, or until it is an ubuntu package. <- Yes, but wait for it to be included in python, or until it is an ubuntu package.
- Add bandit tool for python. - Add bandit tool for python.
- Created a setup.py file. - Created a setup.py file.
- Add cppcheck tool for C and C++.
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
A B C D E F G H A B C D E F G H

View file

@ -612,6 +612,11 @@ def uncrustify(path):
return status, _syntax_highlight_using_path(stdout, path) return status, _syntax_highlight_using_path(stdout, path)
@deps(deps={"cppcheck"}, url="cppcheck", executables={"cppcheck"})
def cppcheck(path):
return _run_command(["cppcheck", path])
@deps(deps={"php7.1-cli"}, url="https://en.wikipedia.org/wiki/PHP", @deps(deps={"php7.1-cli"}, url="https://en.wikipedia.org/wiki/PHP",
executables={"php7.1"}) executables={"php7.1"})
def php7_syntax(path): def php7_syntax(path):
@ -815,9 +820,9 @@ TOOLS_FOR_EXTENSIONS = \
# (["p6", "pm6"], [perl6_syntax, perldoc]), # (["p6", "pm6"], [perl6_syntax, perldoc]),
(["pod", "pod6"], [perldoc]), (["pod", "pod6"], [perldoc]),
(["java"], [uncrustify]), (["java"], [uncrustify]),
(["c", "h"], [c_syntax_gcc, splint, uncrustify]), (["c", "h"], [c_syntax_gcc, splint, uncrustify, cppcheck]),
(["o"], [objdump_headers, objdump_disassemble, readelf]), (["o"], [objdump_headers, objdump_disassemble, readelf]),
(["cc", "cpp", "hpp"], [cpp_syntax_gcc, bcpp, uncrustify]), (["cc", "cpp", "hpp"], [cpp_syntax_gcc, bcpp, uncrustify, cppcheck]),
(["pdf"], [pdf2txt]), (["pdf"], [pdf2txt]),
(["html"], [html_syntax, tidy, html2text]), (["html"], [html_syntax, tidy, html2text]),
(["php"], [php7_syntax]), (["php"], [php7_syntax]),