From d4e262d5dc5cf1585c313b547aba751b604040b1 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 17 Jan 2023 10:16:07 +1000 Subject: [PATCH] DEV: Add syntax_tree check to lefthook (#19877) Adds the pre-commit hook for syntax_tree to lefthook. Didn't add the normal linter because it seems to have a max file limit, which we exceed with a combination of *.rb and *.rake. If the format doesn't match on commit we get this: ``` EXECUTE > syntax_tree [warn] lib/post_jobs_enqueuer.rb [warn] lib/tasks/s3.rake The listed files did not match the expected format. ``` --- lefthook.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lefthook.yml b/lefthook.yml index be90ea676c1..d7ba1648551 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -11,6 +11,9 @@ pre-commit: rubocop: glob: "*.rb" run: bundle exec rubocop --parallel --force-exclusion {staged_files} + syntax_tree: + glob: "*.{rb,rake}" + run: bundle exec stree check Gemfile {staged_files} prettier: glob: "*.js" include: "app/assets/javascripts|plugins/.+?/assets/javascripts"