scorecard/CONTRIBUTING.md

88 lines
2.9 KiB
Markdown
Raw Normal View History

# Contributing to Security Scorecards
2020-10-09 17:47:59 +03:00
Thank you for contributing your time and expertise to the Security Scorecards project.
2020-10-09 17:47:59 +03:00
This document describes the contribution guidelines for the project.
**Note:** Before you start contributing, you must read and abide by our **[Code of Conduct](./CODE_OF_CONDUCT.md)**.
2020-10-09 17:47:59 +03:00
## Contributing code
### Getting started
1. Create [a GitHub account](https://github.com/join)
1. Create a [personal access token](https://docs.github.com/en/free-pro-team@latest/developers/apps/about-apps#personal-access-tokens)
1. Set up your [development environment](#environment-setup)
2020-10-09 17:47:59 +03:00
### Environment Setup
2020-10-09 17:47:59 +03:00
You must install these tools:
1. [`git`](https://help.github.com/articles/set-up-git/): For source control
2020-10-09 17:47:59 +03:00
1. [`go`](https://golang.org/doc/install): You need go version [v1.15](https://golang.org/dl/) or higher.
2020-10-09 17:47:59 +03:00
1. [`docker`](https://docs.docker.com/engine/install/): `v18.9` or higher.
2020-10-09 17:47:59 +03:00
## Contributing steps
2020-10-09 17:47:59 +03:00
1. Submit an issue describing your proposed change to the repo in question.
1. The repo owners will respond to your issue promptly.
1. Fork the desired repo, develop and test your code changes.
1. Submit a pull request.
2020-10-09 17:47:59 +03:00
## How to build scorecard locally
2020-10-09 17:47:59 +03:00
Note that, by building the scorecard from the source code we are allowed to test the changes made locally.
2020-10-09 17:47:59 +03:00
1. Run the following command to clone your fork of the project locally
2020-10-09 17:47:59 +03:00
```shell
git clone git@github.com:<user>/scorecard.git $GOPATH/src/github.com/<user>/scorecard.git
2020-10-09 17:47:59 +03:00
```
1. Ensure you activate module support before continue (`$ export GO111MODULE=on`)
1. Run the command `make build` to build the source code
## What to do before submitting a pull request
Following the targets that can be used to test your changes locally.
| Command | Description | Is called in the CI? |
| ---------- | --------------------------------------------------- | -------------------- |
| make all | Runs go test,golangci lint checks, fmt, go mod tidy | yes |
| make build | Runs go build | yes |
| make e2e | Runs e2e tests | yes |
## Permission for GitHub personal access tokens
The personal access token need the following scopes:
- `repo:status` - Access commit status
- `repo_deployment` - Access deployment status
- `public_repo` - Access public repositories
## Where the CI Tests are configured
1. See the [action files](.github/workflows) to check its tests, and the scripts used on it.
2020-10-09 17:47:59 +03:00
## Adding New Checks
Each check is currently just a function of type `CheckFn`.
The signature is:
```golang
2020-10-13 19:29:29 +03:00
type CheckFn func(c.Checker) CheckResult
2020-10-09 17:47:59 +03:00
```
Checks are registered in an init function:
```golang
AllChecks = append(AllChecks, NamedCheck{
Name: "Code-Review",
Fn: DoesCodeReview,
})
```
Currently only one set of checks can be run.
In the future, we'll allow declaring multiple suites and configuring which checks get run.