2018-07-27 10:18:29 -04:00
# Contributing to VinylDNS
2021-12-06 16:51:53 -05:00
2018-07-27 10:18:29 -04:00
The following are a set of guidelines for contributing to VinylDNS and its associated repositories.
## Table of Contents
2021-12-06 16:51:53 -05:00
2018-08-24 10:59:04 -04:00
* [Code of Conduct ](#code-of-conduct )
* [Issues ](#issues )
* [Working on an Issue ](#working-on-an-issue )
* [Submitting an Issue ](#submitting-an-issue )
* [Discussion Process ](#discussion-process )
* [Pull Requests ](#pull-requests )
* [General Flow ](#general-flow )
* [Pull Request Requirements ](#pull-request-requirements )
* [Commit Messages ](#commit-messages )
* [Testing ](#testing )
* [Documentation Edits ](#documentation-edits )
* [Style Guides ](#style-guides )
* [License Header Checks ](#license-header-checks )
* [Contributor License Agreement ](#contributor-license-agreement )
* [Modifying your Pull Request ](#modifying-your-pull-requests )
* [Pull Request Approval ](#pull-request-approval )
2021-12-06 16:51:53 -05:00
2018-07-27 10:18:29 -04:00
## Code of Conduct
2021-12-06 16:51:53 -05:00
2021-12-14 17:16:30 -05:00
This project and everyone participating in it are governed by the [VinylDNS Code Of Conduct ](https://github.com/vinyldns/vinyldns/blob/master/CODE_OF_CONDUCT.md ). By
participating, you agree to this Code.
2018-07-27 10:18:29 -04:00
## Issues
2018-08-24 10:59:04 -04:00
2021-12-06 16:51:53 -05:00
Work on VinylDNS is tracked by [GitHub Issues ](https://guides.github.com/features/issues/ ). To contribute to VinylDNS,
2018-08-24 10:59:04 -04:00
you can join the discussion on an issue, submit a Pull Request to resolve the issue, or make an issue of your own.
2019-11-04 10:07:57 -05:00
VinylDNS issues are generally labeled as bug reports, feature requests, or maintenance requests.
2018-08-24 10:59:04 -04:00
### Working on an Issue
2018-07-27 10:18:29 -04:00
2021-12-06 16:51:53 -05:00
If you would like to contribute to VinylDNS, you can look through `good first issue` and `help wanted` issues. We keep a
list of these issues around to encourage participation in building the platform. In the issue list, you can chose "
Labels" and choose a specific label to narrow down the issues to review.
- **Beginner issues**: only require a few lines of code to complete, rather isolated to one or two files. A good way to
get through changing and testing your code, and meet everyone!
- **Help wanted issues**: these are more involved than beginner issues, are items that tend to come near the top of our
backlog but not necessarily in the current development stream.
2018-08-24 10:59:04 -04:00
2021-12-06 16:51:53 -05:00
Besides those issues, you can sort the issue list by number of comments to find one that may be of interest. You do
2018-08-24 10:59:04 -04:00
_not_ have to limit yourself to _only_ `good first issue` or `help wanted` issues.
2021-12-06 16:51:53 -05:00
When resolving an issue, you generally will do so by making a [Pull Request ](#pull-requests ), and adding a link to the
issue.
2018-08-24 10:59:04 -04:00
2021-12-06 16:51:53 -05:00
Before choosing an issue, see if anyone is assigned or has indicated they are working on it (either in comment or via
Pull Request). If that is the case, then instead of making a Pull Request of your own, you can help out by reviewing
their Pull Request.
2018-08-24 10:59:04 -04:00
### Submitting an Issue
2021-12-06 16:51:53 -05:00
2018-08-24 10:59:04 -04:00
When submitting an issue you will notice there are three issue templates to choose from. Before making any issue, please
2021-12-06 16:51:53 -05:00
go search the issue list (open and closed issues) and check to see if a similar issue has been made. If so, we ask that
you do not duplicate an issue, but feel free to comment on the existing issue with additional details.
- **Bug report**: If you find a bug in the project you can report it with this template and the VinylDNS team will take
a look at it. Please be as detailed as possible as it will help us recreate the bug and figure out what exactly is
going on. If you are unsure whether what you found is a bug, we encourage you to first pop in
our [discussion board ](https://github.com/vinyldns/vinyldns/discussions ), and we can help determine if what you're
seeing is unexpected behavior, and if it is we will direct to make the bug report.
- **Feature request**: Use this template if you have something you wish to be added to the project. Please be detailed
when describing why you are requesting the feature, what you want it to do, and alternative solutions you have
considered.
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
### Discussion Process
2018-07-27 10:18:29 -04:00
2021-12-06 16:51:53 -05:00
Some issues may require discussion with the community before proceeding to implementation. This can happen if the issue
is a larger change, for example a big refactoring or new feature. The VinylDNS maintainers may label an issue for **
Discussion** in order to solicit more detail before proceeding. If the issue is straightforward and/or well documented,
it can be implemented immediately by the submitter. If the submitter is unable to make the changes required to address
the issue, the VinylDNS maintainers will prioritize the work in our backlog.
2018-08-24 10:59:04 -04:00
## Pull Requests
2021-12-06 16:51:53 -05:00
Contributions to VinylDNS are generally made
via [Github Pull Requests ](https://help.github.com/articles/about-pull-requests/ ). Most Pull Requests are related to
an [issue ](#issues ), and will have a link to the issue in the Pull Request.
2018-08-24 10:59:04 -04:00
### General Flow
2021-12-06 16:51:53 -05:00
We follow the standard *GitHub Flow* for taking code contributions. The following is the process typically followed:
2018-07-27 10:18:29 -04:00
2018-07-27 10:46:55 -04:00
1. Create a fork of the repository that you want to contribute code to
1. Clone your forked repository to your local machine
2019-11-04 10:07:57 -05:00
1. In your local machine, add a remote to the "main" repository, we call this "upstream" by running
2021-12-06 16:51:53 -05:00
`git remote add upstream https://github.com/vinyldns/vinyldns.git` . Note: you can also use `ssh` instead of `https`
1. Create a local branch for your work `git checkout -b your-user-name/user-branch-name` . Add whatever your GitHub user
name is before whatever you want your branch to be.
2018-07-27 10:46:55 -04:00
1. Begin working on your local branch
2021-12-06 16:51:53 -05:00
1. Be sure to add necessary unit, integration, and functional tests, see
the [Testing ](https://github.com/vinyldns/vinyldns/blob/master/DEVELOPER_GUIDE.md#testing )
section of the Developer Guide.
1. Make sure you run all builds before posting a Pull Request! It's faster to run everything locally rather than waiting
for the build server to complete its job.
See [DEVELOPER_GUIDE.md ](https://github.com/vinyldns/vinyldns/blob/master/DEVELOPER_GUIDE.md ) for information on
local development.
1. When you are ready to contribute your code, run `git push origin your-user-name/user-branch-name` to push your
changes to your _own fork_
1. Go to the [VinylDNS main repository ](https://github.com/vinyldns/vinyldns.git ) (or whatever repo you are contributing
to)
and you will see your change waiting and a link to "Create a Pull Request". Click the link to create a Pull Request.
1. Be as detailed as possible in the description of your Pull Request. Describe what you changed, why you changed it,
and give a detailed list of changes and impacted files. If your Pull Request is related to an existing issue, be sure
to link the issue in the Pull Request itself, in addition to the Pull Request description.
1. You will receive comments on your Pull Request. Use the Pull Request as a dialog on your changes.
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
### Pull Request Requirements
#### Commit Messages
2021-12-06 16:51:53 -05:00
2018-07-27 10:18:29 -04:00
* Limit the first line to 72 characters or fewer.
* Use the present tense ("Add validation" not "Added validation").
* Use the imperative mood ("Move database call" not "Moves database call").
2021-12-06 16:51:53 -05:00
* Reference issues and other pull requests liberally after the first line.
Use [GitHub Auto Linking ](https://help.github.com/articles/autolinked-references-and-urls/ )
to link your Pull Request to other issues.
2018-07-27 10:18:29 -04:00
* Use markdown syntax as much as you want
2018-08-24 10:59:04 -04:00
#### Testing
2021-12-06 16:51:53 -05:00
When making changes to the VinylDNS codebase, be sure to add necessary unit, integration, and functional tests. For
specifics on our tests, see the [Testing ](https://github.com/vinyldns/vinyldns/blob/master/DEVELOPER_GUIDE.md#testing )
section of the Developer Guide.
2018-07-27 16:02:37 -04:00
2018-08-24 10:59:04 -04:00
#### Documentation Edits
2021-12-06 16:51:53 -05:00
Documentation for the VinylDNS project lives in files such as this one in the root of the project directory, as well as
in `modules/docs/src/main/mdoc` for the docs you see on [vinyldns.io ](https://vinyldns.io ). Many changes, such as those
that impact an API endpoint, config, portal usage, etc, will also need corresponding documentation edited to prevent it
from going stale. The
VinylDNS [gh-pages branch README ](https://github.com/vinyldns/vinyldns/tree/gh-pages#vinyldns-documentation-site ) has
information on how to run and edit the documentation page.
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
#### Style Guides
2021-12-06 16:51:53 -05:00
2021-12-15 12:24:29 -05:00
* For Scala code we use [Scalastyle ](http://www.scalastyle.org/ ). The configs are `scalastyle-config.xml` and
2021-12-06 16:51:53 -05:00
`scalastyle-test-config.xml` for source code and test code respectively
* We have it set to fail builds if the styling rules are not followed. For example, one of our rules is that all
lines must be < = 120 characters, and a build will fail if that is violated.
* For our python code that we use for functional testing, we generally try to
follow [PEP 8 ](https://www.python.org/dev/peps/pep-0008/ )
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
#### License Header Checks
2021-12-06 16:51:53 -05:00
VinylDNS is configured with [sbt-header ](https://github.com/sbt/sbt-header ). All existing scala files have the
appropriate header. To add or check for headers, follow these steps:
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
##### API
2021-12-06 16:51:53 -05:00
2018-08-24 10:59:04 -04:00
You can check for headers in the API in `sbt` with:
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
```
> ;project api;headerCheck;test:headerCheck;it:headerCheck
```
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
If you add a new file, you can add the appropriate header in `sbt` with:
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
```
> ;project api;headerCreate;test:headerCreate;it:headerCreate
```
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
##### Portal
2021-12-06 16:51:53 -05:00
2018-08-24 10:59:04 -04:00
You can check for headers in the Portal in `sbt` with:
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
```
> ;project portal;headerCheck;test:headerCheck;checkJsHeaders
```
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
If you add a new file, you can add the appropriate header in `sbt` with:
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
```
> ;project portal;headerCreate;test:headerCreate;createJsHeaders
```
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
#### Contributor License Agreement
2021-12-06 16:51:53 -05:00
2019-11-04 10:07:57 -05:00
Before Comcast merges your code into the project you must sign the
2018-08-24 10:59:04 -04:00
[Comcast Contributor License Agreement (CLA) ](https://gist.github.com/ComcastOSS/a7b8933dd8e368535378cda25c92d19a ).
2018-07-27 10:18:29 -04:00
2019-11-04 10:07:57 -05:00
If you haven't previously signed a Comcast CLA, you'll automatically be asked to when you open a pull request.
2021-12-06 16:51:53 -05:00
Alternatively, we can send you a PDF that you can sign and scan back to us. Please create a new GitHub issue to request
a PDF version of the CLA.
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
### Modifying your Pull Requests
2018-07-27 10:18:29 -04:00
2021-12-06 16:51:53 -05:00
Often times, you will need to make revisions to your Pull Requests that you submit. This is part of the standard process
of code review. There are different ways that you can make revisions, but the following process is pretty standard.
1. Sync with upstream
first. `git checkout master && git fetch upstream && git rebase upstream master && git push origin master`
2018-08-24 10:59:04 -04:00
1. Checkout your branch on your local `git checkout your-user-name/user-branch-name`
2021-12-06 16:51:53 -05:00
1. Sync your branch with latest `git rebase master` . Note: If you have merge conflicts, you will have to resolve them
2018-08-24 10:59:04 -04:00
1. Revise your Pull Request, making changes recommended in the comments / code review
1. Stage and commit these changes on top of your existing commits
2021-12-06 16:51:53 -05:00
1. When all tests pass, `git push origin your-user-name/user-branch-name` to revise your commit. _Note: If you rebased
or altered the commit history, you will have to force push with a `-f` flag._ GitHub automatically recognizes the
update and will re-run verification on your Pull Request!
2018-07-27 10:18:29 -04:00
2018-08-24 10:59:04 -04:00
### Pull Request Approval
2021-12-06 16:51:53 -05:00
2018-08-24 10:59:04 -04:00
A pull request must satisfy our [pull request requirements ](#pull-request-requirements )
2018-07-27 10:18:29 -04:00
2021-12-06 16:51:53 -05:00
Afterwards, if a Pull Request is approved, a maintainer of the project will merge it. If you are a maintainer, you can
merge your Pull Request once you have the approval of at least 2 other maintainers.
2018-07-27 10:18:29 -04:00
2021-12-15 12:24:29 -05:00
> Note: The first time you make a Pull Request, add yourself to the authors list [here](https://github.com/vinyldns/vinyldns/blob/master/AUTHORS.md) as part of the Pull Request