diff options
Diffstat (limited to 'doc/development/contributing/style_guides.md')
-rw-r--r-- | doc/development/contributing/style_guides.md | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/doc/development/contributing/style_guides.md b/doc/development/contributing/style_guides.md index fd3fe239110..bfaee407cb8 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/#designated-technical-writers +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 --- # Style guides @@ -39,6 +39,9 @@ go get github.com/Arkweid/lefthook ## Or with Rubygems gem install lefthook +### You may need to run the following if you're using rbenv +rbenv rehash + # 3. Install the Git hooks lefthook install -f ``` @@ -94,6 +97,32 @@ To that end, we encourage creation of new RuboCop rules in the codebase. When creating a new cop that could be applied to multiple applications, we encourage you to add it to our [GitLab Styles](https://gitlab.com/gitlab-org/gitlab-styles) gem. +### Resolving RuboCop exceptions + +When the number of RuboCop exceptions exceed the default [`exclude-limit` of 15](https://docs.rubocop.org/rubocop/1.2/usage/basic_usage.html#command-line-flags), +we may want to resolve exceptions over multiple commits. To minimize confusion, +we should track our progress through the exception list. + +When auto-generating the `.rubocop_todo.yml` exception list for a particular Cop, +and more than 15 files are affected, we should add the exception list to +a different file, `.rubocop_manual_todo.yml`. + +This ensures that our list isn't mistakenly removed by another auto generation of +the `.rubocop_todo.yml`. This also allows us greater visibility into the exceptions +which are currently being resolved. + +One way to generate the initial list is to run the todo auto generation, +with `exclude limit` set to a high number. + +```shell +bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit=10000 +``` + +You can then move the list from the freshly generated `.rubocop_todo.yml` for the Cop being actively +resolved and place it in the `.rubocop_manual_todo.yml`. In this scenario, do not commit auto generated +changes to the `.rubocop_todo.yml` as an `exclude limit` that is higher than 15 will make the +`.rubocop_todo.yml` hard to parse. + ## Database migrations See the dedicated [Database Migrations Style Guide](../migration_style_guide.md). |