# Contributing to JHipster Are you ready to contribute to JHipster core? We'd love to have you on board, and we will help you as much as we can. Here are the guidelines we'd like you to follow so that we can be of more help: - [Questions and help](#questions-and-help) - [Issues and Bugs](#issues-and-bugs) - [Feature Requests](#feature-requests) - [Submission Guidelines](#submission-guidelines) - [Coding Rules](#coding-rules) - [Git Commit Guidelines](#git-commit-guidelines) And don't forget we also accept [financial contributions to the project](http://www.jhipster.tech/sponsors/) using OpenCollective. ## Questions and help This is the JHipster core bug tracker, and it is used for [Issues and Bugs](#issues-and-bugs) and for [Feature Requests](#feature-requests). It is **not** a help desk or a support forum. If you have a question on using JHipster, or if you need help with your JHipster core project, please [read our help page](http://www.jhipster.tech/help/) and use the [JHipster tag on StackOverflow](http://stackoverflow.com/tags/jhipster) or join our [Gitter.im chat room](https://gitter.im/jhipster/generator-jhipster). ## Issues and Bugs If you find a bug in the source code or a mistake in the documentation, you can help us by [submitting a ticket](https://opensource.guide/how-to-contribute/#opening-an-issue) to our [GitHub issues](https://github.com/jhipster/jhipster-core/issues). Even better, you can submit a Pull Request to our [JHipster core project](https://github.com/jhipster/jhipster-core) or to our [Documentation project](https://github.com/jhipster/jhipster.github.io). **Please see the Submission Guidelines below**. ## Feature Requests You can request a new feature by submitting a ticket to our [GitHub issues](https://github.com/jhipster/jhipster-core/issues). If you would like to implement a new feature then consider what kind of change it is: * **Major Changes** that you wish to contribute to the project should be discussed first. Please open a ticket which clearly states that it is a feature request in the title and explain clearly what you want to achieve in the description, and the JHipster team will discuss with you what should be done in that ticket. You can then start working on a Pull Request. * **Small Changes** can be proposed without any discussion. Open up a ticket which clearly states that it is a feature request in the title. Explain your change in the description, and you can propose a Pull Request straight away. ## Submission Guidelines ### [Submitting an Issue](https://opensource.guide/how-to-contribute/#opening-an-issue) Before you submit your issue search the [archive](https://github.com/jhipster/jhipster-core/issues?utf8=%E2%9C%93&q=is%3Aissue), maybe your question was already answered. If your issue appears to be a bug, and has not been reported, open a new issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. Providing the following information will increase the chances of your issue being dealt with quickly: * **The issue** - Explain the bug or feature request, if an error is being thrown a stack trace helps * **Motivation for or Use Case** - Explain why this is a bug for you * **Reproduce the error** - An unambiguous set of steps to reproduce the error. If you have a JavaScript error, maybe you can provide a live example with [JSFiddle](http://jsfiddle.net/)? * **Related issues** - Has a similar issue been reported before? * **Suggest a Fix** - If you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit) * **The XMI file** - Your XMI file, if you can't paste it, mail it. * **Versions** - JHipster version, JHipster core version and the editor Click [here](https://github.com/jhipster/jhipster-core/issues/new) to open a bug issue with a pre-filled template. For feature requests and enquiries you can use [this template][feature-template]. Issues opened without any of these info will be **closed** without any explanation. ### [Submitting a Pull Request](https://opensource.guide/how-to-contribute/#opening-a-pull-request) Before you submit your pull request consider the following guidelines: * Search [GitHub](https://github.com/jhipster/jhipster-core/pulls?utf8=%E2%9C%93&q=is%3Apr) for an open or closed Pull Request that relates to your submission. * In GitHub, send a pull request to `jhipster/jhipster-core:master`. * If we suggest changes then * Make the required updates. * Re-run the JHipster core tests on your sample generated project to ensure tests are still passing. * Rebase your branch and force push to your GitHub repository (this will update your Pull Request): ```shell git rebase master -i git push -f ``` That's it! Thank you for your contribution! #### Resolving merge conflicts ("This branch has conflicts that must be resolved") Sometimes your PR will have merge conflicts with the upstream repository's master branch. There are several ways to solve this but if not done correctly this can end up as a true nightmare. So here is one method that works quite well. * First, fetch the latest information from the master ```shell git fetch upstream ``` * Rebase your branch against the upstream/master ```shell git rebase upstream/master ``` * Git will stop rebasing at the first merge conflict and indicate which file is in conflict. Edit the file, resolve the conflict then ```shell git add git rebase --continue ``` * The rebase will continue up to the next conflict. Repeat the previous step until all files are merged and the rebase ends successfully. * Re-run the JHipster tests on your sample generated project to ensure tests are still passing. * Force push to your GitHub repository (this will update your Pull Request) ```shell git push -f ``` #### After your pull request is merged After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository: * Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: ```shell git push origin --delete my-fix-branch ``` * Check out the master branch: ```shell git checkout master -f ``` * Delete the local branch: ```shell git branch -D my-fix-branch ``` * Update your master with the latest upstream version: ```shell git pull --ff upstream master ``` ## Development Setup First you have to fork the generator-jhipster project and [setup the development environment as detailed](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md#setup). Then fork the jhipster-core project and within it run `npm link` to create a symbolic link between the package folder and the global node modules folder. Afterwards navigate back to the cloned generator-jhipster folder and execute `npm link jhipster-core`. To summarize: 1. Fork and setup the generator-jhipster project [using given instructions](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md#setup). 2. Fork the jhipster-core project and run `npm link` within it. 3. Navigate back to the generator-jhipster project and run `npm link jhipster-core` ## Coding Rules To ensure consistency throughout the source code, keep these rules in mind as you are working: * All features or bug fixes **must be tested** by one or more tests. * All files must follow the [.editorconfig file](http://editorconfig.org/) located at the root of the JHipster generator project. Please note that generated projects use the same `.editorconfig` file, so that both the generator and the generated projects share the same configuration. * Web apps JavaScript files **must follow** [Google's JavaScript Style Guide](https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml). Please ensure to run `yarn lint` and `yarn test` on the project root before submitting a pull request. You can also run `yarn lint-fix` to fix some of the lint issues automatically. ## Git Commit Guidelines We have rules over how our git commit messages must be formatted. Please ensure to [squash](https://help.github.com/articles/about-git-rebase/#commands-available-while-rebasing) unnecessary commits so that your commit history is clean. ### Commit Message Format Each commit message consists of a **header**, a **body** and a **footer**. ```