Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1003 Bytes

CodingStyle.md

File metadata and controls

46 lines (37 loc) · 1003 Bytes

Coding style

  • This project uses 4 space indentation, not tabs.
  • Class names are UpperCamelCased
class DigitalSensor : public BaseSensor {
    [...]
}
  • Method names are lowerCamelCased:
int buttonFromRelay(unsigned int relay_id) {
    [...]
}
  • Variables should be underscored_lower_case (I know, I don't always follow this rule myself - in many cases they are also lowerCamelCased):
// Preferred:
bool delete_flag = false;

// Less preferred:
unsigned long rfCodeON = 0;
  • Private methods and variables (even if private to the module they are declared on) are "_"-leaded
bool _dcz_enabled = false;

int _domoticzRelay(unsigned int idx) {
    [...]
}
  • Function and if() / for() starting bracket is in the same line:
int _domoticzRelay(unsigned int idx) {
    [...]
}
 

Linting

Code is checked using cppcheck.

I know current code does not always follow these rules. I'm fixing it as I rework each of the modules.