Commit 57a2c094 authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Merge branch 'setup-fmt' into 'master'

Setup pre-commit hook to check style

See merge request World/fractal!292
parents f953f892 f857e72e
Pipeline #44640 passed with stages
in 27 minutes and 48 seconds
#!/bin/sh
if ! which rustup &> /dev/null; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:$HOME/.cargo/bin
if ! which rustup &> /dev/null; then
echo "Failed to install rustup"
fi
fi
if ! rustup component list --toolchain nightly|grep rustfmt-preview &> /dev/null; then
echo "Installing nightly rustfmt.."
rustup component add rustfmt-preview --toolchain nightly
fi
echo "--Checking style--"
cargo +nightly fmt --all -- --check
if test $? != 0; then
echo "--Checking style fail--"
echo "Please fix the above issues, either manually or by running: cargo +nightly fmt --all"
exit -1
else
echo "--Checking style pass--"
fi
......@@ -98,4 +98,10 @@ run_target('release', command: ['scripts/release.sh',
meson.project_name() + '-' + fractal_version
])
if get_option('profile') == 'development'
# Setup pre-commit hook for ensuring coding style is always consistent
message('Setting up git pre-commit hook..')
run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit')
endif
meson.add_install_script('scripts/meson_post_install.py')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment