Skip to content

Commit 5a21b13

Browse files
committed
Add CONTRIBUTING.md file
1 parent 0bd9be9 commit 5a21b13

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

CONTRIBUTING.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Contributing to the Tracel Xtask
2+
3+
Here are some steps to guide you through the process of contributing to this repository:
4+
5+
### Step 1: Review the Issue Tickets
6+
7+
Before you start working on a contribution, please take a moment to look through the open issues in
8+
the [issue tracker](https://github.com/tracel-ai/xtask/issues) for this project. This will give you an
9+
idea of what kind of work is currently being planned or is in progress.
10+
11+
### Step 2: Fork and Clone the Repository
12+
13+
Before you can start making changes, you'll need to fork the repository and clone it to your
14+
local machine. This can be done via the GitHub website or the GitHub Desktop application. Here are
15+
the steps:
16+
17+
1. Click the "Fork" button at the top-right of this page to create a copy of this project in your
18+
GitHub account.
19+
2. Clone the repository to your local machine. You can do this by clicking the "Code" button on the
20+
GitHub website and copying the URL. Then open a terminal on your local machine and type
21+
`git clone [the URL you copied]`.
22+
23+
### Step 3: Create a New Branch
24+
25+
It's a good practice to create a new branch for each contribution you make. This keeps your changes
26+
organized and separated from the main project, which can make the process of reviewing and merging
27+
your changes easier. You can create a new branch by using the command
28+
`git checkout -b [branch-name]`.
29+
30+
### Step 4: Make Your Changes
31+
32+
Once you have set up your local repository and created a new branch, you can start making changes.
33+
Be sure to follow the coding standards and guidelines used in the rest of the project.
34+
35+
### Step 5: Validate code before opening a Pull Request
36+
37+
Before you open a pull request, please run [`./run-checks.sh all`](/run-checks.sh). This
38+
will ensure that your changes are in line with our project's standards and guidelines. You can run
39+
this script by opening a terminal, navigating to your local project directory, and typing
40+
`./run-checks`.
41+
42+
Note that under the hood `run-checks` runs the `cargo xtask validate` command which is powered by
43+
the [tracel-xtask crate](https://github.com/tracel-ai/xtask). It is recommended to get familiar with
44+
it as it provides a wide variety of commands to help you work with the code base.
45+
46+
Format and lint errors can often be fixed automatically using the command `cargo xtask fix all`.
47+
48+
### Step 6: Submit a Pull Request
49+
50+
After you've made your changes and run the pre-pull request script, you're ready to submit a pull
51+
request. This can be done through the GitHub website or the
52+
[GitHub Desktop application](https://desktop.github.com/).
53+
54+
When submitting your pull request, please provide a brief description of the changes you've made and
55+
the issue or issues that your changes address.
56+
57+
## Code Guidelines
58+
59+
We believe in clean and efficient code. While we don't enforce strict coding guidelines, we trust
60+
and use tools like `cargo fmt` and `cargo clippy` to maintain code quality. These are integrated
61+
into our `cargo xtask validate` command, ensuring consistency across our codebase.
62+
63+
### Writing Expect Messages
64+
65+
In Rust, the `expect()` function is a crucial tool for handling errors. However, the power of
66+
`expect()` lies in its ability to convey clear, actionable messages. When you use `expect()`, your
67+
message should describe the successful outcome of the function rather than focusing on the error.
68+
69+
Here's a helpful tip from the [Rust documentation](https://doc.rust-lang.org/std/result/enum.Result.html#recommended-message-style):
70+
71+
_Think of `expect()` messages as guidelines for future you and other developers. Frame them with the word “should” like “The ENV variable should be set by X function” or “The binary should be accessible and executable by the current user.”_
72+
73+
This approach ensures that `expect()` messages are informative and aligned with the intended
74+
function outcomes, making debugging and maintenance more straightforward for everyone.
75+
76+
### Writing integration tests
77+
78+
[Integration tests](https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html) should be in a directory called `tests`
79+
besides the `src` directory of a crate. Per convention, they must be implemented in files whose name start with the `test_` prefix.
80+
81+
---
82+
83+
If you have any questions and would like to get in touch with us, please feel free to join our
84+
discord server and post in the `Infrastructure` Development channel:
85+
[![Discord](https://img.shields.io/discord/1038839012602941528.svg?color=7289da&&logo=discord)](https://discord.gg/uPEBbYYDB6)
86+

0 commit comments

Comments
 (0)