- Editor/IDE styling standardization
- Pre-commit static analysis
- Ruby, Rails, RSpec
- Database migrations
- Shell commands (Ruby)
- Shell scripting
We use EditorConfig to automatically apply certain styling
standards before files are saved locally. Most editors/IDEs will honor the
settings automatically by default. If your editor/IDE does not automatically support
we suggest investigating to see if a plugin exists. For instance here is the
plugin for vim.
You’re strongly advised to install Overcommit to automatically check for static analysis offenses before committing locally.
In your GitLab source directory run:
make -C tooling/overcommit
Then before a commit is created, Overcommit will automatically check for RuboCop (and other checks) offenses on every modified file.
This saves you time as you don’t have to wait for the same errors to be detected by the CI.
Overcommit relies on a pre-commit hook to prevent commits that violate its ruleset.
If you wish to override this behavior, it can be done by passing the ENV variable
OVERCOMMIT_DISABLE=1 git rebase master to rebase while
disabling the Git hook.
Our codebase style is defined and enforced by RuboCop.
You can check for any offenses locally with
bundle exec rubocop --parallel.
On the CI, this is automatically checked by the
For RuboCop rules that we have not taken a decision on yet, we follow the Ruby Style Guide, Rails Style Guide, and RSpec Style Guide as general guidelines to write idiomatic Ruby/Rails/RSpec, but reviewers/maintainers should be tolerant and not too pedantic about style.
Similarly, some RuboCop rules are currently disabled, and for those, reviewers/maintainers must not ask authors to use one style or the other, as both are accepted. This isn’t an ideal situation since this leaves space for bike-shedding, and ideally we should enable all RuboCop rules to avoid style-related discussions/nitpicking/back-and-forth in reviews.
See the dedicated Database Migrations Style Guide.
See the dedicated JS Style Guide.
See the dedicated SCSS Style Guide.
See the dedicated Go standards and style guidelines.
See the dedicated Guidelines for shell commands in the GitLab codebase.
See the dedicated Shell scripting standards and style guidelines.
We’re following Ciro Santilli’s Markdown Style Guide.
See the dedicated Documentation Style Guide.
See the dedicated Python Development Guidelines.
Code should be written in US English.