Skip to content

Commit

Permalink
fix(deps): remove go-gitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
mbazhlekova committed Mar 22, 2024
1 parent 197c1c4 commit e7c8697
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
27 changes: 23 additions & 4 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
#!/bin/sh

echo
echo "Checking commit message format..."
echo
RED="\033[0;31m"
END_COLOR="\033[0m"

make lint-commit COMMIT_MSG_FILE=$1
commit_types="(chore|docs|feat|fix|refactor|tests?)"
conventional_commit_regex="^${commit_types}(\([a-z \-]+\))?!?: .+$"

commit_message=$(cat "$1")

if [[ "$commit_message" =~ $conventional_commit_regex ]]; then
echo "Commit message meets Conventional Commit standards..."
exit 0
fi
echo
echo "${RED}Commit lint failed. Please update your commit message format. ${END_COLOR}"
echo "Example commit messages:"
echo " feat(scope): add your feature description here"
echo " fix(scope): add your fix description here"
echo " chore(scope): add your chore description here"
echo " docs(scope): add your docs description here"
echo " refactor(scope): add your refactor description here"
echo " tests(scope): add your tests description here"
echo

exit 1
13 changes: 2 additions & 11 deletions build/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ GOLINTER ?= golangci-lint
GO_MOD_OUTDATED ?= go-mod-outdated
MISSPELL ?= misspell

COMMIT_LINT_CMD ?= go-gitlint
COMMIT_LINT_REGEX ?= "(chore|docs|feat|fix|refactor|tests?)(\([^\)]+\))?: .*"
COMMIT_LINT_START ?= "2020-06-24"


EXCLUDEDIR ?= .git
SRCDIR ?= .
GO_PKGS ?= $(shell ${GO} list ./... | grep -v -e "/example")
FILES ?= $(shell find ${SRCDIR} -type f | grep -v -e '.git/' -e '/vendor/' -e 'go.sum')
GO_FILES ?= $(shell find $(SRCDIR) -type f -name "*.go" | grep -v -e ".git/" -e '/example/')
PROJECT_MODULE ?= $(shell $(GO) list -m)

lint: deps spell-check gofmt lint-commit golangci goimports outdated
lint: deps spell-check gofmt golangci goimports outdated
lint-fix: deps spell-check-fix gofmt-fix goimports

#
Expand All @@ -47,10 +42,6 @@ goimports: deps
@echo "=== $(PROJECT_NAME) === [ goimports ]: Checking imports with $(GOIMPORTS)..."
@$(GOIMPORTS) -l -w -local $(PROJECT_MODULE) $(GO_FILES)

lint-commit: deps
@echo "=== $(PROJECT_NAME) === [ lint-commit ]: Checking that commit messages are properly formatted ($(COMMIT_LINT_CMD))..."
@$(COMMIT_LINT_CMD) --since=$(COMMIT_LINT_START) --subject-minlen=10 --subject-maxlen=120 --subject-regex=$(COMMIT_LINT_REGEX)

golangci: deps
@echo "=== $(PROJECT_NAME) === [ golangci-lint ]: Linting using $(GOLINTER) ($(COMMIT_LINT_CMD))..."
@$(GOLINTER) run
Expand All @@ -59,4 +50,4 @@ outdated: deps tools-outdated
@echo "=== $(PROJECT_NAME) === [ outdated ]: Finding outdated deps with $(GO_MOD_OUTDATED)..."
@$(GO) list -u -m -json all | $(GO_MOD_OUTDATED) -direct -update

.PHONY: lint spell-check spell-check-fix gofmt gofmt-fix lint-fix lint-commit outdated goimports
.PHONY: lint spell-check spell-check-fix gofmt gofmt-fix lint-fix outdated goimports
1 change: 0 additions & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/git-chglog/git-chglog v0.15.4
github.com/golangci/golangci-lint v1.51.2
github.com/goreleaser/goreleaser v1.7.0
github.com/llorllale/go-gitlint v0.0.0-20210608233938-d6303cc52cc5
github.com/psampaz/go-mod-outdated v0.9.0
github.com/stretchr/testify v1.8.4
golang.org/x/tools v0.7.0
Expand Down
1 change: 0 additions & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
_ "github.com/git-chglog/git-chglog/cmd/git-chglog"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/goreleaser/goreleaser"
_ "github.com/llorllale/go-gitlint/cmd/go-gitlint"
_ "github.com/psampaz/go-mod-outdated"
_ "github.com/stretchr/testify/assert"
_ "golang.org/x/tools/cmd/godoc"
Expand Down

0 comments on commit e7c8697

Please sign in to comment.