mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 05:31:37 +08:00
run-clang-tidy only display output on error
This commit is contained in:
+123
-18
@@ -1,35 +1,91 @@
|
|||||||
Checks: 'clang-diagnostic-*,-*,
|
---
|
||||||
clang-analyzer-optin.performance.Padding,
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,
|
||||||
clang-analyzer-unix.cstring.*,
|
## reorder fw_pos_ctrl and reenable # clang-analyzer-optin.performance.Padding,
|
||||||
|
## evaluate # clang-analyzer-unix.cstring.*,
|
||||||
|
#clang-analyzer-security.*,
|
||||||
clang-analyzer-unix.StdCLibraryFunctions,
|
clang-analyzer-unix.StdCLibraryFunctions,
|
||||||
|
misc-argument-comment,
|
||||||
|
misc-assert-side-effect,
|
||||||
|
misc-bool-pointer-implicit-conversion,
|
||||||
|
misc-dangling-handle,
|
||||||
|
misc-definitions-in-headers,
|
||||||
|
misc-fold-init-type,
|
||||||
|
misc-forward-declaration-namespace,
|
||||||
|
misc-inaccurate-erase,
|
||||||
|
#misc-incorrect-roundings,
|
||||||
|
misc-inefficient-algorithm,
|
||||||
|
#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-missing-comma,
|
||||||
|
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-use-after-move,
|
||||||
|
misc-virtual-near-miss,
|
||||||
misc-unused-raii,
|
misc-unused-raii,
|
||||||
misc-virtual-near-miss,
|
misc-virtual-near-miss,
|
||||||
|
## fix code and enable # modernize-use-default-member-init,
|
||||||
|
## fix code and enable # modernize-use-emplace,
|
||||||
|
## fix code and enable # modernize-use-equals-default,
|
||||||
|
modernize-use-transparent-functors,
|
||||||
modernize-redundant-void-arg,
|
modernize-redundant-void-arg,
|
||||||
modernize-use-nullptr,
|
modernize-use-nullptr,
|
||||||
|
performance-faster-string-find,
|
||||||
|
performance-for-range-copy,
|
||||||
|
performance-implicit-cast-in-loop,
|
||||||
|
## fix code and enable # performance-inefficient-string-concatenation,
|
||||||
|
#performance-type-promotion-in-math-fn,
|
||||||
|
## fix code and enable # performance-unnecessary-copy-initialization,
|
||||||
|
## fix code and enable # performance-unnecessary-value-param,
|
||||||
|
## fix code and enable # readability-avoid-const-params-in-decls,
|
||||||
readability-braces-around-statements,
|
readability-braces-around-statements,
|
||||||
|
readability-container-size-empty,
|
||||||
readability-delete-null-pointer,
|
readability-delete-null-pointer,
|
||||||
readability-deleted-default,
|
readability-deleted-default,
|
||||||
|
readability-function-size,
|
||||||
readability-identifier-naming,
|
readability-identifier-naming,
|
||||||
|
#readability-inconsistent-declaration-parameter-name,
|
||||||
|
readability-misplaced-array-index,
|
||||||
|
## fix code and enable # readability-named-parameter,
|
||||||
|
#readability-non-const-parameter,
|
||||||
readability-redundant-control-flow,
|
readability-redundant-control-flow,
|
||||||
readability-redundant-function-ptr-dereference,
|
readability-redundant-function-ptr-dereference,
|
||||||
|
## fix code and enable # readability-redundant-member-init,
|
||||||
|
readability-redundant-smartptr-get,
|
||||||
readability-redundant-string-cstr,
|
readability-redundant-string-cstr,
|
||||||
readability-redundant-string-init,
|
readability-redundant-string-init,
|
||||||
|
## fix code and enable # readability-simplify-boolean-expr,
|
||||||
|
#readability-static-definition-in-anonymous-namespace,
|
||||||
|
readability-uniqueptr-delete-release,
|
||||||
'
|
'
|
||||||
WarningsAsErrors: '
|
WarningsAsErrors: '*'
|
||||||
misc-unused-raii,
|
HeaderFilterRegex: '*.h, *.hpp, *.hh, *.hxx'
|
||||||
misc-virtual-near-miss,
|
|
||||||
modernize-redundant-void-arg,
|
|
||||||
modernize-use-nullptr,
|
|
||||||
readability-braces-around-statements,
|
|
||||||
readability-delete-null-pointer,
|
|
||||||
readability-deleted-default,
|
|
||||||
readability-identifier-naming,
|
|
||||||
readability-redundant-control-flow,
|
|
||||||
readability-redundant-function-ptr-dereference,
|
|
||||||
readability-redundant-string-cstr,
|
|
||||||
readability-redundant-string-init,
|
|
||||||
'
|
|
||||||
HeaderFilterRegex: '*.h, *.hpp'
|
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
@@ -40,6 +96,40 @@ CheckOptions:
|
|||||||
value: '10'
|
value: '10'
|
||||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
value: '2'
|
value: '2'
|
||||||
|
- key: misc-argument-comment.StrictMode
|
||||||
|
value: '0'
|
||||||
|
- key: misc-assert-side-effect.AssertMacros
|
||||||
|
value: assert
|
||||||
|
- key: misc-assert-side-effect.CheckFunctionCalls
|
||||||
|
value: '0'
|
||||||
|
- key: misc-dangling-handle.HandleClasses
|
||||||
|
value: 'std::basic_string_view;std::experimental::basic_string_view'
|
||||||
|
- key: misc-definitions-in-headers.HeaderFileExtensions
|
||||||
|
value: ',h,hh,hpp,hxx'
|
||||||
|
- key: misc-definitions-in-headers.UseHeaderFileExtension
|
||||||
|
value: '1'
|
||||||
|
- key: misc-move-constructor-init.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: misc-sizeof-expression.WarnOnSizeOfCompareToConstant
|
||||||
|
value: '1'
|
||||||
|
- key: misc-sizeof-expression.WarnOnSizeOfConstant
|
||||||
|
value: '1'
|
||||||
|
- key: misc-sizeof-expression.WarnOnSizeOfThis
|
||||||
|
value: '1'
|
||||||
|
- key: misc-string-constructor.LargeLengthThreshold
|
||||||
|
value: '8388608'
|
||||||
|
- key: misc-string-constructor.WarnOnLargeLength
|
||||||
|
value: '1'
|
||||||
|
- key: misc-suspicious-enum-usage.StrictMode
|
||||||
|
value: '0'
|
||||||
|
- key: misc-suspicious-string-compare.StringCompareLikeFunctions
|
||||||
|
value: ''
|
||||||
|
- key: misc-suspicious-string-compare.WarnOnImplicitComparison
|
||||||
|
value: '1'
|
||||||
|
- key: misc-suspicious-string-compare.WarnOnLogicalNotComparison
|
||||||
|
value: '0'
|
||||||
|
- key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
|
||||||
|
value: '1'
|
||||||
- key: modernize-loop-convert.MaxCopySize
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
value: '16'
|
value: '16'
|
||||||
- key: modernize-loop-convert.MinConfidence
|
- key: modernize-loop-convert.MinConfidence
|
||||||
@@ -52,8 +142,22 @@ CheckOptions:
|
|||||||
value: llvm
|
value: llvm
|
||||||
- key: modernize-use-nullptr.NullMacros
|
- key: modernize-use-nullptr.NullMacros
|
||||||
value: 'NULL'
|
value: 'NULL'
|
||||||
|
- key: modernize-use-transparent-functors.SafeMode
|
||||||
|
value: '0'
|
||||||
|
- key: performance-faster-string-find.StringLikeClasses
|
||||||
|
value: 'std::basic_string'
|
||||||
|
- key: performance-for-range-copy.WarnOnAllAutoCopies
|
||||||
|
value: '0'
|
||||||
|
- key: performance-inefficient-string-concatenation.StrictMode
|
||||||
|
value: '0'
|
||||||
- key: readability-braces-around-statements.ShortStatementLines
|
- key: readability-braces-around-statements.ShortStatementLines
|
||||||
value: '1'
|
value: '1'
|
||||||
|
- key: readability-function-size.BranchThreshold
|
||||||
|
value: '600'
|
||||||
|
- key: readability-function-size.LineThreshold
|
||||||
|
value: '3000'
|
||||||
|
- key: readability-function-size.StatementThreshold
|
||||||
|
value: '3400'
|
||||||
- key: readability-identifier-naming.AbstractClassCase
|
- key: readability-identifier-naming.AbstractClassCase
|
||||||
value: aNy_CasE
|
value: aNy_CasE
|
||||||
- key: readability-identifier-naming.AbstractClassPrefix
|
- key: readability-identifier-naming.AbstractClassPrefix
|
||||||
@@ -320,3 +424,4 @@ CheckOptions:
|
|||||||
value: ''
|
value: ''
|
||||||
- key: readability-identifier-naming.VirtualMethodSuffix
|
- key: readability-identifier-naming.VirtualMethodSuffix
|
||||||
value: ''
|
value: ''
|
||||||
|
...
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ script:
|
|||||||
elif [[ "${BUILD_TARGET}" = "tests_linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
elif [[ "${BUILD_TARGET}" = "tests_linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||||
./Tools/docker_run.sh 'make tests';
|
./Tools/docker_run.sh 'make tests';
|
||||||
elif [[ "${BUILD_TARGET}" = "clang-tidy" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
elif [[ "${BUILD_TARGET}" = "clang-tidy" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||||
PX4_DOCKER_REPO=px4io/px4-dev-clang ./Tools/docker_run.sh 'make clang-tidy';
|
PX4_DOCKER_REPO=px4io/px4-dev-clang ./Tools/docker_run.sh 'make clang-tidy-parallel';
|
||||||
elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
|
elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
|
||||||
make tests;
|
make tests;
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ clang-tidy:
|
|||||||
clang-tidy-parallel:
|
clang-tidy-parallel:
|
||||||
rm -rf $(SRC_DIR)/build_posix_sitl_default
|
rm -rf $(SRC_DIR)/build_posix_sitl_default
|
||||||
@CC=clang CXX=clang++ $(MAKE) --no-print-directory posix_sitl_default
|
@CC=clang CXX=clang++ $(MAKE) --no-print-directory posix_sitl_default
|
||||||
@run-clang-tidy.py -j$(j) -p $(SRC_DIR)/build_posix_sitl_default
|
@$(SRC_DIR)/Tools/run-clang-tidy.py -j$(j) -p $(SRC_DIR)/build_posix_sitl_default
|
||||||
|
|
||||||
clang-tidy-fix:
|
clang-tidy-fix:
|
||||||
rm -rf $(SRC_DIR)/build_posix_sitl_default
|
rm -rf $(SRC_DIR)/build_posix_sitl_default
|
||||||
|
|||||||
+16
-2
@@ -46,6 +46,8 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
tidy_failures = 0
|
||||||
|
|
||||||
|
|
||||||
def find_compilation_database(path):
|
def find_compilation_database(path):
|
||||||
"""Adjusts the directory until a compilation database is found."""
|
"""Adjusts the directory until a compilation database is found."""
|
||||||
@@ -102,8 +104,15 @@ def run_tidy(args, tmpdir, build_path, queue):
|
|||||||
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
|
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
|
||||||
tmpdir, build_path, args.header_filter,
|
tmpdir, build_path, args.header_filter,
|
||||||
args.extra_arg, args.extra_arg_before)
|
args.extra_arg, args.extra_arg_before)
|
||||||
sys.stdout.write(' '.join(invocation) + '\n')
|
|
||||||
subprocess.call(invocation)
|
try:
|
||||||
|
subprocess.check_call(invocation, stdin=None, stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT)
|
||||||
|
except subprocess.CalledProcessError, e:
|
||||||
|
sys.stdout.write(' '.join(invocation) + '\n')
|
||||||
|
subprocess.call(invocation)
|
||||||
|
global tidy_failures
|
||||||
|
tidy_failures = tidy_failures + 1
|
||||||
|
|
||||||
queue.task_done()
|
queue.task_done()
|
||||||
|
|
||||||
|
|
||||||
@@ -208,5 +217,10 @@ def main():
|
|||||||
print 'Applying fixes ...'
|
print 'Applying fixes ...'
|
||||||
apply_fixes(args, tmpdir)
|
apply_fixes(args, tmpdir)
|
||||||
|
|
||||||
|
global tidy_failures
|
||||||
|
if tidy_failures > 0:
|
||||||
|
print >>sys.stderr, "clang-tidy errors: ", tidy_failures
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user