Contributing
Setting up your Environment¶
-
Create a Fork (If you already have a local repository skip to step 3)
-
Clone Repository
$ git clone https://github.com/ExampleName/JDA.git # (1) Cloning into 'JDA'... remote: Counting objects: 15377, done. remote: Total 15377 (delta 0), reused 0 (delta 0), pack-reused 15377 Receiving objects: 100% (15377/15377), 21.64 MiB | 2.36 MiB/s, done. Resolving deltas: 100% (8584/8584), done. Checking connectivity... done.
- Make sure to replace
ExampleName
with your GitHub Username.
- Make sure to replace
-
Move to your local repository (here
JDA
)cd JDA
-
Configure upstream remote to keep your fork updated
$ git remote add upstream https://github.com/discord-jda/JDA.git
-
Create branch based on
upstream/master
$ git fetch upstream master From https://github.com/discord-jda/JDA * branch master -> FETCH_HEAD * [new branch] master -> upstream/master $ git checkout -b patch-1 upstream/master Switched to a new branch 'patch-1'
Making Changes¶
Depending on your changes there are certain rules you have to follow if you expect your Pull Request to be merged.
Note: It is recommended to create a new remote branch for each Pull Request
based on the current upstream/master
changes!
-
Adding a new Method or Class
- If your addition is not internal (e.g. an impl class or private method) you have to write documentation.
- For that please follow the JavaDoc template
- Keep your code consistent!
- Follow the Structure Guide
- Compare your code style to the one used all over JDA and ensure you do not break the consistency (if you find issues in the JDA style you can include and update it)
Example
+ public void reset() { + name.reset(); + avatar.reset(); + + if (isType(AccountType.CLIENT)) { + email.reset(); + password.reset(); + } + }
+ /* + * Resets all {@link net.dv8tion.jda.core.managers.fields.AccountField Fields} + * for this manager instance by calling + * {@link net.dv8tion.jda.core.managers.fields.Field#reset() Field.reset()} sequentially + */ + public void reset() + { + name.reset(); + avatar.reset(); + + if (isType(AccountType.CLIENT)) + { + email.reset(); + password.reset(); + } + }
- If your addition is not internal (e.g. an impl class or private method) you have to write documentation.
-
Making a Commit
- While having multiple commits can help the reader understand your changes, it might sometimes be better to include more changes in a single commit.
- When you commit your changes write a proper commit caption which explains what you have done
-
Updating your Fork
- Before you start committing make sure your fork is updated. (See Syncing a Fork or Keeping a Fork Updated)
Creating a Pull Request¶
-
Commit your changes
$ git commit -am "Updated Copyright in build.gradle" [patch-1 340383d] Updated Copyright in build.gradle 1 file changed, 1 insertion(+), 1 deletion(-)
-
Push your commits
$ git push origin patch-1 Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 313 bytes | 0 bytes/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), completed with 2 local objects. To https://github.com/ExampleName/JDA.git * [new branch] patch-1 -> patch-1
-
Open Pull-Request
-
Set base branch to
base fork: discord-jda/JDA
base: master
-
Allow edits from Maintainers
-
Done! Just click Create pull request and await a review by one of the maintainers!