|
| 1 | +# This wiki page is migrating to [jda.wiki/contributing/contributing](https://jda.wiki/contributing/contributing/) |
| 2 | + |
| 3 | +*** |
| 4 | + |
| 5 | +## Setting up your Environment |
| 6 | + |
| 7 | + |
| 8 | +1. Create a Fork (If you already have a local repository skip to step 3) |
| 9 | + |
| 10 | +  |
| 11 | + |
| 12 | +2. Clone Repository |
| 13 | + |
| 14 | + ```sh |
| 15 | + $ git clone https://github.com/ExampleName/JDA.git |
| 16 | + Cloning into 'JDA'... |
| 17 | + remote: Counting objects: 15377, done. |
| 18 | + remote: Total 15377 (delta 0), reused 0 (delta 0), pack-reused 15377 |
| 19 | + Receiving objects: 100% (15377/15377), 21.64 MiB | 2.36 MiB/s, done. |
| 20 | + Resolving deltas: 100% (8584/8584), done. |
| 21 | + Checking connectivity... done. |
| 22 | + ``` |
| 23 | +> Replace `ExampleName` with your GitHub username, mine for example is `MinnDevelopment` |
| 24 | + |
| 25 | +3. Move to your local repository (here `JDA`) |
| 26 | + |
| 27 | + ```sh |
| 28 | + cd JDA |
| 29 | + ``` |
| 30 | + |
| 31 | +4. Configure upstream remote to keep your fork updated |
| 32 | + |
| 33 | + ```sh |
| 34 | + $ git remote add upstream https://github.com/DV8FromTheWorld/JDA.git |
| 35 | + ``` |
| 36 | + |
| 37 | +5. Create branch based on `upstream/master` |
| 38 | + |
| 39 | + ```sh |
| 40 | + $ git fetch upstream master |
| 41 | + From https://github.com/DV8FromTheWorld/JDA |
| 42 | + * branch master -> FETCH_HEAD |
| 43 | + * [new branch] master -> upstream/master |
| 44 | +
|
| 45 | + $ git checkout -b patch-1 upstream/master |
| 46 | + Switched to a new branch 'patch-1' |
| 47 | + ``` |
| 48 | + |
| 49 | +## Making Changes |
| 50 | + |
| 51 | +Depending on your changes, there are certain rules you have to follow if you expect |
| 52 | +your Pull Request to be merged. |
| 53 | + |
| 54 | +**Note**: It is recommended to create a new remote branch for each Pull Request. |
| 55 | +Based on the current `upstream/master`! |
| 56 | + |
| 57 | +1. Adding a new Method or Class |
| 58 | + - If your addition is not internal (e.g. an impl class or private method) you have to write documentation. |
| 59 | + - For that please follow the [[JavaDoc template|6)-JDA-Structure-Guide#javadoc]] |
| 60 | + - Keep your code consistent! [[example|5)-contributing#examples]] |
| 61 | + - Follow the guides provided at [[6) JDA Structure Guide|6)-JDA-Structure-Guide]] |
| 62 | + - Compare your code style to the one used all over JDA and ensure you |
| 63 | + do not break the consistency (if you find issues in the JDA style you can include and update it) |
| 64 | + |
| 65 | +2. Making a Commit |
| 66 | + - While having multiple commits can help the reader understand your changes, it might sometimes be |
| 67 | + better to include more changes in a single commit. |
| 68 | + - When you commit your changes write a proper commit caption which explains what you have done |
| 69 | + |
| 70 | +3. Updating your Fork |
| 71 | + - Before you start committing make sure your fork is updated. |
| 72 | + (See [Syncing a Fork](https://help.github.com/articles/syncing-a-fork/) |
| 73 | + or [Keeping a Fork Updated](https://robots.thoughtbot.com/keeping-a-github-fork-updated)) |
| 74 | + |
| 75 | +## Creating a Pull Request |
| 76 | + |
| 77 | +1. Commit your changes |
| 78 | + |
| 79 | + ```sh |
| 80 | + $ git commit -am "Updated Copyright in build.gradle" |
| 81 | + [patch-1 340383d] Updated Copyright in build.gradle |
| 82 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 83 | + ``` |
| 84 | + |
| 85 | +2. Push your commits |
| 86 | + |
| 87 | + ```sh |
| 88 | + $ git push origin patch-1 |
| 89 | + Counting objects: 3, done. |
| 90 | + Delta compression using up to 8 threads. |
| 91 | + Compressing objects: 100% (3/3), done. |
| 92 | + Writing objects: 100% (3/3), 313 bytes | 0 bytes/s, done. |
| 93 | + Total 3 (delta 2), reused 0 (delta 0) |
| 94 | + remote: Resolving deltas: 100% (2/2), completed with 2 local objects. |
| 95 | + To https://github.com/ExampleName/JDA.git |
| 96 | + * [new branch] patch-1 -> patch-1 |
| 97 | + ``` |
| 98 | + |
| 99 | +3. Open Pull-Request |
| 100 | + |
| 101 | +  |
| 102 | + |
| 103 | +4. Set base branch to |
| 104 | + `base fork: DV8FromTheWorld/JDA` `base: master` |
| 105 | + |
| 106 | +5. Allow edits from Maintainers |
| 107 | + |
| 108 | +6. Done! Just click **Create pull request** and await a review by one of the maintainers! |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | +### Examples |
| 113 | + |
| 114 | +*** |
| 115 | +**Bad Addition** |
| 116 | +```diff |
| 117 | ++ public void reset() { |
| 118 | ++ name.reset(); |
| 119 | ++ avatar.reset(); |
| 120 | ++ |
| 121 | ++ if (isType(AccountType.CLIENT)) { |
| 122 | ++ email.reset(); |
| 123 | ++ password.reset(); |
| 124 | ++ } |
| 125 | ++ } |
| 126 | +``` |
| 127 | +
|
| 128 | +**Good Addition** |
| 129 | +```diff |
| 130 | ++ /* |
| 131 | ++ * Resets all {@link net.dv8tion.jda.core.managers.fields.AccountField Fields} |
| 132 | ++ * for this manager instance by calling |
| 133 | ++ * {@link net.dv8tion.jda.core.managers.fields.Field#reset() Field.reset()} sequentially |
| 134 | ++ */ |
| 135 | ++ public void reset() |
| 136 | ++ { |
| 137 | ++ name.reset(); |
| 138 | ++ avatar.reset(); |
| 139 | ++ |
| 140 | ++ if (isType(AccountType.CLIENT)) |
| 141 | ++ { |
| 142 | ++ email.reset(); |
| 143 | ++ password.reset(); |
| 144 | ++ } |
| 145 | ++ } |
| 146 | +``` |
0 commit comments