-
Notifications
You must be signed in to change notification settings - Fork 502
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
Update shellcheck script to search all files with *sh shebangs #754
Conversation
Specific review comment for reference: #740 (comment) |
hack/verify-shellcheck.sh
Outdated
\( -path ./third_party\* -a -not -path ./third_party/forked\* \) \ | ||
\)) | ||
done < <(grep -irl '#!.*sh' . \ | ||
--exclude-dir={/_\*,/.git\*,/vendor\*,/third_party\*,/third_party/forked\*}) |
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.
on my macbook I needed to change this to:
--exclude-dir={/_\*,/.git\*,/vendor\*,/third_party\*,/third_party/forked\*}) | |
--exclude-dir={/_\*,./.git\*,./vendor\*,./third_party\*,./third_party/forked\*}) |
68fbcec
to
a49f109
Compare
hack/verify-shellcheck.sh
Outdated
\( -path ./third_party\* -a -not -path ./third_party/forked\* \) \ | ||
\)) | ||
done < <(grep -irl '#!.*sh' . \ | ||
--exclude-dir={/_\*,./.git\*,./vendor\*}) |
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.
confirmed this works with both BSD (macOS) and gnu grep
otherwise: (without the .
)
grep: ./vendor/k8s.io/test-infra/prow/tide/README.md: No such file or directory
grep: ./vendor/k8s.io/test-infra/prow/crier/README.md: No such file or directory
grep: ./vendor/k8s.io/test-infra/prow/plank/README.md: No such file or directory
grep: ./vendor/k8s.io/test-infra/gubernator/github/secrets.py: No such file or directory
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.
ultimate nit / suggestion: this does fit on a single line, the \
and second line are a little superfluous now :^)
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.
oh also should there be another .
in front of/_\*,
?
/hold
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.
Oops, not quite:
$ grep -irl '#!.*sh' . --exclude-dir={./_\*,./.git\*,./vendor\*}
./changelog-update
./push-build.sh
./hack/verify-shellcheck.sh
./.git/hooks/pre-receive.sample
./.git/hooks/pre-rebase.sample
./.git/hooks/pre-push.sample
./.git/hooks/update.sample
./.git/hooks/pre-commit.sample
./.git/hooks/commit-msg.sample
./.git/hooks/pre-applypatch.sample
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/post-update.sample
./rpm/entry.sh
./rpm/docker-build.sh
./script-template
./relnotes
./build/_test2/2
./gcbmgr
./_test/1
./debian/jenkins.sh
./debian/bionic/kubeadm/debian/postinst
./debian/bionic/kubectl/debian/postinst
./debian/bionic/kubelet/debian/postinst
./compile-release-tools
./branchff
./release-notify
./anago
./find_green_build
./lib/releaselib_test.sh
./lib/releaselib.sh
./lib/common.sh
./lib/gitlib_test.sh
./lib/gitlib.sh
./prin
I'm poking at it.
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.
You can see here, that it's checking the .git
dir as well: https://prow.k8s.io/view/gcs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_kind/670/pull-kind-verify/1144523142685790208
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.
yeah, I think this version is suitable for kind: grep -irl '#!.*sh' . --exclude-dir={bin\*,.git\*,vendor\*}
, for here grep -irl '#!.*sh' . --exclude-dir={_\*,.git\*,vendor\*}
maybe?
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.
Looks like we've got a winner: grep -irl '#!.*sh' . --exclude-dir={_\*,.git\*,vendor\*}
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
thanks!
@BenTheElder -- no, no, thank you! A @kubernetes/bash-firefighters superhero :) |
Several of the shell scripts in this repo do not have `.sh` extensions, which means we will miss shellcheck-ing them with a `find` that considers only the file name. Signed-off-by: Stephen Augustus <[email protected]> Co-Authored-By: Benjamin Elder <[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
and here's a green run of ~ the same thing for kind https://prow.k8s.io/view/gcs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_kind/670/pull-kind-verify/1144528174026067968
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, justaugustus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
Okay, one more round with this shellcheck script 😄
Several of the shell scripts in this repo do not have
.sh
extensions, which means we will miss shellcheck-ing them with a
find
that considers only the file name.Signed-off-by: Stephen Augustus [email protected]
/cc @pswica
/assign @spiffxp @BenTheElder
/sig release
/area release-eng
ref: #726, #740, #742, #753