2018-10-11 07:57:49 -04:00
# Style guides
2019-07-08 20:20:40 -04:00
1. [Ruby ](https://github.com/rubocop-hq/ruby-style-guide ).
2018-10-11 07:57:49 -04:00
Important sections include [Source Code Layout][rss-source] and
[Naming][rss-naming]. Use:
- multi-line method chaining style **Option A** : dot `.` on the second line
- string literal quoting style **Option A** : single quoted by default
2019-07-08 20:20:40 -04:00
1. [Rails ](https://github.com/rubocop-hq/rails-style-guide )
2018-10-11 07:57:49 -04:00
1. [Newlines styleguide][newlines-styleguide]
1. [Testing][testing]
1. [JavaScript styleguide][js-styleguide]
1. [SCSS styleguide][scss-styleguide]
2019-04-10 21:52:42 -04:00
1. [Shell commands (Ruby) ](../shell_commands.md ) created by GitLab
2018-10-11 07:57:49 -04:00
contributors to enhance security
1. [Database Migrations ](../migration_style_guide.md )
2019-07-08 20:20:40 -04:00
1. [Markdown ](https://cirosantilli.com/markdown-style-guide/ )
2018-10-11 07:57:49 -04:00
1. [Documentation styleguide ](../documentation/styleguide.md )
1. Interface text should be written subjectively instead of objectively. It
should be the GitLab core team addressing a person. It should be written in
present time and never use past tense (has been/was). For example instead
of _prohibited this user from being saved due to the following errors:_ the
text should be _sorry, we could not create your account because:_
1. Code should be written in [US English][us-english]
2019-02-06 11:10:12 -05:00
1. [Go ](../go_guide/index.md )
2019-03-16 17:49:59 -04:00
1. [Python ](../python_guide/index.md )
2019-07-23 22:52:01 -04:00
1. [Shell scripting ](../shell_scripting_guide/index.md )
2018-10-11 07:57:49 -04:00
2019-09-02 01:38:27 -04:00
## Checking the style and other issues
2018-10-11 07:57:49 -04:00
This is also the style used by linting tools such as
2019-07-08 20:20:40 -04:00
[RuboCop ](https://github.com/rubocop-hq/rubocop ) and [Hound CI ](https://houndci.com ).
2019-09-02 01:38:27 -04:00
You can run RuboCop by hand or install a tool like [Overcommit ](https://github.com/sds/overcommit ) to run it for you.
Overcommit will automatically run the configured checks (like Rubocop) on every modified file before commit. You can use the example overcommit configuration found in `.overcommit.yml.example` as a quickstart.
This saves you time as you don't have to wait for the same errors to be detected by the CI.
2018-10-11 07:57:49 -04:00
---
[Return to Contributing documentation ](index.md )
2019-06-27 21:15:36 -04:00
[rss-source]: https://github.com/rubocop-hq/ruby-style-guide/blob/master/README.adoc#source-code-layout
[rss-naming]: https://github.com/rubocop-hq/ruby-style-guide/blob/master/README.adoc#naming-conventions
2018-10-11 07:57:49 -04:00
[doc-guidelines]: ../documentation/index.md "Documentation guidelines"
[js-styleguide]: ../fe_guide/style_guide_js.md "JavaScript styleguide"
[scss-styleguide]: ../fe_guide/style_guide_scss.md "SCSS styleguide"
[newlines-styleguide]: ../newlines_styleguide.md "Newlines styleguide"
[testing]: ../testing_guide/index.md
[us-english]: https://en.wikipedia.org/wiki/American_English