debian-mirror-gitlab/doc/development/contributing/style_guides.md

48 lines
2.6 KiB
Markdown
Raw Normal View History

2018-12-13 13:39:08 +05:30
# Style guides
2019-09-30 21:07:59 +05:30
1. [Ruby](https://github.com/rubocop-hq/ruby-style-guide).
2018-12-13 13:39:08 +05:30
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-09-30 21:07:59 +05:30
1. [Rails](https://github.com/rubocop-hq/rails-style-guide)
2018-12-13 13:39:08 +05:30
1. [Newlines styleguide][newlines-styleguide]
1. [Testing][testing]
1. [JavaScript styleguide][js-styleguide]
1. [SCSS styleguide][scss-styleguide]
2019-07-31 22:56:46 +05:30
1. [Shell commands (Ruby)](../shell_commands.md) created by GitLab
2018-12-13 13:39:08 +05:30
contributors to enhance security
1. [Database Migrations](../migration_style_guide.md)
2019-09-30 21:07:59 +05:30
1. [Markdown](https://cirosantilli.com/markdown-style-guide/)
2018-12-13 13:39:08 +05:30
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-03-02 22:35:43 +05:30
1. [Go](../go_guide/index.md)
2019-07-07 11:18:12 +05:30
1. [Python](../python_guide/index.md)
2019-10-12 21:52:04 +05:30
1. [Shell scripting](../shell_scripting_guide/index.md)
2018-12-13 13:39:08 +05:30
2019-12-04 20:38:33 +05:30
## Checking the style and other issues
2018-12-13 13:39:08 +05:30
This is also the style used by linting tools such as
2019-09-30 21:07:59 +05:30
[RuboCop](https://github.com/rubocop-hq/rubocop) and [Hound CI](https://houndci.com).
2019-12-04 20:38:33 +05:30
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-12-13 13:39:08 +05:30
---
[Return to Contributing documentation](index.md)
2019-09-30 21:07:59 +05:30
[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-12-13 13:39:08 +05:30
[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