You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
638 B
23 lines
638 B
#!/bin/sh |
|
|
|
if ! which cargo &> /dev/null; then |
|
echo "Commit aborted! Please install cargo and rustfmt to check the code style of Fractal." |
|
exit -1 |
|
fi |
|
|
|
if ! cargo fmt --help &> /dev/null; then |
|
echo "Commit aborted! You need rustfmt to check the code style of Fractal." |
|
echo "Install it via rustup ('rustup component add rustfmt') or your package manager." |
|
exit -1 |
|
fi |
|
|
|
echo "--Checking style--" |
|
cargo fmt --all -- --check |
|
if test $? != 0; then |
|
echo "--Checking style fail--" |
|
echo "Please fix the above issues, either manually or by running: cargo fmt --all" |
|
|
|
exit -1 |
|
else |
|
echo "--Checking style pass--" |
|
fi
|
|
|