This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 1 file changed +21
-1
lines changed
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"
36
36
# to have this as an error.
37
37
MAC_HOST_WARNINGS_AS_ERRORS=" performance-move-const-arg,performance-unnecessary-value-param"
38
38
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
+
39
48
COMPILE_COMMANDS=" $SRC_DIR /out/host_debug/compile_commands.json"
40
49
if [ ! -f " $COMPILE_COMMANDS " ]; then
41
50
(cd " $SRC_DIR " ; ./flutter/tools/gn)
@@ -49,7 +58,18 @@ cd "$SCRIPT_DIR"
49
58
" $SRC_DIR /flutter/tools/clang_tidy/bin/main.dart" \
50
59
--src-dir=" $SRC_DIR " \
51
60
--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
53
73
54
74
echo " $( date +%T) Running pylint"
55
75
You can’t perform that action at this time.
0 commit comments