Skip to content
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

Merged
merged 1 commit into from
Jun 28, 2019

Conversation

justaugustus
Copy link
Member

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

@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. area/release-eng Issues or PRs related to the Release Engineering subproject labels Jun 28, 2019
@k8s-ci-robot k8s-ci-robot requested a review from pswica June 28, 2019 08:08
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 28, 2019
@justaugustus
Copy link
Member Author

Specific review comment for reference: #740 (comment)

\( -path ./third_party\* -a -not -path ./third_party/forked\* \) \
\))
done < <(grep -irl '#!.*sh' . \
--exclude-dir={/_\*,/.git\*,/vendor\*,/third_party\*,/third_party/forked\*})
Copy link
Member

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:

Suggested change
--exclude-dir={/_\*,/.git\*,/vendor\*,/third_party\*,/third_party/forked\*})
--exclude-dir={/_\*,./.git\*,./vendor\*,./third_party\*,./third_party/forked\*})

@justaugustus justaugustus force-pushed the shellcheck branch 2 times, most recently from 68fbcec to a49f109 Compare June 28, 2019 08:22
\( -path ./third_party\* -a -not -path ./third_party/forked\* \) \
\))
done < <(grep -irl '#!.*sh' . \
--exclude-dir={/_\*,./.git\*,./vendor\*})
Copy link
Member

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

Copy link
Member

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 :^)

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Member Author

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\*}

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2019
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
thanks!

@justaugustus
Copy link
Member Author

@BenTheElder -- no, no, thank you! A @kubernetes/bash-firefighters superhero :)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2019
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]>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2019
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2019
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@justaugustus
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2019
@justaugustus justaugustus changed the title Update shellcheck script to search all files with bash shebangs Update shellcheck script to search all files with *sh shebangs Jun 28, 2019
@k8s-ci-robot k8s-ci-robot merged commit 92a6cd2 into kubernetes:master Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants