Skip to content

Commit

Permalink
chore(githooks): Use zk_toolbox in githooks (#2895)
Browse files Browse the repository at this point in the history
## What ❔

Switch to zk_supervisor fmt in our githooks
## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.

---------

Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo authored Oct 2, 2024
1 parent b249827 commit af782ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 9 additions & 4 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ RED='\033[0;31m'
NC='\033[0m' # No Color

# Check that prettier formatting rules are not violated.
if ! zk fmt --check; then
echo -e "${RED}Push error!${NC}"
echo "Please format the code via 'zk fmt', cannot push unformatted code"
exit 1
if which zk_supervisor >/dev/null; then
if ! zk_supervisor fmt --check; then
echo -e "${RED}Push error!${NC}"
echo "Please format the code via 'zks fmt', cannot push unformatted code"
exit 1
fi
else
echo "Please install zk_toolbox using zkup from https://github.com/matter-labs/zksync-era/tree/main/zk_toolbox/zkup, and then run ./bin/zkt from the zksync-era repository."
exit 1
fi
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
- [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Code has been formatted via `zk_supervisor fmt` and `zk_supervisor lint`.
2 changes: 2 additions & 0 deletions bin/zkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ cd $(dirname $0)
if which zkup >/dev/null; then
cargo uninstall zk_inception
cargo uninstall zk_supervisor
git config --local core.hooksPath ||
git config --local core.hooksPath ./.githooks
zkup -p .. --alias
else
echo zkup is not installed, please install it https://github.com/matter-labs/zksync-era/tree/main/zk_toolbox/zkup
Expand Down

0 comments on commit af782ba

Please sign in to comment.