Skip to content

Commit fa3f026

Browse files
committed
Linter framework
Signed-off-by: Luis Pabon <[email protected]>
1 parent 4a12696 commit fa3f026

File tree

145 files changed

+18353
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+18353
-188
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ test/app/bin
44
client
55
venv
66
*.lint
7+
test/app/protos/website/content
8+
test/app/protos/website/web

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ test: build
3434
go test $(PKGS)
3535

3636
testapp:
37-
$(MAKE) -C test/app proto-lint
3837
$(MAKE) -C test/app
3938

4039
testapp-verify: testapp

server/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"time"
2525

2626
grpcclient "github.com/libopenstorage/grpc-framework/pkg/grpc/client"
27-
appapi "github.com/libopenstorage/grpc-framework/test/app/api"
2827
appserver "github.com/libopenstorage/grpc-framework/test/app/pkg/server"
28+
appapi "github.com/libopenstorage/grpc-framework/test/app/protos/apis/hello/apiv1"
2929
"github.com/stretchr/testify/assert"
3030
"golang.org/x/time/rate"
3131
"google.golang.org/grpc"

test/app/Makefile

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,23 @@
22
PROTO_FILE = ./api/hello.proto
33
TAG = dev
44

5-
all: proto server client
5+
all: protos server client
66

77
./bin:
88
mkdir ./bin
99

10+
.PHONY: server
1011
server: ./bin
1112
go build -o ./bin/server cmd/server.go
1213

14+
.PHONY: client
1315
client: ./bin
1416
go build -o ./bin/client cmd/client/client.go
1517

18+
.PHONY: clean
1619
clean:
1720
rm -rf ./bin
1821

19-
proto:
20-
docker run \
21-
--privileged --rm \
22-
-v $(shell pwd):/go/src/code \
23-
-e "GOPATH=/go" \
24-
-e "DOCKER_PROTO=yes" \
25-
-e "PROTO_USER=$(shell id -u)" \
26-
-e "PROTO_GROUP=$(shell id -g)" \
27-
-e "PATH=/bin:/usr/bin:/usr/local/bin:/go/bin:/usr/local/go/bin" \
28-
quay.io/openstorage/grpc-framework:$(TAG)\
29-
make docker-proto
30-
31-
proto-lint:
32-
docker run \
33-
--privileged --rm \
34-
-v $(shell pwd):/go/src/code \
35-
-e "GOPATH=/go" \
36-
-e "DOCKER_PROTO=yes" \
37-
-e "PROTO_USER=$(shell id -u)" \
38-
-e "PROTO_GROUP=$(shell id -g)" \
39-
-e "PATH=/bin:/usr/bin:/usr/local/bin:/go/bin:/usr/local/go/bin" \
40-
quay.io/openstorage/grpc-framework:$(TAG)\
41-
grpcfw-lint \
42-
-o $(PROTO_FILE).lint \
43-
--disable-rule core::0191::proto-package \
44-
--set-exit-status \
45-
$(PROTO_FILE)
46-
47-
docker-proto:
48-
ifndef DOCKER_PROTO
49-
$(error Do not run directly. Run 'make proto' instead.)
50-
endif
51-
grpcfw $(PROTO_FILE)
52-
grpcfw-rest $(PROTO_FILE)
53-
grpcfw-doc $(PROTO_FILE)
54-
22+
.PHONY: protos
23+
protos:
24+
$(MAKE) -C protos

test/app/cmd/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
"github.com/libopenstorage/grpc-framework/pkg/auth"
1616
"github.com/libopenstorage/grpc-framework/pkg/auth/role"
17-
"github.com/libopenstorage/grpc-framework/test/app/api"
17+
api "github.com/libopenstorage/grpc-framework/test/app/protos/apis/hello/apiv1"
1818
"github.com/sirupsen/logrus"
1919
)
2020

test/app/cmd/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"github.com/libopenstorage/grpc-framework/pkg/auth"
2525
"github.com/libopenstorage/grpc-framework/pkg/util"
2626
"github.com/libopenstorage/grpc-framework/server"
27-
"github.com/libopenstorage/grpc-framework/test/app/api"
2827
helloserver "github.com/libopenstorage/grpc-framework/test/app/pkg/server"
28+
api "github.com/libopenstorage/grpc-framework/test/app/protos/apis/hello/apiv1"
2929

3030
"github.com/sirupsen/logrus"
3131
"google.golang.org/grpc"

test/app/pkg/server/hello.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"context"
2020
"fmt"
2121

22-
"github.com/libopenstorage/grpc-framework/test/app/api"
22+
api "github.com/libopenstorage/grpc-framework/test/app/protos/apis/hello/apiv1"
2323
"github.com/sirupsen/logrus"
2424
)
2525

test/app/protos/Makefile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
export TOP=$(shell pwd)
2+
3+
ifndef L
4+
L=go
5+
endif
6+
7+
ifndef LINT_OUTPUT
8+
LINT_OUTPUT=false
9+
endif
10+
DOCKERCMD=docker run \
11+
--privileged --rm \
12+
-v $(shell pwd):/go/src/code \
13+
-e "LINT_OUTPUT=$(LINT_OUTPUT)" \
14+
-e "GOPATH=/go" \
15+
-e "L=$(L)" \
16+
-e "DOCKER_PROTO=yes" \
17+
-e "PROTO_USER=$(shell id -u)" \
18+
-e "PROTO_GROUP=$(shell id -g)" \
19+
-e "PATH=/bin:/usr/bin:/usr/local/bin:/go/bin:/usr/local/go/bin" \
20+
$(GRPC_FRAMEWORK_CONTAINER)
21+
22+
SUBDIRS=apis
23+
24+
all: build docs
25+
26+
python:
27+
$(DOCKERCMD) make -C sdk/python setup
28+
$(MAKE) L=python build
29+
$(DOCKERCMD) make -C sdk/python sdk
30+
31+
.PHONY: publish
32+
publish: build docs python
33+
$(DOCKERCMD) make -C publish
34+
35+
docker-shell:
36+
docker run \
37+
-ti \
38+
--privileged --rm \
39+
-v $(shell pwd):/go/src/code \
40+
-e "LINT_OUTPUT=$(LINT_OUTPUT)" \
41+
-e "GOPATH=/go" \
42+
-e "L=$(L)" \
43+
-e "DOCKER_PROTO=yes" \
44+
-e "PROTO_USER=$(shell id -u)" \
45+
-e "PROTO_GROUP=$(shell id -g)" \
46+
-e "PATH=/bin:/usr/bin:/usr/local/bin:/go/bin:/usr/local/go/bin" \
47+
$(GRPC_FRAMEWORK_CONTAINER) /bin/bash
48+
49+
ifndef DOCKER_PROTO
50+
build:
51+
$(DOCKERCMD) make build
52+
else
53+
.PHONY: build
54+
build: lint $(SUBDIRS)
55+
endif
56+
57+
.PHONY: lint
58+
lint:
59+
@SCRIPTSDIR=$(TOP)/lint/repo-scripts $(TOP)/lint/run.sh
60+
61+
include $(TOP)/make/common.mk
62+
63+
.PHONY: docs
64+
ifndef DOCKER_PROTO
65+
docs:
66+
$(DOCKERCMD) make docs
67+
else
68+
docs:
69+
$(MAKE) -C website
70+
endif
71+
72+
.PHONY: serve
73+
serve:
74+
cd docs ; python3 -m http.server
75+
76+
.PHONY: clean
77+
clean:
78+
$(MAKE) -C website clean

test/app/protos/apis/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SUBDIRS= hello \
2+
example
3+
4+
all: $(SUBDIRS)
5+
6+
include $(TOP)/make/common.mk
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SUBDIRS= apiv1
2+
3+
all: $(SUBDIRS)
4+
5+
include $(TOP)/make/common.mk

0 commit comments

Comments
 (0)