chore: Add .editorconfig, shfmt, shellcheck and subshell dir changes (#1649)

This commit is contained in:
Mathias Fredriksson
2022-05-27 20:15:19 +03:00
committed by GitHub
parent 1a70298b5c
commit 608eb322a8
11 changed files with 191 additions and 103 deletions
+20 -3
View File
@@ -41,20 +41,37 @@ fmt/terraform: $(wildcard *.tf)
terraform fmt -recursive
.PHONY: fmt/terraform
fmt: fmt/prettier fmt/terraform
fmt/shfmt: $(shell shfmt -f .)
@echo "--- shfmt"
# Only do diff check in CI, errors on diff.
ifdef CI
shfmt -d $(shell shfmt -f .)
else
shfmt -w $(shell shfmt -f .)
endif
fmt: fmt/prettier fmt/terraform fmt/shfmt
.PHONY: fmt
gen: coderd/database/querier.go peerbroker/proto/peerbroker.pb.go provisionersdk/proto/provisioner.pb.go provisionerd/proto/provisionerd.pb.go site/src/api/typesGenerated.ts
install: build
mkdir -p $(INSTALL_DIR)
@echo "--- Copying from bin to $(INSTALL_DIR)"
cp -r ./dist/coder-$(GOOS)_$(GOOS)_$(GOARCH)*/* $(INSTALL_DIR)
@echo "-- CLI available at $(shell ls $(INSTALL_DIR)/coder*)"
.PHONY: install
lint:
lint: lint/shellcheck lint/go
lint/go:
golangci-lint run
.PHONY: lint
.PHONY: lint/go
# Use shfmt to determine the shell files, takes editorconfig into consideration.
lint/shellcheck: $(shell shfmt -f .)
@echo "--- shellcheck"
shellcheck $(shell shfmt -f .)
peerbroker/proto/peerbroker.pb.go: peerbroker/proto/peerbroker.proto
protoc \