Contributing Code

Contributing code to Taskforge, like all contributions, is highly appreciated. This document will help you set up your development environment and follow our coding best practices.

Getting the Code

Before you begin development on Taskforge you will need to download the repository. To do this open your shell of choice and run the following command:

$ git clone https://github.com/chasinglogic/taskforge

Now use GitHub to fork the project to create your own remote which you will work from. When viewing the repo above in your browser, click the fork button in the top right hand corner.

GitHub provides this article which gives a good explanation of what forking means and how to work with a fork.

Once you’ve created your fork copy the clone URL and run the command:

$ git remote add fork $YOUR_CLONE_URL

Replacing $YOUR_CLONE_URL with the URL you just copied from GitHub.

Setting Up A Development Environment

You’ll need to install rustc, cargo, and clippy to work on Taskforge effectively. You can install rustc and cargo via rustup. The instructions for doing so are available [at rustup.rs](https://rustup.rs/). The one liner you need from that website has been duplicated here:

Note

Windows users should instead download rustup-init.exe (for 64-bit computers) and run that executable. Then just follow the on screen instructions.

$ curl https://sh.rustup.rs -sSf | sh

Once that is complete you can add clippy (the linter we use) via the following console command:

$ rustup component add clippy-preview

Requirements for Submitting Code

All code needs to meet these requirements:

  • If new code:
    • Write a design document and complete the Design Document Process
    • For each goal in the design write a test
    • Write the code to make the tests pass in CI
  • If fixing a bug:
    • Write a test which reproduces the bug
    • Write the code fixing that test, it must pass in CI
  • All code must pass lint using a clean build with cargo clippy.

You can run the linting steps locally with these commands. Although, it’s worth noting most text editors will integrate with these tools automatically:

$ cargo clean $ cargo clippy

For testing you can run the following from the package that you want to test or from the root of the repo to test all packages:

$ cargo test

Any tests which call external services or databases must have the macro attribute #[ignore] indicating it as slow. To run those tests, pass the --ignored flag to the test executable as follows:

$ cargo test -- --ignored