forked from Archive/PX4-Autopilot
clang-tidy readability-braces-around-statements
This commit is contained in:
parent
fedc1279e4
commit
6961a513c7
47
.clang-tidy
47
.clang-tidy
|
@ -1,46 +1,7 @@
|
|||
# clang-tidy checks http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
Checks: '-*,
|
||||
cert-flp30-c,
|
||||
clang-analyzer-cplusplus,
|
||||
clang-analyzer-unix*,
|
||||
google-readability-casting,
|
||||
google-readability-todo,
|
||||
misc-redundant-expression,
|
||||
misc-sizeof-container,
|
||||
misc-sizeof-expression,
|
||||
misc-string-compare,
|
||||
misc-suspicious-semicolon,
|
||||
misc-suspicious-string-compare,
|
||||
misc-swapped-arguments,
|
||||
misc-undelegated-constructor,
|
||||
misc-unused-alias-decls,
|
||||
misc-unused-parameters,
|
||||
misc-unused-raii,
|
||||
misc-unused-using-decls,
|
||||
misc-virtual-near-miss,
|
||||
performance-*,
|
||||
readability-braces-around-statements,
|
||||
readability-container-size-empty,
|
||||
readability-else-after-return,
|
||||
readability-function-size,
|
||||
readability-identifier-naming,
|
||||
readability-inconsistent-declaration-parameter-name,
|
||||
readability-named-parameter,
|
||||
readability-redundant-smartptr-get,
|
||||
readability-redundant-string-cstr,
|
||||
readability-simplify-boolean-expr,
|
||||
readability-uniqueptr-delete-release,
|
||||
'
|
||||
Checks: '-*,readability-braces-around-statements'
|
||||
WarningsAsErrors: readability-braces-around-statements
|
||||
HeaderFilterRegex: '*.h, *.hpp'
|
||||
AnalyzeTemporaryDtors: false
|
||||
CheckOptions:
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
- key: readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
|
||||
#WarningsAsErrors:
|
||||
|
|
15
.travis.yml
15
.travis.yml
|
@ -13,9 +13,16 @@ matrix:
|
|||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env: BUILD_TARGET=qgc_firmware
|
||||
- os: linux
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env: BUILD_TARGET=clang-tidy PX4_DOCKER_REPO=px4io/px4-dev-clang
|
||||
- os: osx
|
||||
sudo: true
|
||||
osx_image: xcode8
|
||||
env: BUILD_TARGET=tests
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
|
@ -34,15 +41,17 @@ env:
|
|||
- secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk="
|
||||
|
||||
script:
|
||||
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||
- if [[ "${BUILD_TARGET}" = "qgc_firmware" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||
./Tools/docker_run.sh 'make qgc_firmware';
|
||||
elif [[ "${BUILD_TARGET}" = "clang-tidy" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||
PX4_DOCKER_REPO=px4io/px4-dev-clang ./Tools/docker_run.sh 'make clang-tidy';
|
||||
elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
|
||||
make tests;
|
||||
fi
|
||||
|
||||
after_success:
|
||||
# s3 deploy individual firmware files (.px4), Firmware.zip, airframe.xml, and param.xml
|
||||
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||
- if [[ "${BUILD_TARGET}" = "qgc_firmware" && "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||
./Tools/docker_run.sh 'make s3put_firmware AWS_S3_BUCKET="px4-travis/archives/Firmware/${TRAVIS_BRANCH}/${TRAVIS_BUILD_ID}"'
|
||||
&& ./Tools/docker_run.sh 'make s3put_qgc_firmware AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}"';
|
||||
fi
|
||||
|
@ -58,7 +67,7 @@ deploy:
|
|||
tags: true
|
||||
all_branches: true
|
||||
repo: PX4/Firmware
|
||||
condition: $TRAVIS_OS_NAME = linux
|
||||
condition: $BUILD_TARGET = qgc_firmware
|
||||
|
||||
addons:
|
||||
coverity_scan:
|
||||
|
|
8
Makefile
8
Makefile
|
@ -293,8 +293,14 @@ clang-check:
|
|||
@$(SRC_DIR)/Tools/clang-tool.sh -b build_posix_sitl_default -t clang-check
|
||||
|
||||
clang-tidy:
|
||||
rm -rf $(SRC_DIR)/build_posix_sitl_default
|
||||
@CC=clang CXX=clang++ $(MAKE) --no-print-directory posix_sitl_default
|
||||
@$(SRC_DIR)/Tools/clang-tool.sh -b build_posix_sitl_default -t clang-tidy
|
||||
@run-clang-tidy.py -j$(j) -p $(SRC_DIR)/build_posix_sitl_default
|
||||
|
||||
clang-tidy-fix:
|
||||
rm -rf $(SRC_DIR)/build_posix_sitl_default
|
||||
@CC=clang CXX=clang++ $(MAKE) --no-print-directory posix_sitl_default
|
||||
@run-clang-tidy.py -fix -j$(j) -p $(SRC_DIR)/build_posix_sitl_default
|
||||
|
||||
# Cleanup
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -41,16 +41,26 @@ case "${tool}" in
|
|||
;;
|
||||
"clang-tidy")
|
||||
command=clang-tidy
|
||||
option=-header-filter=.*
|
||||
#option=-fix
|
||||
;;
|
||||
esac
|
||||
|
||||
grep file ${COMPILE_DB}/compile_commands.json |
|
||||
awk '{ print $2; }' |
|
||||
sed 's/\"//g' |
|
||||
while read FILE; do
|
||||
(cd $(dirname ${FILE});
|
||||
echo ${FILE}
|
||||
${command} ${option} -p ${COMPILE_DB} ${extra_args} $(basename ${FILE}));
|
||||
echo
|
||||
done
|
||||
failed=0
|
||||
while read line; do
|
||||
file_line=$(echo $line | grep \"file\")
|
||||
if [ $? -eq 0 ]; then
|
||||
file_path=$(echo $file_line | awk '{ print $2; }' | sed 's/\"//g')
|
||||
|
||||
echo ${file_path}
|
||||
${command} ${option} -p ${COMPILE_DB} ${extra_args} ${file_path}
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
failed=1
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
done <${COMPILE_DB}/compile_commands.json
|
||||
|
||||
if [ $failed -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -15,6 +15,7 @@ X11_TMP=/tmp/.X11-unix
|
|||
docker run -it --rm -w ${SRC_DIR} \
|
||||
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
||||
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
||||
-e BRANCH_NAME=${BRANCH_NAME} \
|
||||
-e CCACHE_DIR=${CCACHE_DIR} \
|
||||
-e CI=${CI} \
|
||||
-e DISPLAY=$DISPLAY \
|
||||
|
|
|
@ -692,6 +692,8 @@ function(px4_add_common_flags)
|
|||
-Qunused-arguments
|
||||
-Wno-unused-const-variable
|
||||
-Wno-varargs
|
||||
-Wno-address-of-packed-member
|
||||
-Wno-unknown-warning-option
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
|
|
Loading…
Reference in New Issue