mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-04 11:14:10 +08:00
chore: use POSIX shell syntax in pre-commit script (#16025)
This commit is contained in:
parent
04a0ae3aa9
commit
69fb0a4a28
@ -9,13 +9,17 @@ web_modified=false
|
|||||||
|
|
||||||
for file in $files
|
for file in $files
|
||||||
do
|
do
|
||||||
if [[ $file == "api/"* && $file == *.py ]]; then
|
# Use POSIX compliant pattern matching
|
||||||
# set api_modified flag to true
|
case "$file" in
|
||||||
api_modified=true
|
api/*.py)
|
||||||
elif [[ $file == "web/"* ]]; then
|
# set api_modified flag to true
|
||||||
# set web_modified flag to true
|
api_modified=true
|
||||||
web_modified=true
|
;;
|
||||||
fi
|
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
|
||||||
@ -24,7 +28,7 @@ if $api_modified; then
|
|||||||
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…
x
Reference in New Issue
Block a user