Grog-Knight

some game in C++
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/Grog-Knight

Contributing.md (4222B)


      1 # How to Contribute
      2 
      3 Wanna contribute ? Nice :D
      4 
      5 There are some code rules, to keep the project and the code readable.
      6 
      7 ### Releases:
      8 > Base code's rules
      9 Louis <louis@ne02ptzero.me>
     10 
     11 # Code Norm
     12 
     13 ### Base
     14 
     15 ##### Style
     16 The K & R style is __REQUIRED__
     17 
     18 ```cpp
     19 if (TRUE) {
     20 	/* Some code */
     21 } else {
     22 	/* Some code again */
     23 }
     24 ```
     25 
     26 ##### Naming convention
     27 
     28 For function's name, go with the Javascript Naming rules:
     29 
     30 ```cpp
     31 void	myAwesomeFunction(void) {
     32 	/* Some code */
     33 }
     34 ```
     35 ##### File name convention
     36 
     37 For a class file, respect the Javascript naming rules (^)
     38 `MyClassName.cpp`
     39 `MyClassName.hpp`
     40 Of course, the name of the class file must the respect the name of the class itself.
     41 
     42 
     43 For a main, or outside-class functions, the Unix convention.
     44 `main.cpp`
     45 `my_awesome_functions.cpp`
     46 
     47 > Author's note:
     48 >
     49 > Seems like a little complicated, but we can actually make the difference between class and functions with a ls.
     50 
     51 ### Class
     52 
     53 ##### Headers
     54 
     55 A header file __must have__ a protection against infinite inclusion:
     56 ```cpp
     57 #ifdef __CLASS__
     58 # define __CLASS__
     59 /* Header's code */
     60 #endif
     61 ```
     62 
     63 Also, for a class, please the respect this template:
     64 
     65 ```cpp
     66 class	MyClass {
     67 	// Public first
     68 	public:
     69 		/* Constructors and Destructors */
     70 		MyClass();
     71 		...
     72 
     73 		/* Functions */
     74 		void	makeSomeStuff(void);
     75 		...
     76 
     77 		/* Variables */
     78 		int		n;
     79 		...
     80 
     81 	// Then, private, same order as public.
     82 	private:
     83 		...
     84 };
     85 ```
     86 The order is this one: public, protected, private.
     87 
     88 ### Comments
     89 
     90 
     91 ##### Base Header
     92 A header file comment is required:
     93 
     94 ```cpp
     95 /**
     96  * File: FileName.cpp
     97  * Creation: YYYY-MM-DD HH:MM
     98  * Username <username@mail.com>
     99  */
    100 ```
    101 
    102 ##### License
    103 Also, we are on the Apache License, so __EACH__ file would have the following header:
    104 ```cpp
    105 /**
    106  * Licensed to the Apache Software Foundation (ASF) under one
    107  * or more contributor license agreements.  See the NOTICE file
    108  * distributed with this work for additional information
    109  * regarding copyright ownership.  The ASF licenses this file
    110  * to you under the Apache License, Version 2.0 (the
    111  * "License"); you may not use this file except in compliance
    112  * with the License.  You may obtain a copy of the License at
    113  *
    114  *  http://www.apache.org/licenses/LICENSE-2.0
    115  *
    116  *  Unless required by applicable law or agreed to in writing,
    117  *  software distributed under the License is distributed on an
    118  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    119  *  KIND, either express or implied.  See the License for the
    120  *  specific language governing permissions and limitations
    121  * under the License.
    122  */
    123 ```
    124 
    125 #### Function comment header
    126 A header to __EACH__ function is required too, except one-line function (Getters and setters).
    127 ```cpp
    128 //! Brief resumee
    129 /**
    130  * What the function do (In a few words)
    131  * @param First Parameter name Description
    132  * @param Second Parameter name Description
    133  * ...
    134  * @return The return variable description
    135  */
    136 
    137 /* EXAMPLE */
    138 
    139 //! Count the length of a string
    140 /**
    141  * Count and return the length of a string.
    142  * This function already exists in the libc, this one's better
    143  * @param str The string
    144  * @return The len of the string
    145  */
    146 size_t		strlen(const char *str) {
    147 	/* Some code */
    148 	return n;
    149 }
    150 ```
    151 
    152 # Git rules
    153 
    154 ### Commit
    155 
    156 A Commit norm is also required:
    157 ```
    158 Action(target): Title
    159 <Blank line>
    160 Description of the commit
    161 Can be two lines
    162 <Blank line>
    163 ```
    164 
    165 Here action is the basic code change on a project (Add, Fix, Feat (Features), Bug, Doc).
    166 The target is where your commit is making change (Core, Graphic design, physic motor, etc....)
    167 
    168 **Example:**
    169 ```
    170 git commit -m "Add(Core): Add a debug function
    171 
    172 I've added a debug function, to close the issue #154
    173 Also, we gain 1.3s at the build.
    174 
    175 "
    176 ```
    177 
    178 ### Working Space
    179 
    180 We working on the branch [build](https://github.com/Ne02ptzero/rogue-like/tree/build)
    181 
    182 So, if you have modifications to make (Code, docs or even pictures), please do it on this branch.
    183 
    184 The master __must__ be buildable and stable.
    185 
    186 ### Build
    187 
    188 *For main contributors:*
    189 Be careful, the build verification is made __after__ your push. so look at the travis icon for build.
    190 
    191 *For pull requests*
    192 Travis automatically makes the build, so if it failed, we can send you the debug as a comment to your pull request.
    193 
    194 Happy contributing :)