Add a rule to install stylua and use the local one for other rules (#1307)

This commit is contained in:
Zhizhen He
2022-11-16 13:22:24 +08:00
committed by GitHub
parent e820335208
commit a188be8559
6 changed files with 42 additions and 58 deletions

View File

@@ -1,6 +1,12 @@
.PHONY: install-stylua
install-stylua:
@if [ ! -f "./utils/stylua" ]; then \
sh ./utils/install_stylua.sh; \
fi
.PHONY: fmt
fmt:
stylua --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
fmt: install-stylua
./utils/stylua --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
.PHONY: lint
lint:
@@ -11,13 +17,13 @@ test:
vusted --output=gtest ./lua
.PHONY: pre-commit
pre-commit:
pre-commit: install-stylua
./utils/stylua --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
luacheck lua
vusted lua
.PHONY: integration
integration:
integration: install-stylua
./utils/stylua --config-path stylua.toml --check --glob 'lua/**/*.lua' -- lua
luacheck lua
vusted lua