Skip to content

Contributing Code

andyarensman edited this page Jul 24, 2023 · 3 revisions

Claiming an Issue

Before modifying any code, an issue should exist for the task in the GitHub repo. You should make sure that no one else is assigned to the issue and then assign it to yourself, so we avoid stepping on each others' toes. If there is not an issue for the work you want to do, you should talk to the lead developer and/or project manager to get an issue created and prioritized on the kanban board and then have them create the issue from there for you to work on.

Modifying Code and Submitting a Pull Request

We use the "Git Flow" workflow to manage source code. See Vincent Driessen's seminal article for an overview, though a few of the detailed procedures below have additional steps. We have modified a few steps here, so your changes are merged into develop on GitHub (rather than locally). This allows others to easily view your changes, and is a smaller departure from the previous workflow to learn.

  1. After cloning the repository, create a feature branch with a name containing your name and a feature name, separated by dashes, for example.
git checkout -b 379-hours-validation

Note that your feature branch is based on the develop branch, which is where feature changes will be integrated for eventual release to production.

  1. Claim an issue (see instructions down below) and start coding.

  2. Regularly add, commit, and push your code to your branch.

git add -A
git commit -m "Implement client-side validation of business hours"

We have implemented git commit hooks that automatically run static code analysis scripts on your code before completing the commit. Pay close attention when you commit, and see if you get any errors indicating that eslint found errors and the commit did not complete. If this happens, refer to Static Code Analysis for instructions.

git push origin HEAD
  1. When an issue is completed and ready for a pull request, first add and commit your latest changes as in Step 3 above, then make sure your code has the latest code from the develop branch by switching to the develop branch, then pulling. This is to ensure merge conflicts are in your local environment, which is easier to clean up than in GitHub:
git checkout develop
git pull origin develop
  1. Now it's time to rebase. Rebasing ensures that there is only one commit for your issue, which keeps the develop branch clean. First switch to the your branch and start the rebasing in the terminal:
git checkout [your_branch]
git rebase -i develop

Here you will squash all your commits into the first one. Type i for insert mode and replace every pick (except the first one) with s for squash. Press esc then type :x to continue.

If you have any conflicts, you will have to resolve them now, then type git rebase --continue to continue. If you have no conflicts, it will continue automatically.

On the next screen in the terminal, you can remove the first two commented lines. Go to each line you want to delete and type dd to delete. After you delete the first two lines, you should be left with the first commit message at the top. Press esc then type :x to continue.

  1. At this point you should be done with rebasing. Run the application (client and server) to be sure that the application builds correctly before proceeding. Then force push your changes to your feature branch on the github repo:
git push origin HEAD --force
  1. Go to the GitHub repository for Food Oasis. There are three options:
  • Click on "Compare & pull request" button underneath the "commits branches releases environment contributors" box.
  • Click on the "New Pull Request" button underneath the "commits branches releases environment contributors" box and underneath "Your recently pushed branches" section.
  • Click on the "Pull Request" tab and press "New Pull Request"
  1. In "Comparing Changes", switch the "compare" (right button) to your branch name. Make sure the "base" (left button) is on the develop branch. Double check the changes you've made down below, and click "Create pull request". Make sure the description of your changes is reflected in the Pull Request, e.g. "Start to incorporate Storybook and LADOT theme (colors, logos and headers)".

You will also want to add - Closes #[your_issue_number]. This will automatically move your card on the board to the Quality Assurance column.

  1. Click on "Create Pull Request" and wait for someone to review to merge your changes!

  2. Once your PR has been reviewed, approved and merged to the develop branch, it will automatically be published to https://devla.foodoasis.net. Please be sure to run the application here and make sure your changes are reflected in this deployed version of the develop branch. Deployment may take several minutes. You can check the Actions Tab of the GitHub repo to confirm successful deployment.

If your issue included any design changes, add a comment to your card with screenshots for the designers to review.

Clone this wiki locally