From 7c7c4fade6f8f1085a95bf48ae90222345f05bee Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 5 Nov 2020 03:09:03 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/workers/concerns/application_worker.rb | 2 +- doc/api/project_repository_storage_moves.md | 2 +- doc/development/contributing/style_guides.md | 12 +++++------- doc/development/documentation/index.md | 9 ++++----- spec/workers/concerns/application_worker_spec.rb | 4 ++-- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb index 30dec5159a2..d101ef100d8 100644 --- a/app/workers/concerns/application_worker.rb +++ b/app/workers/concerns/application_worker.rb @@ -19,7 +19,7 @@ module ApplicationWorker def structured_payload(payload = {}) context = Labkit::Context.current.to_h.merge( - 'class' => self.class, + 'class' => self.class.name, 'job_status' => 'running', 'queue' => self.class.queue, 'jid' => jid diff --git a/doc/api/project_repository_storage_moves.md b/doc/api/project_repository_storage_moves.md index 34c0b112333..c1ba421e73e 100644 --- a/doc/api/project_repository_storage_moves.md +++ b/doc/api/project_repository_storage_moves.md @@ -216,7 +216,7 @@ Parameters: Example request: ```shell -curl --request POST --header "PRIVATE_TOKEN: " --header "Content-Type: application/json" \ +curl --request POST --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" \ --data '{"destination_storage_name":"storage2"}' "https://gitlab.example.com/api/v4/projects/1/repository_storage_moves" ``` diff --git a/doc/development/contributing/style_guides.md b/doc/development/contributing/style_guides.md index c0041b78f2c..0964d8b17a1 100644 --- a/doc/development/contributing/style_guides.md +++ b/doc/development/contributing/style_guides.md @@ -17,9 +17,8 @@ we suggest investigating to see if a plugin exists. For instance here is the ## Pre-push static analysis -We strongly recommend installing -[Lefthook](https://github.com/Arkweid/lefthook) to automatically check for -static analysis offenses before pushing your changes. +We strongly recommend installing [Lefthook](https://github.com/Arkweid/lefthook) to automatically check +for static analysis offenses before pushing your changes. To install `lefthook`, run the following in your GitLab source directory: @@ -33,10 +32,9 @@ overcommit --uninstall gem install lefthook && lefthook install -f ``` -Before you push your changes, Lefthook will then automatically run Danger checks, as well -as RuboCop, ES Lint, HAML Lint, and SCSS Lint for the changed files. - -This saves you time as you don't have to wait for the same errors to be detected by CI/CD. +Before you push your changes, Lefthook then automatically run Danger checks, and other checks +for changed files. 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. If you wish to override this behavior, pass the environment variable `LEFTHOOK=0`. diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md index 7ccdb9312af..908193ebb2e 100644 --- a/doc/development/documentation/index.md +++ b/doc/development/documentation/index.md @@ -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 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. -Sample configuration for `overcommit` is available in the -[`.overcommit.yml.example`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.overcommit.yml.example) +Configuration for `left` is available in the [`lefthook.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lefthook.yml) file for the [`gitlab`](https://gitlab.com/gitlab-org/gitlab) project. -To set up `overcommit` for documentation linting, see -[Pre-commit static analysis](../contributing/style_guides.md#pre-push-static-analysis). +To set up `lefthook` for documentation linting, see +[Pre-push static analysis](../contributing/style_guides.md#pre-push-static-analysis). #### Disable Vale tests diff --git a/spec/workers/concerns/application_worker_spec.rb b/spec/workers/concerns/application_worker_spec.rb index a18b83f199b..07e11f014c3 100644 --- a/spec/workers/concerns/application_worker_spec.rb +++ b/spec/workers/concerns/application_worker_spec.rb @@ -45,7 +45,7 @@ RSpec.describe ApplicationWorker do instance.jid = 'a jid' expect(result).to include( - 'class' => worker.class, + 'class' => instance.class.name, 'job_status' => 'running', 'queue' => worker.queue, 'jid' => instance.jid @@ -69,7 +69,7 @@ RSpec.describe ApplicationWorker do it 'does not override predefined context keys with custom payload' do payload['class'] = 'custom value' - expect(result).to include('class' => worker.class) + expect(result).to include('class' => instance.class.name) end end