This repository has been archived by the owner on May 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre commit hook script to check credo, format, and deps versions
co-authored-by: Scott Millard <smillard@hntb.com>
- Loading branch information
1 parent
658cd44
commit 8cc4166
Showing
7 changed files
with
45 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use Mix.Config | ||
|
||
config :husky, | ||
pre_commit: "mix format --check-formatted && mix credo && mix hex.outdated" | ||
pre_commit: "./scripts/git_pre_commit_hook.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /bin/bash | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
exit_code=0 | ||
|
||
#Check that version in README.md matches what is in mix.exs | ||
build_output=$(mix hex.build) | ||
current_version=$(echo "$build_output" | grep 'Version:' | awk '{print $2}') | ||
app_name=$(echo "$build_output" | grep 'Building' | awk '{print $2}') | ||
grep -q "{:$app_name, \"~> $current_version" README.md | ||
if [ $? == 1 ]; then | ||
echo -e "${RED}Update the version number in README.md to $current_version\r\n" | ||
exit_code=1 | ||
fi | ||
|
||
mix format | ||
|
||
echo -e "${NC}mix credo - compiling code there may be a delay" | ||
compile_output=$(mix compile 2>/dev/null) ##Supress compile output and warnings | ||
|
||
credo_output=$(mix credo --format=oneline) | ||
if [ $? != 0 ]; then | ||
echo -e "${RED}$credo_output${NC}\r\n" | ||
exit_code=1 | ||
fi | ||
|
||
outdated_output=$(mix hex.outdated) | ||
if [ $? == 1 ]; then | ||
echo -e "${NC}Outdated dependencies" | ||
echo -e "$outdated_output" | grep "Dependency" | ||
echo -en "${RED}" | ||
echo -e "$outdated_output" | grep " No" | ||
echo -e "$outdated_output" | grep " Yes" | ||
echo -e "${NC}" | ||
exit_code=1 | ||
fi | ||
|
||
exit $exit_code |
This file was deleted.
Oops, something went wrong.