Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.37 KB

development.md

File metadata and controls

55 lines (39 loc) · 1.37 KB

Development

If you'd like to contribute to Regal, here are some pointers to help get you started.

Building

  1. Run the build.sh script to populate the data directory with any data necessary for linting (such as the built-in function metadata from OPA)
  2. Build the regal executable by running go build

Testing

To run all tests, including the Rego rules unit tests:

go test ./...

E2E tests

End-to-End (E2E) tests assert the behaviour of the regal binary called with certain configs, and test files. They expect a regal binary either in the top-level directory, or pointed at by $REGAL_BIN, and can be run locally via

go test -tags e2e ./e2e

Linting

Regal uses golangci-lint with most linters enabled. In order to check your code, run:

golangci-lint run ./...

In order to please the gci linter, you may either manually order imports, or have them automatically ordered and grouped by the tool:

gci write \
  -s standard \
  -s default \
  -s "prefix(github.com/open-policy-agent/opa)" \
  -s "prefix(github.com/styrainc/regal)" \
  -s blank \
  -s dot .

Documentation

The table in the Rules section of the README is generated with the following command:

go run main.go table --write-to-readme bundle