Skip to content

Commit

Permalink
chore: sync main
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed Nov 18, 2022
2 parents e288b1c + eb4afa7 commit e26b29c
Show file tree
Hide file tree
Showing 48 changed files with 421 additions and 446 deletions.
3 changes: 3 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ ignore:
- "x/**/test_common.go"
- "scripts/"
- "contrib"
- "**/*.pb.gw.go"
- "**/*.pulsar.go"
- "tests/mocks/*.go"
22 changes: 8 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ jobs:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
path: ./${{ matrix.part }}profile.out

upload-coverage-report:
repo-analysis:
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand Down Expand Up @@ -154,22 +156,14 @@ jobs:
- run: |
cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt
if: env.GIT_DIFF
- name: filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
excludelist+=" $(find ./ -type f -name '*.pb.go')"
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/cosmos-sdk/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: env.GIT_DIFF
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
if: env.GIT_DIFF

test-rosetta:
runs-on: ubuntu-latest
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ benchmark:
###############################################################################

golangci_lint_cmd=golangci-lint
golangci_version=v1.50.0
golangci_version=v1.50.1

lint:
@echo "--> Running linter"
Expand All @@ -353,9 +353,7 @@ lint-fix:
.PHONY: lint lint-fix

format:
@go install mvdan.cc/gofumpt@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l
$(golangci_lint_cmd) run --fix
.PHONY: format

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
<a href="https://goreportcard.com/report/github.com/cosmos/cosmos-sdk">
<img alt="Go report card" src="https://goreportcard.com/badge/github.com/cosmos/cosmos-sdk" />
</a>
<a href="https://codecov.io/gh/cosmos/cosmos-sdk">
<img alt="Code Coverage" src="https://codecov.io/gh/cosmos/cosmos-sdk/branch/main/graph/badge.svg" />
<a href="https://sonarcloud.io/summary/overall?id=cosmos_cosmos-sdk">
<img alt="Code Coverage" src="https://sonarcloud.io/api/project_badges/measure?project=cosmos_cosmos-sdk&metric=coverage" />
</a>
<a href="https://sonarcloud.io/summary/overall?id=cosmos_cosmos-sdk">
<img alt="SonarCloud Analysis" src="https://sonarcloud.io/api/project_badges/measure?project=cosmos_cosmos-sdk&metric=alert_status">
</a>
</div>
<div align="center">
Expand Down
10 changes: 5 additions & 5 deletions orm/internal/codegen/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type queryProtoGen struct {
func (g queryProtoGen) gen() error {
g.imports[g.Desc.Path()] = true

g.svc.F("// %s queries the state of the tables specified by %s.", g.queryServiceName(), g.Desc.Path())
g.svc.F("service %s {", g.queryServiceName())
g.svc.F("// %sService queries the state of the tables specified by %s.", g.queryServiceName(), g.Desc.Path())
g.svc.F("service %sService {", g.queryServiceName())
g.svc.Indent()
for _, msg := range g.Messages {
tableDesc := proto.GetExtension(msg.Desc.Options(), ormv1.E_Table).(*ormv1.TableDescriptor)
Expand Down Expand Up @@ -84,7 +84,7 @@ func (g queryProtoGen) gen() error {
func (g queryProtoGen) genTableRPCMethods(msg *protogen.Message, desc *ormv1.TableDescriptor) error {
name := msg.Desc.Name()
g.svc.F("// Get queries the %s table by its primary key.", name)
g.svc.F("rpc Get%s (Get%sRequest) returns (Get%sResponse) {}", name, name, name) // TODO grpc gateway
g.svc.F("rpc Get%s(Get%sRequest) returns (Get%sResponse) {}", name, name, name) // TODO grpc gateway

g.startRequestType("Get%sRequest", name)
g.msgs.Indent()
Expand Down Expand Up @@ -118,7 +118,7 @@ func (g queryProtoGen) genTableRPCMethods(msg *protogen.Message, desc *ormv1.Tab
fieldsCamel := fieldsToCamelCase(idx.Fields)
methodName := fmt.Sprintf("Get%sBy%s", name, fieldsCamel)
g.svc.F("// %s queries the %s table by its %s index", methodName, name, fieldsCamel)
g.svc.F("rpc %s (%sRequest) returns (%sResponse) {}", methodName, methodName, methodName) // TODO grpc gateway
g.svc.F("rpc %s(%sRequest) returns (%sResponse) {}", methodName, methodName, methodName) // TODO grpc gateway

g.startRequestType("%sRequest", methodName)
g.msgs.Indent()
Expand All @@ -144,7 +144,7 @@ func (g queryProtoGen) genTableRPCMethods(msg *protogen.Message, desc *ormv1.Tab

g.imports["cosmos/base/query/v1beta1/pagination.proto"] = true
g.svc.F("// List%s queries the %s table using prefix and range queries against defined indexes.", name, name)
g.svc.F("rpc List%s (List%sRequest) returns (List%sResponse) {}", name, name, name) // TODO grpc gateway
g.svc.F("rpc List%s(List%sRequest) returns (List%sResponse) {}", name, name, name) // TODO grpc gateway
g.startRequestType("List%sRequest", name)
g.msgs.Indent()
g.msgs.F("// IndexKey specifies the value of an index key to use in prefix and range queries.")
Expand Down
1 change: 0 additions & 1 deletion orm/internal/testpb/bank.cosmos_orm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion orm/internal/testpb/bank.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 41 additions & 37 deletions orm/internal/testpb/bank_query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions orm/internal/testpb/bank_query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package testpb;
import "cosmos/base/query/v1beta1/pagination.proto";
import "testpb/bank.proto";

// BankQuery queries the state of the tables specified by testpb/bank.proto.
service BankQuery {
// BankQueryService queries the state of the tables specified by testpb/bank.proto.
service BankQueryService {
// Get queries the Balance table by its primary key.
rpc GetBalance(GetBalanceRequest) returns (GetBalanceResponse) {}
// ListBalance queries the Balance table using prefix and range queries against defined indexes.
Expand Down
Loading

0 comments on commit e26b29c

Please sign in to comment.