...
Code changes that maintain the existing code’s design and style of the existing code
Code changes that do not decrease test coverage or maintainability
Commit messages and Pull Requests that are in a consistent format
Pull Requests that are easy and fast to review : to avoid the review bottleneckbottlenecks
After a developer is assigned a Jira task, they begin work.
...
Expand | ||
---|---|---|
| ||
Ideally the description in the Jira task is written in a way that it can be copied and pasted as the description of the Pull Request. This is very subjective, but the description should:
|
Unless you’re the person most familiar with the area of the codebase that you are changing, first discuss the changes with that person
Expand | ||
---|---|---|
| ||
This is extremely important because you don’t want to spend time on a Pull Request only to find out that it has to be completely redone because of its core design. Also, there will always be improvements underway in the CHEFS code, and any new work must align with those improvements - so following the existing design/code might not be the best approach. The end goal of these improvements is code that is:
Information that everyone should be familiar with: |
...
Crank out some code and tests (or tests and code, for TDD bonus points) and whatever documentation that needs to be created or updated
Periodically commit your work with messages like:
Code Block feat: FORMS-1234 new map component for dropping a pin Added a new map component that allows the user to drop a "pin" on the map, and the location is saved as botheither Lat/Lon or UTM coordinates.
Expand | ||
---|---|---|
| ||
It’s only a recommendation that “working” commit messages use this format - these commit messages will eventually be squashed, and it’s only the final commit message that must be in this format. It’s a good idea to always use this format to be familiar with how the final commit message must look.
|
Run the unit tests using
Terminal
→Run Task...
→Unit Tests
and check the test coverage of your new code
...
Expand | ||
---|---|---|
| ||
We use the format
Please make the description meaningful:
If your changes won’t fit in the a short description, it’s possible that your Pull Request is probably doing changing too many things. |
Enter the GitHub “description” for your Pull Request using the template provided. The template contains comments to help make the process easier
Before clicking the create button, read through all the file diffs
Expand | ||
---|---|---|
| ||
This is a chance to do a self-review of your changes before creating the PR
|
...
Expand | ||
---|---|---|
| ||
The “Tests” GitHub Action runs:
Note that the test coverage is not uploaded to Code Climate, as Actions run from Pull Requests do not have access to the GitHub Secrets needed to authenticate with Code Climate. |
...
Expand | ||
---|---|---|
| ||
There are various ways to tell this:
|
...
Expand | ||
---|---|---|
| ||
Ideally every developer would review and understand every change in every Pull Request, but that’s not practical. Code reviews have many purposes:
There are two ways of looking at Pull Requests:
We can use the Ship / Show / Ask approach to Pull Requests:
|
...
Expand | ||
---|---|---|
| ||
This step really depends on the reviewer. Some people notice right away that they have been asked to do a review, but many do notthat isn’t guaranteed. It doesn’t hurt to post in the team channel on Discord that something is ready for review and “mention” the reviewers. If your change is complex or if your team members are less familiar with that part of the code, it might not hurt be good to set up a meeting and to explain the changes |
In Jira move the task to
PULL REQUEST (PR)
Keep your branch up to date with
main
and re-run the “PR Deploy” Action
Expand | ||
---|---|---|
| ||
It depends! It’s good to always be up to date because the testing and review is more meaningful if the base branch is up to date. However, it can also waste a lot of time if one person is putting in multiple small changes and everyone is you’re trying to keep upupdate for every merge. Find a balance between having a current base and spending time keeping it current. You can use the GitHub web site to update your branch, but note that this leaves the branch in your local environment out of sync. This might be OK if the update is for completely different parts of the code, but if there are conflicts then its it's better to update locally and push to your branch. |
Expand | ||
---|---|---|
| ||
If you or others are testing the deployed code, but the code is not up to date with main, then bugs could sneak through. When you look at your PR Pull Request there will be comments in the timeline for commits, and comments from the |
Wait for approval (if needed) and merge your changes with the properly formatted commit message like:
Code Block |
---|
feat: FORMS-1234 new map component for dropping a pin Added a new map component that allows the user to drop a "pin" on the map, and the location is saved as botheither Lat/Lon or UTM coordinates. |
Expand | ||
---|---|---|
| ||
This format must be followed as we eventually want to introduce automated changelogs and versioning. |
...
Expand | ||
---|---|---|
| ||
The
Once you have merged your changes, ensure that they are deployed through all environments. Do not leave a deployment “hanging” and deployed to only the lower environments, as the next merge will probably cause it to go all the way to prod. If the change is tested and approved, it should go to prod as soon as possible. |
Run the
PR Undeploy
Action with your Pull Request number
Expand | ||
---|---|---|
| ||
Maybe? Merge can only be done by people with write access to the repo, so in theory on merge we would have access to the GitHub secrets and could undeploy automatically if we can figure out the PR number. If this doesn’t work then the “dumb” way of doing it would be to figure out with PRs are deployed and then see if they are open or not. |
Check Code Climate
Expand | ||
---|---|---|
| ||
We use Code Climate to monitor maintainability and code coverage. However, it will probably be replaced by SonarCloud in the near future. But it doesn’t hurt to check that your changes didn’t decrease our maintainability or code coverage. |
...