Skip to content

Commit

Permalink
clang-tidy: Added an environment variable that allows fix to print the (
Browse files Browse the repository at this point in the history
#37024)

generated diff.
  • Loading branch information
gaaclarke authored Nov 7, 2022
1 parent 55ed37f commit e7d7eda
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ DART="${DART_BIN}/dart"
# to have this as an error.
MAC_HOST_WARNINGS_AS_ERRORS="performance-move-const-arg,performance-unnecessary-value-param"

# FLUTTER_LINT_PRINT_FIX will make it so that fix is executed and the generated
# diff is printed to stdout if clang-tidy fails. This is helpful for enabling
# new lints.
if [[ -z "${FLUTTER_LINT_PRINT_FIX}" ]]; then
fix_flag=""
else
fix_flag="--fix"
fi

COMPILE_COMMANDS="$SRC_DIR/out/host_debug/compile_commands.json"
if [ ! -f "$COMPILE_COMMANDS" ]; then
(cd "$SRC_DIR"; ./flutter/tools/gn)
Expand All @@ -49,7 +58,18 @@ cd "$SCRIPT_DIR"
"$SRC_DIR/flutter/tools/clang_tidy/bin/main.dart" \
--src-dir="$SRC_DIR" \
--mac-host-warnings-as-errors="$MAC_HOST_WARNINGS_AS_ERRORS" \
"$@"
$fix_flag \
"$@" && true # errors ignored
clang_tidy_return=$?
if [ $clang_tidy_return -ne 0 ]; then
if [ -n "$fix_flag" ]; then
echo "###################################################"
echo "# Attempted to fix issues with the following patch:"
echo "###################################################"
git --no-pager diff
fi
exit $clang_tidy_return
fi

echo "$(date +%T) Running pylint"

Expand Down

0 comments on commit e7d7eda

Please sign in to comment.