-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NETOBSERV-1498 Add shellcheck linter for bash and make help target #5
Conversation
$(OCI_BIN) build -t network-observability-cli . | ||
|
||
.PHONY: lint | ||
lint: prereqs ## Lint code | ||
@echo "### Linting code" | ||
golangci-lint run ./... | ||
@echo "### Run shellcheck against bash scripts" | ||
find . -name '*.sh' | xargs shellcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to install shellcheck
automatically in the prereqs
target ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this a pkg u need to install on ur host and it depends on the os
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the article above suggest:
docker pull koalaman/shellcheck:latest
docker run -v "$PWD:/mnt" koalaman/shellcheck "$1"
The advantage of this is that shellcheck
will not be a requirement for devs / CI
Else we need to add that in the README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated readme its not worth spinning up docker atm for single pkg dependency
.PHONY: help | ||
help: ## Display this help. | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
#!/usr/bin/env bash | ||
set -eux | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok since this repo has bash dependency I thought having lint for bash will be add good value
Signed-off-by: Mohamed Mahmoud <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to merge @msherif1234 😸
/approve |
Add shellcheck bash scripts linter and fix linter error
Add make help target