Skip to content

Commit

Permalink
Automatically remove the container when it exits
Browse files Browse the repository at this point in the history
Without --rm option, it leaves a lot of stopped containers for a big project.
  • Loading branch information
RolandXu-Intel authored and jidicula committed Aug 29, 2022
1 parent 9424b73 commit e871b5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ format_diff() {
local filepath="$1"
# Invoke clang-format with dry run and formatting error output
if [[ $CLANG_FORMAT_VERSION -gt "9" ]]; then
local_format="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" ghcr.io/jidicula/clang-format:"$CLANG_FORMAT_VERSION" -n --Werror --style=file --fallback-style="$FALLBACK_STYLE" "${filepath}")"
local_format="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" --rm ghcr.io/jidicula/clang-format:"$CLANG_FORMAT_VERSION" -n --Werror --style=file --fallback-style="$FALLBACK_STYLE" "${filepath}")"
else # Versions below 9 don't have dry run
formatted="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" ghcr.io/jidicula/clang-format:"$CLANG_FORMAT_VERSION" --style=file --fallback-style="$FALLBACK_STYLE" "${filepath}")"
formatted="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" --rm ghcr.io/jidicula/clang-format:"$CLANG_FORMAT_VERSION" --style=file --fallback-style="$FALLBACK_STYLE" "${filepath}")"
local_format="$(diff -q <(cat "${filepath}") <(echo "${formatted}"))"
fi

Expand Down

0 comments on commit e871b5e

Please sign in to comment.