So, you want to learn how to program? Contributing to Operation Code is a great place to get started. This document will help you march from zero to deploying code in no time!
- Quickstart
- Setting Up Your Environment
- Finding an Issue
- Working on Your Issue
- Submitting Your Changes
- Code Standards
- License
-
In order to work on the Operation Code site, you will need to install a few things.
Docker is a container system. Click the link below to install Docker on your Operating System.
Git is a distributed version control system. This is how our code is stored and managed. Git can be frustrating, but it is an essential tool. If you want to learn more about Git, a great resource is Think Like a Git. If you find yourself in a real git pickle, see "Oh, shit, git!".
Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files. It is a standard part of the GNU library and is included in most distrubtions of Linux, as well as OSX. Unfortunately, Windows does not have a native make program, so it will need to be installed and added to PATH in order for the command line commands to work. You can use the GNUWin general installation guide as a general guide on how to install a GNU package and add it to PATH.
You are now ready for the actual Operation Code code base.
-
The common practice is to make a copy of the GitHub repository you want to work on (known as
forking
the repo), make your changes, and then request to merge those changes back into the project (known as apull request
). -
Forking a repo is done through GitHub's web UI. It can be found in the top right corner of the Operation Code's GitHub page.
-
The following commands will pull down the source code from your forked repo.
-
Make sure to replace
[YOUR-GITHUB-NAME]
with your GitHub name. (example: https://github.com/iserbit/operationcode.git)
Fork the repo first.
git clone https://github.com/[YOUR-GITHUB-NAME]/operationcode.git operationcode-upstream cd operationcode-upstream git remote add upstream https://github.com/OperationCode/operationcode.git
To setup the database simply run the following command in the root directory of the project.
make setup
Operation Code has some handy shortcuts built in to make common tasks simple. You can check out the Makefile to see a full listing of what these shortcuts are and what they do.
To run Operation Code simply type:
make
You can now visit http://localhost:3000 (or run
make open
) and you should see Operation Code running locally! -
-
Now you have everything setup, you will need to find issues to work on. Operation Code uses Github's built in issue tracker. A listing of all our issues can be found here.
-
Familiarize yourself with the issue types below, and browse for an issue that you want to work on. Don't be afraid to ask for clarification or help.
-
Once you have found an issue, leave a comment stating that you plan to work on the issue. Once assigned to you, your mission is a go!
- Issue types are managed through labels. The below labels help us easily identify and manage issues with different workflows.
Bugs are errors in code that produce unintended or unexpected results. In addition to the
bug
label, there may also be a tag indicating what the bug affects. For example issue#124 was a bug that affected the testing environment.Features either add new functionality or improve existing functionality.
Discussions will generally not have specific actionable items in them, and can be used to plan and design a feature.
Milestones are used as containers for new issues pertaining to a project, timeframe or feature.
These items are hand picked as being great candidates as your first issue to work on.
-
From the forked and cloned repository on your environment, you can now create a feature branch. It is a good idea to name your branch after the issue it is attached to.
git checkout -b <feature-branch-name>
-
You can check the branch your are currently working on by using the
branch
command.git branch
-
Once you have finished your work, head over to Operation Code's main GitHub page, and make a pull request. More information about pull requests can be found in the next section.
-
To return to your main
master
branch, type the following in the terminal:git checkout master
-
When you have completed work on your feature branch, you are ready to submit a pull request.
-
Each pull request should:
- Be tied to a single issue
- Be fully tested
- Have its own tests
- Not break existing tests
-
Once your pull request has been submitted, it will be reviewed by a core team member. This process helps to familiarize more people with the codebase, and provides a second set of eyes and perspective to your new feature.
-
If your code is accepted, it will be merged into the
master
branch. If all the tests pass, it will be automatically deployed to operationcode.org immediately. -
Congratulations! You have made your first contribution!
-
Each pull request is inspected by the following bots:
-
CodeClimate - Checks for style validation errors, insecure and problematic code on pull requests.
-
Travis - Runs the test suite on each check in, and deploys each change that gets merged.
-
- Once your pull requests has been merged, don't forget to add your name to the list of contributors in CONTRIBUTORS.md.
-
-
- Use tags and elements appropriate for an HTML5 doctype (ex: self-closing tags).
- Use CDNs and HTTPS for third-party JS when possible. We don't use protocol-relative URLs in this case because they break when viewing the page locally via
file://
. - Use WAI-ARIA attributes in documentation examples to promote accessibility.
-
- When feasible, default color palettes should comply with WCAG color contrast guidelines.
- Except in rare cases, don't remove default
:focus
styles (via e.g.outline: none;
) without providing alternative styles. See this A11Y Project post for more details.
-
Adhere to the Google JS Style Guide
- No semicolons (in client-side JS).
- 2 spaces (no tabs).
- Use
strict
mode. - "Attractive"
- By contributing your code, you agree to license your contribution under the MIT License. By contributing to the code base, you agree to license your contribution under the Creative Commons Attribution 3.0 Unported License.