The discourse repository includes configuration for lefthook. This will automatically check any code before itβs committed to git, and alert about any issues. To get set up, simply enter your discourse development directory and run
pnpm install
pnpm run lefthook install
Files will now be automatically checked before committing. If there are any issues, the commit will be cancelled, and you will be shown a list of errors.
This document is version controlled - suggest changes on github.
Currently getting a version of this error with current main in WSL2
Itβs broken my ability to commit:
robert@blah:~/discourse$ git commit -m "fix test setup"
/home/robert/discourse/node_modules/lefthook-linux-x64/bin/lefthook: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/robert/discourse/node_modules/lefthook-linux-x64/bin/lefthook)
/home/robert/discourse/node_modules/lefthook-linux-x64/bin/lefthook: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/robert/discourse/node_modules/lefthook-linux-x64/bin/lefthook)
Any ideas?
Looks like there was a dependabot update to lefthook only 8 hours ago.
According to their github issue, the dependency on shared libs is not intentional. Even if you can get it working, other people will likely have problems. So here we go:
robert@blah:~/discourse$ yarn list --pattern lefthook
yarn list v1.22.19
warning Resolution field "unset-value@2.0.1" is incompatible with requested version "unset-value@^1.0.0"
ββ lefthook-darwin-arm64@1.7.7
ββ lefthook-darwin-x64@1.7.7
ββ lefthook-freebsd-arm64@1.7.7
ββ lefthook-freebsd-x64@1.7.7
ββ lefthook-linux-arm64@1.7.7
ββ lefthook-linux-x64@1.7.7
ββ lefthook-windows-arm64@1.7.7
ββ lefthook-windows-x64@1.7.7
ββ lefthook@1.7.7
Done in 0.53s
robert@blah:~/discourse$ git status
On branch test_branch
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: mytestfile
robert@blah:~/discourse$ git commit -m "test file addition"
β ember-template-lint (skip) no files for inspection
β yaml-syntax (skip) no files for inspection
β i18n-lint (skip) no files for inspection
β rubocop (skip) no files for inspection
β eslint (skip) no files for inspection
β prettier (skip) no files for inspection
β prettier-scss (skip) no files for inspection
β syntax_tree (skip) no files for inspection
ββββββββββββββββββββββββββββββββββββ
summary: (done in 0.06 seconds)
[test_branch 1cd0bb3839] test file addition
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 mytestfile