Skip to content

Instantly share code, notes, and snippets.

@rogood
rogood / pre-push
Last active November 18, 2019 12:59
Flutter Pre-Push Hook
#!/usr/bin/env bash
flutter analyze
if [ $? -ne 0 ]; then
exit 1
fi
flutter test
if [ $? -ne 0 ]; then
exit 1
@rogood
rogood / pre-commit
Last active November 18, 2019 12:47
Flutter Pre-Commit hook
#!/usr/bin/env bash
flutter format .
@rogood
rogood / pre-push
Last active July 7, 2020 01:15
Flutter Pre Push Hook with Console Messages
#!/usr/bin/env bash
if [[ `git status --porcelain` ]]; then
printf "\e[31;1m%s\e[0m\n" 'This script needs to run against committed code only. Please commit or stash you changes.'
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer'
flutter analyze
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error'
exit 1
@rogood
rogood / pre-commit
Last active July 7, 2020 01:15
Flutter Pre Commit Hook with Console Messages
#!/usr/bin/env bash
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter formatter'
flutter format .
printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter formatter'