Skip to content

Commit

Permalink
feat(make): add ability to format code (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfalkowski authored Apr 19, 2024
1 parent d5f116d commit eb464f7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
4 changes: 4 additions & 0 deletions build/make/buf.mak
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ NAME:=$(shell basename $(shell dirname $(CURDIR)))
lint:
buf lint

# Fix the lint issues in the proto code (if possible).
fix-lint:
buf format -w

# Format buf.
format:
buf format -w
Expand Down
4 changes: 4 additions & 0 deletions build/make/go.mak
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ lint:
fix-lint:
golangci-lint run --timeout 5m --fix

# Format code.
format:
go fmt ./...

# Run specs.
specs:
gotestsum --junitfile test/reports/specs.xml -- -vet=off -race -mod vendor -failfast -covermode=atomic -coverpkg=./... -coverprofile=test/reports/profile.cov ./...
Expand Down
4 changes: 4 additions & 0 deletions build/make/ruby.mak
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ lint:
fix-lint:
bundle exec rubocop -A

# Format code.
format:
bundle exec rubocop -A

path:
bundle config set path vendor/bundle

Expand Down
29 changes: 22 additions & 7 deletions build/make/service.mak
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,31 @@ docker-lint:
proto-lint:
make -C api lint

# Fix the lint issues in the proto code (if possible).
proto-fix-lint:
make -C api fix-lint

# Lint all the code.
lint: go-lint ruby-lint proto-lint

# Fix the lint issues in the code (if possible).
fix-lint: go-fix-lint ruby-fix-lint proto-fix-lint

# Format go code.
go-format:
go fmt ./...

# Format ruby code.
ruby-format:
make -C test format

# Format proto.
proto-format:
make -C api format

# Format all code.
format: go-format ruby-format proto-format

# List outdated go deps.
go-outdated-dep:
go list -mod=mod -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}} {{.Update.Version}}{{end}}' -m all
Expand All @@ -49,10 +71,6 @@ ruby-outdated-dep:
# List outdated deps.
outdated-dep: go-outdated-dep ruby-outdated-dep

# Format proto.
proto-format:
make -C api format

# Detect breaking changes in api.
proto-breaking:
make -C api breaking
Expand All @@ -61,9 +79,6 @@ proto-breaking:
proto-generate:
make -C api generate

# Fix the lint issues in the code (if possible).
fix-lint: go-fix-lint ruby-fix-lint proto-format

sanitize-coverage:
bin/quality/go/cov

Expand Down

0 comments on commit eb464f7

Please sign in to comment.