mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:57:04 +08:00
d4e262d5dc
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. ```
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
skip_output:
|
|
- meta
|
|
- success
|
|
|
|
pre-commit:
|
|
parallel: true
|
|
skip:
|
|
- merge
|
|
- rebase
|
|
commands:
|
|
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"
|
|
run: yarn pprettier --list-different {staged_files}
|
|
prettier-scss:
|
|
glob: "*.scss"
|
|
include: "app/assets/stylesheets|plugins/.+?/assets/stylesheets"
|
|
run: yarn pprettier --list-different {staged_files}
|
|
eslint:
|
|
glob: "*.js"
|
|
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
|
run: yarn eslint -f compact --quiet {staged_files}
|
|
ember-template-lint:
|
|
glob: "*.hbs"
|
|
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
|
run: yarn run ember-template-lint {staged_files}
|
|
yaml-syntax:
|
|
glob: "*.{yaml,yml}"
|
|
# database.yml is an erb file not a yaml file
|
|
exclude: "database.yml"
|
|
run: bundle exec yaml-lint {staged_files}
|
|
i18n-lint:
|
|
glob: "**/{client,server}.en.yml"
|
|
run: bundle exec ruby script/i18n_lint.rb {staged_files}
|
|
|
|
lints:
|
|
parallel: true
|
|
commands:
|
|
rubocop:
|
|
glob: "*.rb"
|
|
run: bundle exec rubocop --parallel
|
|
prettier:
|
|
run: yarn pprettier --list-different **/*.js
|
|
prettier-scss:
|
|
run: yarn pprettier --list-different **/*.scss
|
|
eslint:
|
|
run: yarn eslint -f compact --quiet --ext .js .
|
|
ember-template-lint:
|
|
run: yarn run ember-template-lint .
|
|
yaml-syntax:
|
|
glob: "*.{yaml,yml}"
|
|
# database.yml is an erb file not a yaml file
|
|
exclude: "database.yml"
|
|
run: bundle exec yaml-lint {all_files}
|
|
i18n-lint:
|
|
glob: "**/{client,server}.en.yml"
|
|
run: bundle exec ruby script/i18n_lint.rb {all_files}
|