Skip to content

Add linting to CircleCI & to the Makefile. #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ jobs:
- store_test_results:
path: /tmp/test-results

lint:
docker:
- image: circleci/golang:1.13-node

steps:
- checkout
- restore_cache:
keys:
- go-mod-{{ checksum "go.sum" }}
- run:
name: Install golint
command: go get golang.org/x/lint/golint
- run:
name: Lint & check
command: make check

acceptance:
docker:
- image: circleci/golang:1.13-node
Expand Down Expand Up @@ -110,6 +126,7 @@ workflows:
build:
jobs:
- test
- lint
- acceptance
- buildimage
- release_docker:
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ conftest:
test: conftest
$(BUILD) --target test .

check: check-fmt check-vet check-lint

check-fmt:
test -z $$(gofmt -l .) || echo $$(gofmt -l .)

check-vet:
go vet ./...

check-lint:
golint -set_exit_status ./...

push: examples conftest
$(PUSH) $(IMAGE):$(TAG)
$(PUSH) $(IMAGE):latest
Expand Down
2 changes: 2 additions & 0 deletions internal/runner/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/open-policy-agent/conftest/policy"
)

// TestRunner is the runner for the Test command, executing
// Rego policy checks against configuration files.
type TestRunner struct {
Trace bool
Policy []string
Expand Down
2 changes: 2 additions & 0 deletions internal/runner/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"github.com/open-policy-agent/opa/topdown"
)

// VerifyRunner is the runner for the Verify command, executing
// Rego policy unit-tests.
type VerifyRunner struct {
Policy []string
Data []string
Expand Down
2 changes: 1 addition & 1 deletion policy/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func Load(ctx context.Context, policyPaths []string) (*Engine, error) {
return &engine, nil
}

// Load returns an Engine after loading all of the specified policies and data paths.
// LoadWithData returns an Engine after loading all of the specified policies and data paths.
func LoadWithData(ctx context.Context, policyPaths []string, dataPaths []string) (*Engine, error) {
engine, err := Load(ctx, policyPaths)
if err != nil {
Expand Down