feat: check code quality through git hooks (#105)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Add `git hooks` that execute common and repetitive tasks before committing and pushing to make developer life easier. Reviewed-on: #105 Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com> Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
parent
ab97a6c14f
commit
70582003de
@ -1,2 +1,3 @@
|
|||||||
erlang 27.1.2
|
erlang 27.1.2
|
||||||
elixir 1.17.3
|
elixir 1.17.3
|
||||||
|
lefthook 1.8.2
|
||||||
|
12
Makefile
12
Makefile
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
COMPOSE = docker compose -f docker-compose.yml -f docker-compose.override.yml
|
COMPOSE = docker compose -f docker-compose.yml -f docker-compose.override.yml
|
||||||
|
|
||||||
|
.PHONY: system_setup
|
||||||
|
system_setup: ## setup system deps
|
||||||
|
@lefthook install
|
||||||
|
|
||||||
.PHONY: setup
|
.PHONY: setup
|
||||||
setup: ## setup project
|
setup: system_setup ## setup project
|
||||||
@mkdir -p priv/plts
|
@mkdir -p priv/plts
|
||||||
@mix do local.rebar --force, local.hex --force
|
@mix do local.rebar --force, local.hex --force
|
||||||
@mix do deps.get, deps.compile
|
@mix do deps.get, deps.compile
|
||||||
@ -13,6 +17,10 @@ setup: ## setup project
|
|||||||
check_format: ## run format checker
|
check_format: ## run format checker
|
||||||
@mix format --check-formatted
|
@mix format --check-formatted
|
||||||
|
|
||||||
|
.PHONY: check_compile
|
||||||
|
check_compile: ## run compile
|
||||||
|
@mix compile --warnings-as-errors --force
|
||||||
|
|
||||||
.PHONY: credo
|
.PHONY: credo
|
||||||
credo: ## run credo
|
credo: ## run credo
|
||||||
@mix credo suggest --strict --format=flycheck
|
@mix credo suggest --strict --format=flycheck
|
||||||
@ -22,7 +30,7 @@ dialyzer: ## run dialyzer
|
|||||||
@mix dialyzer --no-check --quiet --ignore-exit-status --format short
|
@mix dialyzer --no-check --quiet --ignore-exit-status --format short
|
||||||
|
|
||||||
.PHONY: static_code_analysis
|
.PHONY: static_code_analysis
|
||||||
static_code_analysis: check_format credo dialyzer ## run static code analysis
|
static_code_analysis: check_format check_compile credo dialyzer ## run static code analysis
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ## run tests
|
test: ## run tests
|
||||||
|
20
lefthook.yml
Normal file
20
lefthook.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
pre-commit:
|
||||||
|
parallel: true
|
||||||
|
commands:
|
||||||
|
compiling:
|
||||||
|
glob: &elixir_files '*.{ex,exs}'
|
||||||
|
run: make check_compile
|
||||||
|
formating:
|
||||||
|
glob: *elixir_files
|
||||||
|
run: make check_format
|
||||||
|
linting:
|
||||||
|
glob: *elixir_files
|
||||||
|
run: make credo
|
||||||
|
typing:
|
||||||
|
glob: *elixir_files
|
||||||
|
run: make dialyzer
|
||||||
|
pre-push:
|
||||||
|
commands:
|
||||||
|
testing:
|
||||||
|
run: make compose_test
|
Loading…
x
Reference in New Issue
Block a user