Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/contributing/style_guides.md')
-rw-r--r--doc/development/contributing/style_guides.md24
1 files changed, 22 insertions, 2 deletions
diff --git a/doc/development/contributing/style_guides.md b/doc/development/contributing/style_guides.md
index 28ce8e6ff4b..d24875e559a 100644
--- a/doc/development/contributing/style_guides.md
+++ b/doc/development/contributing/style_guides.md
@@ -5,7 +5,7 @@ group: Development
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
-# Style guides
+# Development style guides
## Editor/IDE styling standardization
@@ -30,7 +30,9 @@ We were using Overcommit prior to Lefthook, so you may want to uninstall it firs
### Install Lefthook
-1. Install the `lefthook` Ruby gem:
+1. You can install lefthook in [different ways](https://github.com/evilmartians/lefthook/blob/master/docs/install.md#install-lefthook).
+ If you do not choose to install it globally (e.g. via Homebrew or package managers), and only want to use it for the GitLab project,
+ you can install the Ruby gem via:
```shell
bundle install
@@ -39,12 +41,18 @@ We were using Overcommit prior to Lefthook, so you may want to uninstall it firs
1. Install Lefthook managed Git hooks:
```shell
+ # If installed globally
+ lefthook install
+ # Or if installed via ruby gem
bundle exec lefthook install
```
1. Test Lefthook is working by running the Lefthook `pre-push` Git hook:
```shell
+ # If installed globally
+ lefthook run pre-push
+ # Or if installed via ruby gem
bundle exec lefthook run pre-push
```
@@ -57,6 +65,18 @@ Lefthook is configured with a combination of:
- Project configuration in [`lefthook.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lefthook.yml).
- Any [local configuration](https://github.com/evilmartians/lefthook/blob/master/README.md#local-config).
+### Lefthook auto-fixing files
+
+We have a custom lefthook target to run all the linters with auto-fix capabilities,
+but just on the files which changed in your branch.
+
+```shell
+# If installed globally
+lefthook run auto-fix
+# Or if installed via ruby gem
+bundle exec lefthook run auto-fix
+```
+
### Disable Lefthook temporarily
To disable Lefthook temporarily, you can set the `LEFTHOOK` environment variable to `0`. For instance: