Skip to content

Instantly share code, notes, and snippets.

@sergigp
Created January 17, 2016 22:56
Show Gist options
  • Save sergigp/e57e51aa086c7102a089 to your computer and use it in GitHub Desktop.
Save sergigp/e57e51aa086c7102a089 to your computer and use it in GitHub Desktop.
Pre commit for scala projects
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo -e "\n\033[1mDoing some Checks...\n\033[0m"
if sbt compile > /dev/null
then
echo -e "${GREEN}- Compiles${NC}"
else
echo -e "${RED}- Code not compiles${NC} (do 'sbt compile' for more information)"
exit 1
fi
if sbt test > /dev/null
then
echo -e "${GREEN}- Tests passing${NC}"
else
echo -e "${RED}- Tests do not pass${NC} (do 'sbt test' for more information)"
exit 1
fi
if sbt scalastyle > /dev/null
then
echo -e "${GREEN}- Code style${NC}"
echo -e "\nAll Ok, your code will be commited young padawan.\n"
else
echo -e "${RED}- Code Style not ok${NC} (do 'sbt scalastyle' for more information)"
exit 1
fi
@jordiclariana
Copy link

Won't be faster, but colored log printing is cleaner. Just a cosmetic change:
https://gist.github.com/jordiclariana/4dda8b811fb43ad6d988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment