Skip to content
rafamanzo edited this page Nov 1, 2014 · 2 revisions

In this page we look to present some standards that we've adopted through the development and that we expect to see on contributions.

If you find yourself in a situation not covered by this page, have a look at http://guidelines.plataformatec.com.br/ and open a issue with your question. You can as well base on similar code snippets from the project.

If you find bunchs of the code that are out of the standards defined here, feel free to fix it or open an issue letting us know about it. Thank you!

Naming

  • Class: Configuration and Range, are class names already taken by Rails and Ruby respectively. So in the context of the project we should always refer to them as KalibroConfiguration and KalibroRange;
  • Variable: It is known that in the project context we have classes Configuration, MetricConfiguration, Metric, MetricResult and ModuleResult, so in order to avoid confusions:
    • Configuration type variables are called configuration
    • MetricConfiguration type variables are called metric_configuration and not just configuration or metric
    • Metric type variables are called metric
    • MetricResult type variables are called metric_result and not just result or metric
    • ModuleResult type variables are called module_result and not just result

Code style

  • The indentation should always use two blank spaces.

Ruby

  • Decision structures should use && and || instead of and and or;
  • When calling a method or function, always use it's parenthesis;
  • Don't leave blank lines when you're finishing a block between the code and the end statement.

RSpec