- Create a feature branch from the default branch (`master`) and merge back against that branch.
- It's OK to have multiple small commits as you work on the PR - GitHub automatically squashes them before merging.
- Make sure tests pass.
- If adding a new feature:
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.
- If fixing bug:
- If you are resolving an open issue, add `(fix #xxxx)` (`#xxxx` being the issue ID) in your PR title for a better release log, e.g. `chore(feat): implement SSR (fix #1234)`.
- Provide a detailed description of the bug in the PR.
## Code Specification
- use QT wherever it's possible (except there is a good reason)
- use unix line endings (not windows)
- indent your code with TABs instead of spaces
- your files should end with a newline
- names are camel case
- use utf8 file encoding (ANSI encoding is strictly forbidden!)
- use speaking names for variables.
- avoid code dups -> if you write similar code blocks more the 2 times -> refactoring!
- avoid compiler macros (#ifdef #define ...) where possible
- class member variables must prefixed with underscore `int _myMemberVar`
- initializer list on constructors:
```c++
bad:
MyClass::MyClass()
: myVarA(0), myVarB("eee"), myVarC(true)
{
}
MyClass::MyClass() : myVarA(0),
myVarB("eee"),
myVarC(true)
{
}
good:
MyClass::MyClass()
: myVarA(0)
, myVarB("eee")
, myVarC(true)
{
}
```
- pointer declaration
```c++
bad:
int *foo;
int * fooFoo;
good:
int* foo;
```
### Logger
Hyperion has a own logger class with different log levels.
- Use macros in include/utils/logger.h
- Don't use the Logger class directly unless there is a good reason to do so.
``` c++
// *** including
#include <utils/logger.h>
// creating
// get a logger, this will create a logger named MAIN with min loglevel INFO, DEBUG messages won't displayed
Logger * log_main = Logger::getInstance("MAIN");
// get a logger, this will create a logger named MAIN with min loglevel DEBUG, all messages displayed