First, thank you for your interest in contributing to this project! Before you pick up your first issue and start changing code, please:
- Review all documentation for the module you're interested in.
- Look through the issues for this repo for relevant discussions.
- If you have questions about an issue, post a comment in the issue.
- If you want to submit changes that aren't covered by an issue, file a new one with your proposal, outlining what problem you found/feature you want to implement, and how you intend to implement a solution.
For best results, before submitting a PR, make sure:
- It has met all acceptance criteria for the issue.
- It addresses only the one issue and does not make other, irrelevant changes.
- Your code conforms to our coding style guide.
- You have adequate test coverage (this should be indicated by CI results anyway).
- If you like, check out current PRs to see how others do it.
Special Note: If editing README.md, please conform to the standard readme specification.
Before a PR can be merged to master
, it must:
- Pass continuous integration.
- Be approved by at least two maintainers
- All new code should be accompanied by unit tests. Prefer focused unit tests to integration tests for thorough validation of behaviour. Existing code is not necessarily a good model, here.
- Integration tests should test integration, not comprehensive functionality
- Tests should be placed in a separate package named
$PACKAGE_test
. For example, a test of thechain
package should live in a package namedchain_test
. In limited situations, exceptions may be made for some "white box" tests placed in the same package as the code it tests.
We use the following import ordering.
import (
[stdlib packages, alpha-sorted]
<single, empty line>
[external packages]
<single, empty line>
[go-address packages]
)
Where a package name does not match its directory name, an explicit alias is expected (goimports
will add this for you).
Example:
package address_test
import (
"bytes"
"encoding/base32"
"fmt"
"math"
"math/rand"
"strconv"
"testing"
"time"
"github.com/multiformats/go-varint"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-crypto"
"github.com/filecoin-project/go-address"
)
Comments are a communication to other developers (including your future self) to help them understand and maintain code. Good comments describe the intent of the code, without repeating the procedures directly.
- A
TODO:
comment describes a change that is desired but could not be immediately implemented. It must include a reference to a GitHub issue outlining whatever prevents the thing being done now (which could just be a matter of priority). - A
NOTE:
comment indicates an aside, some background info, or ideas for future improvement, rather than the intent of the current code. It's often fine to document such ideas alongside the code rather than an issue (at the loss of a space for discussion). FIXME
,HACK
,XXX
and similar tags indicating that some code is to be avoided in favour ofTODO
,NOTE
or some straight prose.