Skip to content

Code Style

Ana María Martínez Gómez edited this page Feb 20, 2018 · 10 revisions

Code Style

Ruby code Style

We are using Rubocop to check the code style. We are following the Rubocop defaults, with the exceptions in .rubocop.yml. We are not following any other style conventions.

The decision of adding a new style rule (Rubocop cop) is made when updating Rubocop. In the PR for updating it, you can raise you concerns if you don't agree with the default Rubocop configuration. The developers team should reach an agreement about all the new style rules. If an agreement is not possible, the rule will get disabled in .rubocop.yml. This means that PRs to update Rubocop needs to be carefully reviewed and that they shouldn't be immediately merged to allow that everybody can review them. Normally, every Rubocop update introduces plenty of new cops.

When changing the default configuration, by adding custom configuration to .rubocop.yml, add a comment that explains why the rule was disabled.

If you don't agree with an already agreed style rule, please open an issue to reach a new agreement with the development team. Do not send a PR to change style rules that haven't been accepted.

Note that the offenses in .rubocop_todo.yml, are rules we have already agreed on but that we didn't solve yet (most likely because we didn't have time). That means that those offenses can be solved without a previous discussion. In case that you don't agree with an already introduced style rule, you can open a PR to discuss about it, but do not complain in the PR to solve the offenses.

When reviewing PRs with Ruby Code, do not add complains about code style. Rubocop will fail if the style is not correct. Otherwise, the style rule is not agreed. You can always send a PR to Rubocop if you think that a new cop is needed.

Clone this wiki locally