SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.63k stars 1.11k forks source link

Static code analysis #49

Open TheJJ opened 9 years ago

TheJJ commented 9 years ago

In addition to test cases, we should have some kind of static code analysis integrated into the buildsystem.

jamesmintram commented 9 years ago

I have used CPPCheck on other projects - it is good for hooking into CI too: http://cppcheck.sourceforge.net/

franciscod commented 9 years ago

this looks nice for code style too: http://nsiqcppstyle.appspot.com/rule_doc

rnestler commented 9 years ago

clang-analyzer is really nice: http://clang-analyzer.llvm.org/ Compared to CPPCheck it has the advantage of really understanding C++.

mic-e commented 9 years ago

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

TheJJ commented 7 years ago

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