瀏覽代碼

chore: use POSIX shell syntax in pre-commit script (#16025)

tags/1.1.0
QuantumGhost 7 月之前
父節點
當前提交
69fb0a4a28
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 12 行新增8 行删除
  1. 12
    8
      web/.husky/pre-commit

+ 12
- 8
web/.husky/pre-commit 查看文件



for file in $files for file in $files
do do
if [[ $file == "api/"* && $file == *.py ]]; then
# set api_modified flag to true
api_modified=true
elif [[ $file == "web/"* ]]; then
# set web_modified flag to true
web_modified=true
fi
# Use POSIX compliant pattern matching
case "$file" in
api/*.py)
# set api_modified flag to true
api_modified=true
;;
web/*)
# set web_modified flag to true
web_modified=true
;;
esac
done done


# run linters based on the modified modules # run linters based on the modified modules
echo "Running Ruff linter on api module" echo "Running Ruff linter on api module"


# python style checks rely on `ruff` in path # python style checks rely on `ruff` in path
if ! command -v ruff &> /dev/null; then
if ! command -v ruff > /dev/null 2>&1; then
echo "Installing linting tools (Ruff, dotenv-linter ...) ..." echo "Installing linting tools (Ruff, dotenv-linter ...) ..."
poetry install -C api --only lint poetry install -C api --only lint
fi fi

Loading…
取消
儲存