Skip to content
Closed
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
28 changes: 28 additions & 0 deletions .onelint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 1

profiles:
testx: off

modules:
- cmd/protoc-gen-nexus-rpc-yaml
- cmd/protoc-gen-resource-id-lint
- cmd/protoc-gen-system-nexus-wit

format:
# Existing .proto files use 4-space indentation; turn on once formatted.
buf-format: off
gci: off
gofmt: off
gofumpt: off

lint:
actionlint: on
api-linter:
command: api-linter
files:
- "temporal/**/*.proto"
check: ["--set-exit-status", "-I=.", "--config=api-linter.yaml"]
buf-lint: on
gofix: off
golangci-lint: off
gomodtidy: on
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(VERBOSE).SILENT:
ci-build: install proto http-api-docs

# Install dependencies.
install: grpc-install api-linter-install buf-install
install: grpc-install api-linter-install buf-install onelint-install

# Run all linters and compile proto files.
proto: grpc http-api-docs nexus-rpc-yaml system-nexus-wit
Expand Down Expand Up @@ -36,6 +36,7 @@ OAPI_OUT := openapi
OAPI3_PATH := .components.schemas.Payload

NEX_GEN ?= nexgen
ONELINT ?= onelint

$(PROTO_OUT):
mkdir $(PROTO_OUT)
Expand Down Expand Up @@ -99,15 +100,24 @@ buf-install:
printf $(COLOR) "Install/update buf..."
go install github.com/bufbuild/buf/cmd/buf@v1.49.0

onelint-install:
printf $(COLOR) "Install/update onelint and actionlint..."
go install github.com/temporalio/onelint@v0.11.0
go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.7

##### Sync external proto dependencies #####
sync-nexus-annotations:
printf $(COLOR) "Sync nexusannotations from buf.build/temporalio/nexus-annotations..."
buf export buf.build/temporalio/nexus-annotations --output .

##### Linters #####
lint: $(STAMPDIR)/buf-dep-prune
printf $(COLOR) "Run linters..."
@$(ONELINT) check

api-linter:
printf $(COLOR) "Run api-linter..."
@api-linter --set-exit-status $(PROTO_IMPORTS) --config $(PROTO_ROOT)/api-linter.yaml --output-format json $(PROTO_FILES) | gojq -r 'map(select(.problems != []) | . as $$file | .problems[] | {rule: .rule_doc_uri, location: "\($$file.file_path):\(.location.start_position.line_number)"}) | group_by(.rule) | .[] | .[0].rule + ":\n" + (map("\t" + .location) | join("\n"))'
@$(ONELINT) check --only=api-linter

# Every RPC needs a temporal-resource-id request_header annotation for routing, or an entry in
# cmd/protoc-gen-resource-id-lint/exemptions.go.
Expand All @@ -131,7 +141,7 @@ $(STAMPDIR)/buf-dep-prune: $(STAMPDIR) buf.yaml

buf-lint: $(STAMPDIR)/buf-dep-prune
printf $(COLOR) "Run buf linter..."
(cd $(PROTO_ROOT) && buf lint)
@$(ONELINT) check --only=buf-lint

buf-breaking:
@printf $(COLOR) "Run buf breaking changes check against main branch..."
Expand Down
Loading