-
Notifications
You must be signed in to change notification settings - Fork 2
Style Guide
Mathieu Tuli edited this page Nov 18, 2019
·
8 revisions
Follow the following guide, and for extra information not found in this readme, refer to theGoogle Style Guide
-
Standard libraries always on top
-
Local includes below
-
Space each set of includes by an empty line
-
Order by longest include on top
-
example
#include <iostream>
#include <string>
#include "ChannelMonitor.hpp"
#include "Chanel.hpp"
2 character-long spacing (Indent 2 spaces at a time). No tabbing, make sure your IDE or text-editor or ... is set to emit spaces when you tab. example
int main(){
int i;
for(;;){
i++
}
}
- Class Names
- UpperCamelCase
class ThisIsAnExample
- File Names
- Files for Class definitions
- UpperCamelCase for class name
- Files for Class definitions
ThisIsAnExample.hpp
ThisIsAnExample.cpp
- Else
- lowercase underscore spaced
this_is_another_example.hpp
this_is_another_example.cpp
- Functions
- Lowercase underscore spaced
void this_is_an_example(){}
- Global Variables
- All caps underscore spaced
#define THIS_IS_AN_EXAMPLE
- Variables
- lowercase underscore seperated
int this_is_an_example
- Do not
usenamspaces, explicitly declare them inline- DON'T
using namespace std; - DO
std::cout << "Hello" << std::endl;
- DON'T
Follow the following guide, and for extra information not found in this readme, refer to theGoogle Style Guide
-
Standard libraries always on top
-
fromincludes aboveimports -
Local includes below
-
Space each set of includes by an empty line
-
Order by longest include on top
-
example
from pathlib import Path
from example import A
import opencv
import pyqt
import local.local.local
import other.local
4 character space tabbing, as required by Python (duh) example
def main():
i = 0
for i in [1, 2, 3]:
print(i)
- Class Names
- UpperCamelCase
class ThisIsAnExample:
- File Names
- Files for Class definitions
- UpperCamelCase for class name
- Files for Class definitions
ThisIsAnExample.py
- Else
- lowercase underscore spaced
this_is_another_example.py
- Functions
- Lowercase underscore spaced
def this_is_an_example:
- Global Variables
- All caps underscore spaced
THIS_IS_AN_EXAMPLE = 2
- Variables
- lowercase underscore seperated
this_is_an_example = 1