summaryrefslogtreecommitdiff
path: root/doc/development/contributing/style_guides.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/contributing/style_guides.md')
-rw-r--r--doc/development/contributing/style_guides.md36
1 files changed, 31 insertions, 5 deletions
diff --git a/doc/development/contributing/style_guides.md b/doc/development/contributing/style_guides.md
index 2e696cf517b..9d04e1590d0 100644
--- a/doc/development/contributing/style_guides.md
+++ b/doc/development/contributing/style_guides.md
@@ -2,7 +2,7 @@
type: reference, dev
stage: none
group: Development
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
+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
@@ -41,13 +41,13 @@ We were using Overcommit prior to Lefthook, so you may want to uninstall it firs
bundle exec lefthook install
```
-1. Test Lefthook is working by running the Lefthook `prepare-commit-msg` Git hook:
+1. Test Lefthook is working by running the Lefthook `pre-push` Git hook:
```shell
- bundle exec lefthook run prepare-commit-msg
+ bundle exec lefthook run pre-push
```
-This should return a fully qualified path command with no other output.
+This should return the lefthook version and the list of executable commands with output.
### Lefthook configuration
@@ -153,11 +153,37 @@ to add it to our [GitLab Styles](https://gitlab.com/gitlab-org/gitlab-styles) ge
If the Cop targets rules that only apply to the main GitLab application,
it should be added to [GitLab](https://gitlab.com/gitlab-org/gitlab) instead.
+### Cop grace period
+
+A cop is in a "grace period" if it is enabled and has `Details: grace period` defined in its TODO YAML configuration.
+
+On the default branch, all of the offenses from cops in the ["grace period"](../rake_tasks.md#run-rubocop-in-graceful-mode) will not fail the RuboCop CI job. The job will notify Slack in the `#f_rubocop` channel when offenses have been silenced in the scheduled pipeline. However, on merge request pipelines, the RuboCop job will fail.
+
+A grace period can safely be lifted as soon as there are no warnings for 2 weeks in the `#f_rubocop` channel on Slack.
+
+### Enabling a new cop
+
+1. Enable the new cop in `.rubocop.yml` (if not already done via [`gitlab-styles`](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles)).
+1. [Generate TODOs for the new cop](../rake_tasks.md#generate-initial-rubocop-todo-list).
+1. [Set the new cop to "grace period"](#cop-grace-period).
+1. Create an issue to fix TODOs and encourage Community contributions (via ~"good for new contributors" and/or ~"Seeking community contributions"). [See some examples](https://gitlab.com/gitlab-org/gitlab/-/issues/?sort=created_date&state=opened&label_name%5B%5D=good%20for%20new%20contributors&label_name%5B%5D=static%20code%20analysis&first_page_size=20).
+1. Create an issue to remove "grace period" after 2 weeks silence in `#f_rubocop` Slack channel. ([See an example](https://gitlab.com/gitlab-org/gitlab/-/issues/374903).)
+
+### Silenced offenses
+
+When offenses are silenced for cops in ["grace period"](#cop-grace-period),
+the `#f_rubocop` Slack channel receives a notification message every two hours.
+
+To fix this issue:
+
+1. Find cops with silenced offenses in the linked CI job.
+1. [Generate TODOs](../rake_tasks.md#generate-initial-rubocop-todo-list) for these cops.
+
#### RuboCop node pattern
When creating [node patterns](https://docs.rubocop.org/rubocop-ast/node_pattern.html) to match
Ruby's AST, you can use [`scripts/rubocop-parse`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/scripts/rubocop-parse)
-to display the AST of a Ruby expression, in order to help you create the matcher.
+to display the AST of a Ruby expression, to help you create the matcher.
See also [!97024](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97024).
### Resolving RuboCop exceptions