Size: 106
Comment:
|
Size: 1611
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
[[http://clang.llvm.org/extra/clang-tidy/index.html|Clang-Tidy — Extra Clang Tools 3.9 documentation]] | == C++ style guides == * [[https://google.github.io/styleguide/cppguide.html|Google]] * [[http://llvm.org/docs/CodingStandards.html|LLVM]] * [[http://www.chromium.org/developers/coding-style|Chrome/Chromium]] * [[https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style|Mozilla]] * [[http://www.webkit.org/coding/coding-style.html|WebKit]] * Qt's [[https://wiki.qt.io/Qt_Coding_Style|Coding Style]] and [[https://wiki.qt.io/Coding_Conventions|Coding Conventions]] == Formatting == [[http://clang.llvm.org/docs/ClangFormat.html|ClangFormat]]: auto-formats C++ code * [[https://github.com/andrewseidl/githook-clang-format|Git hook running clang-format]]. Don't use this! == Static analysis tools == * [[http://clang.llvm.org/extra/clang-tidy/index.html|Clang-Tidy]]: C/C++ linting tool, à la Google's cpplint. {{{ clang-tidy -checks='*' *.cpp -- -std=c++11 }}} * [[http://clang-analyzer.llvm.org/|Clang Static Analyzer]]: sets CC and CXX to use alternate compiler to do analysis * [[http://cppcheck.sourceforge.net/|Cppcheck]]; [[https://github.com/danmar/cppcheck/|github:danmar/cppcheck]] {{{#!highlight sh numbers=off # Highest severity warnings only (i.e. memory leaks, etc) cppcheck --enable=all *.cpp # Everything except style-related linting cppcheck --enable=warning,performance,portability,information,missingInclude \ --std=c++11 --library=std.cfg --verbose --quiet \ *.cpp }}} Overview articles: * [[https://arcanis.me/en/2015/10/17/cppcheck-and-clang-format/|Add cppcheck and clang-format for a cmake project]] |
C++ style guides
Formatting
ClangFormat: auto-formats C++ code
Git hook running clang-format. Don't use this!
Static analysis tools
Clang-Tidy: C/C++ linting tool, à la Google's cpplint.
clang-tidy -checks='*' *.cpp -- -std=c++11
Clang Static Analyzer: sets CC and CXX to use alternate compiler to do analysis
# Highest severity warnings only (i.e. memory leaks, etc)
cppcheck --enable=all *.cpp
# Everything except style-related linting
cppcheck --enable=warning,performance,portability,information,missingInclude \
--std=c++11 --library=std.cfg --verbose --quiet \
*.cpp
Overview articles: