build
build copied to clipboard
chore: add git hooks & code lint
Description
add code & formatter and commit message lint AR-1130
1.Install
lefthook,shellcheck and shfmt
2.Config
just run lefthook install && lefthook run pre-commit
in project root dir to enable git hooks
3.Result
-
Wrong commit message:
-
Illegal bash: (e.g:)
Cool utility to help improve code quality (general Jira https://armbian.atlassian.net/browse/AR-1130) , but as @lanefu pointed out - for the acceptance, integration is crucial. Can be done as build host extension:
https://github.com/armbian/build/blob/master/lib/main.sh#L465 https://docs.armbian.com/Developer-Guide_Extensions/
Implementation example: https://github.com/armbian/build/pull/3572
lol looks works fine and I messed up some
I have somewhat related stuff in armbian-next
, for automated download/install/run of shellfmt
and shellcheck
, but I did not touch the hooks part. I really think it's better to leave the checking to a GH PR handler, and PR's will be rejected if they're not formatted. I guess lefthook
is somewhat similar to pre-commit
which I investigated and gave up on (requires too much developer setup)....
I have somewhat related stuff in
armbian-next
, for automated download/install/run ofshellfmt
andshellcheck
, but I did not touch the hooks part. I really think it's better to leave the checking to a GH PR handler, and PR's will be rejected if they're not formatted. I guesslefthook
is somewhat similar topre-commit
which I investigated and gave up on (requires too much developer setup)....
yeah I compare with husky lefthook pre-commit, the lefthook is easy for use, and when you not install it wont works, but code format and lint is strong recommend for community project
there are many benefits in the commit convention, can see more: https://www.conventionalcommits.org
@littlecxm What's the state of this thing do you need a help or something
@littlecxm What's the state of this thing do you need a help or something
need CI test & git hook for auto code format test!
succesor #4952, closed