[270] | 1 | # How to contribute
|
---|
| 2 |
|
---|
| 3 | mruby is an open-source project which is looking forward to each contribution.
|
---|
| 4 |
|
---|
| 5 | ## Your Pull Request
|
---|
| 6 |
|
---|
| 7 | To make it easy to review and understand your change please keep the following
|
---|
| 8 | things in mind before submitting your pull request:
|
---|
| 9 |
|
---|
| 10 | * Work on the latest possible state of **mruby/master**
|
---|
| 11 | * Create a branch which is dedicated to your change
|
---|
| 12 | * Test your changes before creating a pull request (```./minirake test```)
|
---|
| 13 | * If possible write a test case which confirms your change
|
---|
| 14 | * Don't mix several features or bug-fixes in one pull request
|
---|
| 15 | * Create a meaningful commit message
|
---|
| 16 | * Explain your change (i.e. with a link to the issue you are fixing)
|
---|
| 17 | * Use mrbgem to provide non ISO features (classes, modules and methods) unless
|
---|
| 18 | you have a special reason to implement them in the core
|
---|
| 19 |
|
---|
| 20 | ## Coding conventions
|
---|
| 21 |
|
---|
| 22 | How to style your C and Ruby code which you want to submit.
|
---|
| 23 |
|
---|
| 24 | ### C code
|
---|
| 25 |
|
---|
| 26 | The core part (parser, bytecode-interpreter, core-lib, etc.) of mruby is
|
---|
| 27 | written in the C programming language. Please note the following hints for your
|
---|
| 28 | C code:
|
---|
| 29 |
|
---|
| 30 | #### Comply with C99 (ISO/IEC 9899:1999)
|
---|
| 31 |
|
---|
| 32 | mruby should be highly portable to other systems and compilers. For this it is
|
---|
| 33 | recommended to keep your code as close as possible to the C99 standard
|
---|
| 34 | (http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).
|
---|
| 35 |
|
---|
| 36 | Although we target C99, Visual C++ is also an important target for mruby. For
|
---|
| 37 | this reason a declaration of a local variable has to be at the beginning of a
|
---|
| 38 | scope block.
|
---|
| 39 |
|
---|
| 40 | #### Reduce library dependencies to a minimum
|
---|
| 41 |
|
---|
| 42 | The dependencies to libraries should be kept to an absolute minimum. This
|
---|
| 43 | increases the portability but makes it also easier to cut away parts of mruby
|
---|
| 44 | on-demand.
|
---|
| 45 |
|
---|
| 46 | #### Don't use C++ style comments
|
---|
| 47 |
|
---|
| 48 | /* This is the preferred comment style */
|
---|
| 49 |
|
---|
| 50 | Use C++ style comments only for temporary comment e.g. commenting out some code lines.
|
---|
| 51 |
|
---|
| 52 | #### Insert a break after the method return value:
|
---|
| 53 |
|
---|
| 54 | int
|
---|
| 55 | main(void)
|
---|
| 56 | {
|
---|
| 57 | ...
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | ### Ruby code
|
---|
| 61 |
|
---|
| 62 | Parts of the standard library of mruby are written in the Ruby programming
|
---|
| 63 | language itself. Please note the following hints for your Ruby code:
|
---|
| 64 |
|
---|
| 65 | #### Comply with the Ruby standard (ISO/IEC 30170:2012)
|
---|
| 66 |
|
---|
| 67 | mruby is currently targeting to execute Ruby code which complies to ISO/IEC
|
---|
| 68 | 30170:2012 (http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579).
|
---|