Commit c86b9ded authored by Russell Dickenson's avatar Russell Dickenson

Merge branch 'eread/update-docs-guide-lefthook' into 'master'

Update docs guide for lefthook

See merge request gitlab-org/gitlab!46852
parents d97b63cd 5157b2ee
...@@ -17,9 +17,8 @@ we suggest investigating to see if a plugin exists. For instance here is the ...@@ -17,9 +17,8 @@ we suggest investigating to see if a plugin exists. For instance here is the
## Pre-push static analysis ## Pre-push static analysis
We strongly recommend installing We strongly recommend installing [Lefthook](https://github.com/Arkweid/lefthook) to automatically check
[Lefthook](https://github.com/Arkweid/lefthook) to automatically check for for static analysis offenses before pushing your changes.
static analysis offenses before pushing your changes.
To install `lefthook`, run the following in your GitLab source directory: To install `lefthook`, run the following in your GitLab source directory:
...@@ -33,10 +32,9 @@ overcommit --uninstall ...@@ -33,10 +32,9 @@ overcommit --uninstall
gem install lefthook && lefthook install -f gem install lefthook && lefthook install -f
``` ```
Before you push your changes, Lefthook will then automatically run Danger checks, as well Before you push your changes, Lefthook then automatically run Danger checks, and other checks
as RuboCop, ES Lint, HAML Lint, and SCSS Lint for the changed files. for changed files. This saves you time as you don't have to wait for the same errors to be detected
by CI/CD.
This saves you time as you don't have to wait for the same errors to be detected by CI/CD.
Lefthook relies on a pre-push hook to prevent commits that violate its ruleset. Lefthook relies on a pre-push hook to prevent commits that violate its ruleset.
If you wish to override this behavior, pass the environment variable `LEFTHOOK=0`. If you wish to override this behavior, pass the environment variable `LEFTHOOK=0`.
......
...@@ -708,15 +708,14 @@ Git [pre-commit hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) ...@@ -708,15 +708,14 @@ Git [pre-commit hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)
run tests or other processes before committing to a branch, with the ability to not commit to the branch if run tests or other processes before committing to a branch, with the ability to not commit to the branch if
failures occur with these tests. failures occur with these tests.
[`overcommit`](https://github.com/sds/overcommit) is a Git hooks manager, making configuring, [`lefthook`](https://github.com/Arkweid/lefthook) is a Git hooks manager, making configuring,
installing, and removing Git hooks easy. installing, and removing Git hooks easy.
Sample configuration for `overcommit` is available in the Configuration for `left` is available in the [`lefthook.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lefthook.yml)
[`.overcommit.yml.example`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.overcommit.yml.example)
file for the [`gitlab`](https://gitlab.com/gitlab-org/gitlab) project. file for the [`gitlab`](https://gitlab.com/gitlab-org/gitlab) project.
To set up `overcommit` for documentation linting, see To set up `lefthook` for documentation linting, see
[Pre-commit static analysis](../contributing/style_guides.md#pre-push-static-analysis). [Pre-push static analysis](../contributing/style_guides.md#pre-push-static-analysis).
#### Disable Vale tests #### Disable Vale tests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment