If you'd like to contribute to Regal, here are some pointers to help get you started.
- Run the
build.sh
script to populate thedata
directory with any data necessary for linting (such as the built-in function metadata from OPA) - Build the
regal
executable by runninggo build
To run all tests, including the Rego rules unit tests:
go test ./...
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
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 .
The table in the Rules section of the README is generated with the following command:
go run main.go table --write-to-readme bundle