Skip to content

Commit

Permalink
feat: add gitlint dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeWallaceDev committed Jul 25, 2022
1 parent 943ce37 commit f993e1d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
9 changes: 8 additions & 1 deletion .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
exit 1
}

npx --no -- commitlint --edit $1
.githooks/gitlint \
--msg-file=$1 \
--subject-regex="^([bB]uild|[cC]hore|[cC]i|[dD]ocs|[fF]eat|[fF]eature|[fF]ix|[pP]erf|[rR]efactor|[rR]evert|[sS]tyle|[tT]est)(.*)?\s?:\s?.*" \
--subject-maxlen=100 \
--subject-minlen=10 \
--body-regex=".*" \
--body-maxlen=200 \
--max-parents=1

if [ $? -ne 0 ]
then
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ frontend/.vscode/*
# Commit the highest level pubspec.lock, but ignore the others
pubspec.lock
!frontend/app_flowy/pubspec.lock

# ignore tool used for commit linting
.githooks/gitlint
12 changes: 10 additions & 2 deletions frontend/scripts/install_dev_env/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ flutter doctor
printMessage "Setting up githooks."
git config core.hooksPath .githooks

# Install go-gitlint
printMessage "Installing go-gitlint."
GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint
rm ${GOLINT_FILENAME}

# Change to the frontend directory
cd frontend

Expand All @@ -62,8 +69,9 @@ printMessage "Installing duckscript."
cargo install --force duckscript_cli

# Install CommitLint
printMessage "Installing CommitLint."
npm install @commitlint/cli @commitlint/config-conventional --save-dev
printMessage "Installing go-gitlint."
wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/go-gitlint_1.1.0_linux_x86_64.tar.gz
tar -xf go-gitlint_1.1.0_linux_x86_64.tar.gz - C

# Check prerequisites
printMessage "Checking prerequisites."
Expand Down
11 changes: 7 additions & 4 deletions frontend/scripts/install_dev_env/install_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ flutter doctor
printMessage "Setting up githooks."
git config core.hooksPath .githooks

# Install go-gitlint
printMessage "Installing go-gitlint."
GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint
rm ${GOLINT_FILENAME}

# Change to the frontend directory
cd frontend

Expand All @@ -61,10 +68,6 @@ cargo install --force cargo-make
printMessage "Installing duckscript."
cargo install --force duckscript_cli

# Install CommitLint
printMessagae "Installing CommitLint."
npm install @commitlint/cli @commitlint/config-conventional --save-dev

# Check prerequisites
printMessage "Checking prerequisites."
cargo make flowy_dev

0 comments on commit f993e1d

Please sign in to comment.