
* introducing Launcher::overcommit * removing unnecessary cfg restrictions and clippy allows * improving warning for wrong clang-format version * installing black in the format CI * Enforcing python formatting in CI * extending formatting using black on all python files * printing diff on black failure * preferring python's black over system black * moving to LLVM 19 for formatting
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
LIBAFL_DIR=$(realpath "$SCRIPT_DIR/..")
|
|
|
|
cd "${LIBAFL_DIR}" || exit 1
|
|
|
|
if [ "$1" = "check" ]; then
|
|
cargo run --manifest-path "$LIBAFL_DIR/utils/libafl_fmt/Cargo.toml" --release -- -c --verbose || exit 1
|
|
else
|
|
cargo run --manifest-path "$LIBAFL_DIR/utils/libafl_fmt/Cargo.toml" --release -- --verbose || exit 1
|
|
fi
|
|
|
|
if python3 -m black --version > /dev/null; then
|
|
BLACK_COMMAND="python3 -m black"
|
|
elif command -v black > /dev/null; then
|
|
BLACK_COMMAND="black"
|
|
fi
|
|
|
|
if [ -n "$BLACK_COMMAND" ]; then
|
|
echo "[*] Formatting python files"
|
|
if [ "$1" = "check" ]; then
|
|
$BLACK_COMMAND --check --diff "$LIBAFL_DIR" || exit 1
|
|
else
|
|
$BLACK_COMMAND "$LIBAFL_DIR" || exit 1
|
|
fi
|
|
else
|
|
echo -e "\n\033[1;33mWarning\033[0m: python black not found. Formatting skipped for python.\n"
|
|
fi
|
|
|
|
if [ "$1" != "check" ]; then
|
|
if command -v taplo > /dev/null; then
|
|
echo "[*] Formatting TOML files"
|
|
taplo format
|
|
fi
|
|
fi
|
|
|
|
echo "[*] Done :)"
|