-
Notifications
You must be signed in to change notification settings - Fork 15
Standards
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!
-
Class:
Configuration
andRange
, are class names already taken by Rails and Ruby respectively. So in the context of the project we should always refer to them asKalibroConfiguration
andKalibroRange
; -
Variable: It is known that in the project context we have classes
Configuration
,MetricConfiguration
,Metric
,MetricResult
andModuleResult
, so in order to avoid confusions:-
Configuration
type variables are calledconfiguration
-
MetricConfiguration
type variables are calledmetric_configuration
and not justconfiguration
ormetric
-
Metric
type variables are calledmetric
-
MetricResult
type variables are calledmetric_result
and not justresult
ormetric
-
ModuleResult
type variables are calledmodule_result
and not justresult
-
- The indentation should always use two blank spaces.
- Decision structures should use
&&
and||
instead ofand
andor
; - 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.
- Use the
let
construction (https://www.relishapp.com/rspec/rspec-core/docs/helper-methods/let-and-let) instead of creating global variables.