good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 5f3fa5c7 authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Add shfmt and shellcheck

parent e7e4b516
No related branches found
No related tags found
No related merge requests found
...@@ -2,12 +2,6 @@ all: fmt lint test ...@@ -2,12 +2,6 @@ all: fmt lint test
.SILENT: .SILENT:
.PHONY: *
.ONESHELL:
SHELL = bash
.SHELLFLAGS = -ceuo pipefail
include ci/fmt.mk include ci/fmt.mk
include ci/lint.mk include ci/lint.mk
include ci/test.mk include ci/test.mk
#!/usr/bin/env bash
set -euo pipefail
main() {
local files
mapfile -t files < <(git ls-files --other --modified --exclude-standard)
if [[ ${files[*]} == "" ]]; then
return
fi
echo "Files need generation or are formatted incorrectly:"
for f in "${files[@]}"; do
echo " $f"
done
echo
echo "Please run the following locally:"
echo " make fmt"
exit 1
}
main "$@"
fmt: modtidy gofmt goimports prettier fmt: modtidy gofmt goimports prettier shfmt
ifdef CI ifdef CI
if [[ $$(git ls-files --other --modified --exclude-standard) != "" ]]; then ./ci/ensure_fmt.sh
echo "Files need generation or are formatted incorrectly:"
git -c color.ui=always status | grep --color=no '\e\[31m'
echo "Please run the following locally:"
echo " make fmt"
exit 1
fi
endif endif
modtidy: gen modtidy: gen
...@@ -23,3 +17,6 @@ prettier: ...@@ -23,3 +17,6 @@ prettier:
gen: gen:
stringer -type=opcode,MessageType,StatusCode -output=stringer.go stringer -type=opcode,MessageType,StatusCode -output=stringer.go
shfmt:
shfmt -i 2 -w -s -sr $$(git ls-files "*.sh")
FROM golang:1 FROM golang:1
RUN apt-get update RUN apt-get update
RUN apt-get install -y chromium npm RUN apt-get install -y chromium npm shellcheck
ARG SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64
RUN curl -L $SHFMT_URL > /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt
ENV GOFLAGS="-mod=readonly" ENV GOFLAGS="-mod=readonly"
ENV PAGER=cat
ENV CI=true ENV CI=true
ENV MAKEFLAGS="--jobs=16 --output-sync=target" ENV MAKEFLAGS="--jobs=16 --output-sync=target"
......
lint: govet golint lint: govet golint govet-wasm golint-wasm shellcheck
govet: govet:
go vet ./... go vet ./...
...@@ -11,3 +11,6 @@ golint: ...@@ -11,3 +11,6 @@ golint:
golint-wasm: golint-wasm:
GOOS=js GOARCH=wasm golint -set_exit_status ./... GOOS=js GOARCH=wasm golint -set_exit_status ./...
shellcheck:
shellcheck $$(git ls-files "*.sh")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment