Contents
Clang-tidy
Command Line
To check C++ code using ISO C++17, we use the following flags:
clang-tidy -header-filter=.* filename.cpp -- -std=c++17 $
Checks
The list of enabled checks we use when running clang-tidy is given below. You can also download the clang-tidy config file we use. To use it, rename it to .clang-tidy
and put it in the root of your project repository. You can read more about the checks here.
boost-use-to-string
bugprone-suspicious-memset-usage
bugprone-undefined-memory-manipulation
cert-dcl50-cpp
cert-env33-c
cert-err34-c
cert-err52-cpp
cert-err58-cpp
cert-err60-cpp
cert-flp30-c
cppcoreguidelines-interfaces-global-init
cppcoreguidelines-no-malloc
cppcoreguidelines-pro-type-const-cast
cppcoreguidelines-pro-type-cstyle-cast
cppcoreguidelines-pro-type-reinterpret-cast
cppcoreguidelines-pro-type-static-cast-downcast
cppcoreguidelines-pro-type-union-access
cppcoreguidelines-pro-type-vararg
cppcoreguidelines-slicing
google-build-explicit-make-pair
google-build-namespaces
google-default-arguments
google-explicit-constructor
google-global-names-in-headers
google-readability-casting
google-readability-todo
google-runtime-int
google-runtime-member-string-references
google-runtime-operator
llvm-namespace-comment
misc-argument-comment
misc-assert-side-effect
misc-dangling-handle
misc-definitions-in-headers
misc-fold-init-type
misc-forward-declaration-namespace
misc-forwarding-reference-overload
misc-inaccurate-erase
misc-incorrect-roundings
misc-inefficient-algorithm
misc-lambda-function-name
misc-macro-parentheses
misc-macro-repeated-side-effects
misc-misplaced-const
misc-misplaced-widening-cast
misc-move-const-arg
misc-move-constructor-init
misc-move-forwarding-reference
misc-multiple-statement-macro
misc-new-delete-overloads
misc-noexcept-move-constructor
misc-non-copyable-objects
misc-redundant-expression
misc-sizeof-container
misc-sizeof-expression
misc-static-assert
misc-string-compare
misc-string-constructor
misc-string-integer-assignment
misc-string-literal-with-embedded-nul
misc-suspicious-enum-usage
misc-suspicious-semicolon
misc-suspicious-string-compare
misc-swapped-arguments
misc-throw-by-value-catch-by-reference
misc-unconventional-assign-operator
misc-undelegated-constructor
misc-uniqueptr-reset-release
misc-unused-alias-decls
misc-unused-parameters
misc-unused-raii
misc-unused-using-decls
misc-virtual-near-miss
modernize-avoid-bind
modernize-deprecated-headers
modernize-loop-convert
modernize-make-shared
modernize-make-unique
modernize-pass-by-value
modernize-raw-string-literal
modernize-redundant-void-arg
modernize-replace-auto-ptr
modernize-replace-random-shuffle
modernize-return-braced-init-list
modernize-shrink-to-fit
modernize-unary-static-assert
modernize-use-auto
modernize-use-bool-literals
modernize-use-default-member-init
modernize-use-emplace
modernize-use-equals-default
modernize-use-equals-delete
modernize-use-noexcept
modernize-use-nullptr
modernize-use-override
modernize-use-using
performance-faster-string-find
performance-for-range-copy
performance-implicit-cast-in-loop
performance-inefficient-string-concatenation
performance-inefficient-vector-operation
performance-unnecessary-copy-initialization
performance-unnecessary-value-param
readability-avoid-const-params-in-decls
readability-container-size-empty
readability-delete-null-pointer
readability-deleted-default
readability-else-after-return
readability-function-size
readability-inconsistent-declaration-parameter-name
readability-misleading-indentation
readability-misplaced-array-index
readability-named-parameter
readability-non-const-parameter
readability-redundant-control-flow
readability-redundant-function-ptr-dereference
readability-redundant-member-init
readability-redundant-smartptr-get
readability-redundant-string-cstr
readability-redundant-string-init
readability-simplify-boolean-expr
readability-static-definition-in-anonymous-namespace
readability-uniqueptr-delete-release