debian-mirror-gitlab/lefthook.yml

134 lines
6.6 KiB
YAML
Raw Permalink Normal View History

2021-01-29 00:20:46 +05:30
pre-push:
parallel: true
2023-03-04 22:38:38 +05:30
skip:
- ref: master
2021-01-29 00:20:46 +05:30
commands:
danger:
2022-06-21 17:19:12 +05:30
run: bundle exec rake danger_local
2021-01-29 00:20:46 +05:30
eslint:
tags: frontend style
2021-04-17 20:07:23 +05:30
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2021-04-29 21:17:54 +05:30
glob: '*.{js,vue}'
2021-04-17 20:07:23 +05:30
run: yarn run lint:eslint {files}
2022-11-25 23:54:43 +05:30
jsonlint:
tags: style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '*.{json}'
2023-04-23 21:23:45 +05:30
run: scripts/lint-json -v {files}
2021-01-29 00:20:46 +05:30
haml-lint:
tags: view haml style
2021-04-17 20:07:23 +05:30
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2021-04-29 21:17:54 +05:30
glob: '*.html.haml'
2023-03-04 22:38:38 +05:30
run: REVEAL_RUBOCOP_TODO=0 bundle exec haml-lint --parallel --config .haml-lint.yml {files}
2021-01-29 00:20:46 +05:30
markdownlint:
tags: documentation style
2021-04-17 20:07:23 +05:30
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2021-04-29 21:17:54 +05:30
glob: 'doc/*.md'
2021-01-29 00:20:46 +05:30
run: yarn markdownlint {files}
2022-07-23 23:45:48 +05:30
yamllint:
tags: backend style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2023-03-04 22:38:38 +05:30
glob: '*.{yml,yaml}{,.*}'
2022-07-23 23:45:48 +05:30
run: scripts/lint-yaml.sh {files}
2021-04-17 20:07:23 +05:30
stylelint:
2021-01-29 00:20:46 +05:30
tags: stylesheet css style
2021-04-17 20:07:23 +05:30
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2021-04-29 21:17:54 +05:30
glob: '*.scss{,.css}'
run: yarn stylelint {files}
2021-04-17 20:07:23 +05:30
prettier:
tags: frontend style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2021-04-29 21:17:54 +05:30
glob: '*.{js,vue,graphql}'
2021-04-17 20:07:23 +05:30
run: yarn run prettier --check {files}
2021-01-29 00:20:46 +05:30
rubocop:
tags: backend style
2021-04-17 20:07:23 +05:30
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2022-07-16 23:28:13 +05:30
glob: '*.{rb,rake}'
2021-04-29 21:17:54 +05:30
run: REVEAL_RUBOCOP_TODO=0 bundle exec rubocop --parallel --force-exclusion {files}
2023-03-04 22:38:38 +05:30
sidekiq-queues:
tags: backend
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '{,ee/}app/workers/*.rb'
run: bundle exec rake gitlab:sidekiq:queues:check
2021-12-11 22:18:48 +05:30
graphql_docs:
tags: documentation
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '{app/graphql/**/*.rb,ee/app/graphql/**/*.rb}'
run: bundle exec rake gitlab:graphql:check_docs
2023-03-04 22:38:38 +05:30
vale: # Requires Vale: https://docs.gitlab.com/ee/development/documentation/testing.html#install-linters
2021-01-29 00:20:46 +05:30
tags: documentation style
2021-04-17 20:07:23 +05:30
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2021-04-29 21:17:54 +05:30
glob: 'doc/*.md'
2022-06-21 17:19:12 +05:30
run: 'if [ $VALE_WARNINGS ]; then minWarnings=warning; else minWarnings=error; fi; if command -v vale > /dev/null 2>&1; then if ! vale --config .vale.ini --minAlertLevel $minWarnings {files}; then echo "ERROR: Fix any linting errors and make sure you are using the latest version of Vale."; exit 1; fi; else echo "ERROR: Vale not found. For more information, see https://docs.errata.ai/vale/install."; exit 1; fi'
2021-09-30 23:02:18 +05:30
gettext:
2023-03-04 22:38:38 +05:30
skip: true # This is disabled by default. You can enable this check by adding skip: false in lefhook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
2021-09-30 23:02:18 +05:30
tags: backend frontend view haml
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD | while read file;do git diff --unified=1 $(git merge-base origin/master HEAD)..HEAD $file | grep -Fqe '_(' && echo $file;done; true
2023-03-04 22:38:38 +05:30
glob: '*.{haml,rb,js,vue}'
2021-09-30 23:02:18 +05:30
run: bin/rake gettext:updated_check
2023-03-04 22:38:38 +05:30
docs-metadata: # See https://docs.gitlab.com/ee/development/documentation/#metadata
2021-10-27 15:23:28 +05:30
tags: documentation style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: 'doc/*.md'
run: scripts/lint-docs-metadata.sh {files}
2022-08-13 15:12:31 +05:30
docs-trailing_spaces: # Not enforced in CI/CD pipelines, but reduces the amount of required cleanup: https://gitlab.com/gitlab-org/technical-writing/-/blob/main/.gitlab/issue_templates/tw-monthly-tasks.md#remote-tasks
tags: documentation style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: 'doc/*.md'
run: yarn markdownlint:no-trailing-spaces {files}
2022-04-04 11:22:00 +05:30
docs-deprecations:
tags: documentation
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: 'data/deprecations/*.yml'
run: echo "Changes to deprecation files detected. Checking deprecations..\n"; bundle exec rake gitlab:docs:check_deprecations
docs-removals:
tags: documentation
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
2022-08-13 15:12:31 +05:30
glob: 'data/removals/*.yml'
2022-04-04 11:22:00 +05:30
run: echo "Changes to removals files detected. Checking removals..\n"; bundle exec rake gitlab:docs:check_removals
2023-05-27 22:25:52 +05:30
db-schema-changes:
tags: database
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: 'db/structure.sql'
run: scripts/validate_schema_changes
2023-03-04 22:38:38 +05:30
scripts:
"merge_conflicts":
skip: true # This is disabled by default. You can enable this check by adding skip: false in lefhook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
runner: bash
2023-06-20 00:43:36 +05:30
"security_harness":
tags: security
runner: bash
2023-05-27 22:25:52 +05:30
2023-03-04 22:38:38 +05:30
pre-commit:
parallel: true
commands:
2023-01-13 00:05:48 +05:30
secrets-detection:
tags: secrets
2023-03-04 22:38:38 +05:30
files: git diff --name-only --diff-filter=d --staged
run: 'if command -v gitleaks > /dev/null 2>&1; then gitleaks protect --no-banner --staged --redact --verbose; else echo "WARNING: gitleaks is not installed. Please install it. See https://github.com/zricethezav/gitleaks#installing."; fi'
2023-05-27 22:25:52 +05:30
auto-fix:
parallel: true
commands:
frontend:
tags: frontend style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '*.{js,vue}'
run: 'yarn run lint:eslint:fix {files} && yarn run prettier --write --list-different {files}'
jsonlint:
tags: style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '*.{json}'
run: scripts/lint-json --format --verbose {files}
prettier-graphql:
tags: frontend style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '*.{graphql}'
run: yarn run prettier --write --list-different {files}
rubocop:
tags: backend style
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '*.{rb,rake}'
run: REVEAL_RUBOCOP_TODO=0 bundle exec rubocop --parallel --autocorrect --force-exclusion {files}