File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ DART="${DART_BIN}/dart"
3636# to have this as an error.
3737MAC_HOST_WARNINGS_AS_ERRORS=" performance-move-const-arg,performance-unnecessary-value-param"
3838
39+ # FLUTTER_LINT_PRINT_FIX will make it so that fix is executed and the generated
40+ # diff is printed to stdout if clang-tidy fails. This is helpful for enabling
41+ # new lints.
42+ if [[ -z " ${FLUTTER_LINT_PRINT_FIX} " ]]; then
43+ fix_flag=" "
44+ else
45+ fix_flag=" --fix"
46+ fi
47+
3948COMPILE_COMMANDS=" $SRC_DIR /out/host_debug/compile_commands.json"
4049if [ ! -f " $COMPILE_COMMANDS " ]; then
4150 (cd " $SRC_DIR " ; ./flutter/tools/gn)
@@ -49,7 +58,18 @@ cd "$SCRIPT_DIR"
4958 " $SRC_DIR /flutter/tools/clang_tidy/bin/main.dart" \
5059 --src-dir=" $SRC_DIR " \
5160 --mac-host-warnings-as-errors=" $MAC_HOST_WARNINGS_AS_ERRORS " \
52- " $@ "
61+ $fix_flag \
62+ " $@ " && true # errors ignored
63+ clang_tidy_return=$?
64+ if [ $clang_tidy_return -ne 0 ]; then
65+ if [ -n " $fix_flag " ]; then
66+ echo " ###################################################"
67+ echo " # Attempted to fix issues with the following patch:"
68+ echo " ###################################################"
69+ git --no-pager diff
70+ fi
71+ exit $clang_tidy_return
72+ fi
5373
5474echo " $( date +%T) Running pylint"
5575
You can’t perform that action at this time.
0 commit comments