Open TheJJ opened 9 years ago
I have used CPPCheck on other projects - it is good for hooking into CI too: http://cppcheck.sourceforge.net/
this looks nice for code style too: http://nsiqcppstyle.appspot.com/rule_doc
clang-analyzer is really nice: http://clang-analyzer.llvm.org/ Compared to CPPCheck it has the advantage of really understanding C++.
Regarding code style: C++ is so feature-rich that I doubt we'll ever be able to translate our style guidelines to even semi-complete machine-readable code, so at the very most, we might check stuff like the capitalization of identifiers... Regarding clang-analyzer: Looks promising... but the travis build times won't be happy: While the Clang Static Analyzer is being designed to be as fast and light-weight as possible, please do not expect it to be as fast as compiling a program
http://baptiste-wicht.com/posts/2014/04/install-use-clang-static-analyzer-cmake.html
So we should just integrate that into the ./configure
script.
mkdir /tmp/openage-analysis
cd /tmp/openage-analysis
export CCC_CXX=clang++ CXX=clang++
scan-build cmake /path/to/git/repo
scan-build make
scan-view /tmp/scan-build-....
also: https://redmine.lighttpd.net/projects/lighttpd2/wiki/ClangAnalyzer
In addition to test cases, we should have some kind of static code analysis integrated into the buildsystem.