hkdb / app

A cross-platform package management assistant with super powers!
https://hkdb.github.io/app/
Apache License 2.0
117 stars 5 forks source link

Precommit add linter support #5

Closed RichardFevrier closed 3 months ago

RichardFevrier commented 4 months ago

I have added the goimports linter thru pre-commits.

To make it works on your machine you will need to have pre-commit & golangci-lint installed (used brew on my Fedora) and do a pre-commit install on the root of the repo.

If you want to perform manually the linting of all the files you can do a pre-commit run --all-files (I did it for the second commit of this branch).

Otherwise everytime a commit is made the linting is also made on all the files.

I've only enabled goimports but if you want you can play with more (golangci-lint linters to have the complete list).

For example adding gosimple in the .golangci.yaml config will check for code simplification like reducing:

if test == true {
...

into:

if test {
...
hkdb commented 3 months ago

Cool! Thanks!