|
| 1 | +# Contributing |
| 2 | + |
| 3 | +The following are few guidelines and answers intended for contributors |
| 4 | + |
| 5 | +## What can i contribute ? |
| 6 | + |
| 7 | +you can contribute by making one of those: |
| 8 | +* Report a bug ([jump](#bug)) |
| 9 | +* Suggest a feature ([jump](#feature)) |
| 10 | +* Code a change (this should be first suggested) ([jump](#code-change)) |
| 11 | + |
| 12 | +## How can i contribute ? |
| 13 | + |
| 14 | +### <a id='bug'></a>Reporting a bug |
| 15 | + |
| 16 | +Bugs are reported at the [issue tracker] |
| 17 | + |
| 18 | +If you think you found a bug: |
| 19 | +* Check the [issue tracker] |
| 20 | + * If you did find a relevant post about the problem: bring details or an upvote (even in closed issue) |
| 21 | + * if you didn't find a relevant post then you can create a new issue |
| 22 | + * The title should be relevant, explaining the problem in few words, avoid uppercases letters |
| 23 | + * The issue should be very detailed, explaining how to reproduce the bug, containing anything that you think useful in order to fix it |
| 24 | + |
| 25 | +### <a id='feature'></a>Suggesting a feature |
| 26 | + |
| 27 | +Features are also welcome but there are few things to take into account. |
| 28 | + |
| 29 | +* Features are also tracked [here](https://github.com/tonykero/Moe/issues), check it before suggesting a feature in order to avoid duplicates. |
| 30 | +* Features should be relevant to the Moe library, you don't want to see a machine-learning library with a built-in currency converter |
| 31 | +* Feature suggestions are discussions, but don't depend on a general agreement |
| 32 | + |
| 33 | +### <a id='code-change'></a>Making changes |
| 34 | + |
| 35 | +Code contributions are more than welcome! |
| 36 | + |
| 37 | +* Check for duplicates [here](https://github.com/tonykero/Moe/pulls) |
| 38 | +* Use [pull requests] in order to submit a change |
| 39 | +* Follow [code style guidelines](#coding-style) |
| 40 | +* Dependencies should be optional (#define / CMake Option) |
| 41 | +* Commit on a disctinct branch |
| 42 | +* If your contribution fix an issue, it should preferably only fix one or closely related ones |
| 43 | +* Explain and comment your code |
| 44 | + |
| 45 | +## <a id='coding-style'></a>Coding Style |
| 46 | + |
| 47 | +The following is the coding style used in Moe |
| 48 | + |
| 49 | +### Naming |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +Variables naming is in lowerCamelCase |
| 54 | +```cpp |
| 55 | +unsigned int moesCount; |
| 56 | +``` |
| 57 | +> we need a basic style to start with |
| 58 | +
|
| 59 | +--- |
| 60 | + |
| 61 | +Members variables are also written in lowerCamelCase, but have a 'm_' prefix |
| 62 | +```cpp |
| 63 | +std::string m_id; |
| 64 | +``` |
| 65 | +> to distinguish them from function-scoped variables |
| 66 | +
|
| 67 | +--- |
| 68 | + |
| 69 | +Arguments have a '_' prefix |
| 70 | +```cpp |
| 71 | +void run( unsigned int _generations ); |
| 72 | +``` |
| 73 | +> to distinguish them from members, notably in setters |
| 74 | +
|
| 75 | +--- |
| 76 | +
|
| 77 | +Then classes are written in UpperCamelCase, with first public members then private members |
| 78 | +```cpp |
| 79 | +class UltraPowerfulAlgorithm : public PowerfulAlgorithm |
| 80 | +{ |
| 81 | + public: |
| 82 | + void run( unsigned int _generations ); |
| 83 | + |
| 84 | + private: |
| 85 | + unsigned int m_generations; |
| 86 | +}; |
| 87 | +``` |
| 88 | +> note braces placement |
| 89 | +
|
| 90 | +### Indentation |
| 91 | + |
| 92 | +Indentations should be 4-space long |
| 93 | + |
| 94 | +also if you have multiple variables declarations: |
| 95 | +```cpp |
| 96 | +unsigned int m_moesPerGen; |
| 97 | +unsigned int m_generations; |
| 98 | +``` |
| 99 | +should be |
| 100 | +```cpp |
| 101 | +unsigned int m_moesPerGen, |
| 102 | + m_generations; |
| 103 | +``` |
| 104 | + |
| 105 | +### Other points: |
| 106 | +* Keep naming simple: 3 words max |
| 107 | +* There is no file naming rule |
| 108 | +* No forward-declaration |
| 109 | +* Keep header-only |
| 110 | +* Keep dependency-free (or optional dependencies) |
| 111 | +* Keep platform independent |
| 112 | + |
| 113 | +Parsing the source in order to be confident with the coding style is recommended. |
| 114 | + |
| 115 | +[pull requests]: https://github.com/tonykero/Moe/pulls |
| 116 | +[issue tracker]: https://github.com/tonykero/Moe/issues |
0 commit comments