Skip to content

Commit

Permalink
chore: issue162 - Enforce conventional commits and fix lintKotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
isuPatches committed Dec 26, 2022
1 parent 86c410f commit 520443e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/zsh

if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor|revert|perf)(\(.+?\))?: .{1,}$"; then
echo "Aborting commit. Your commit message is invalid." >&2
exit 1
fi

if ! head -1 "$1" | grep -qE "^.{1,72}$"; then
echo "Aborting commit. Your commit message is too long." >&2
exit 1
fi
30 changes: 30 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/zsh
echo "*******************************"
echo "Running git pre-commit hook"
echo "*******************************"

echo "Running lintKotlin"
if ! lintKotlinStatus=$(./gradlew lintKotlin --parallel --max-workers=4); then
echo "lintKotlin must pass before commit!"
exit "$lintKotlinStatus"
fi

echo "Running detekt"
if ! detektStatus=$(./gradlew detekt --parallel --max-workers=4); then
echo "detekt must pass before commit!"
exit "$detektStatus"
fi

echo "Running lintDebug"
if ! lintDebugStatus=$(./gradlew lintDebug --parallel --max-workers=4); then
echo "lintDebug must pass before commit!"
exit "$lintDebugStatus"
fi

echo "Running cpdCheck"
if ! cpdCheckStatus=$(./gradlew cpdCheck --parallel --max-workers=4); then
echo "cpdCheck must pass before commit!"
exit "$cpdCheckStatus"
fi

echo "'Hard work pays off if you’re patient enough to see it through.' — Michael Chandler"
10 changes: 10 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/zsh
echo "*******************************"
echo "Running git pre-push hook"
echo "*******************************"

# todo@patches Consider building and running unit tests here

# todo@patches Consider building test APK for instrumentation here

echo "'Do the hard jobs first. The easy jobs will take care of themselves.' — Dale Carnegie "
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import com.isupatches.android.wisefy.sample.R
import com.isupatches.android.wisefy.sample.ui.primitives.WisefySampleSizes
import com.isupatches.android.wisefy.sample.ui.theme.WisefySampleTheme


@Composable
internal fun HomeScreen() {
WisefySampleTheme {
Expand Down

0 comments on commit 520443e

Please sign in to comment.