Change:
What happened: After / we had 283 known failing files being excluded from shellcheck lints. What you expected to happen: We should be linting all files. When files are listed in we may miss actual bugs in them. Initially to get the linter in place we had to list many files there to keep the PR reasonably sized, but ideally we can fix these over time and eliminate this file. How to reproduce it (as minimally and precisely as possible): Anything else we need to know?: I intend to continue working on this, EG , , ... /sig testing /assign [x] ./build/build- (Done in: ) [x] (Done in: ) [x] ./build/copy- (Done in: ) [x] [x] ./build/make-build- (Done in: ) [x] ./build/make- (Done in: ) [x] ./build/package- (Done in: ) [x] ./build/release- (Done in: ) [x] ./build/release-in-a- (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] ./cluster/addons/addon-manager/kube- [x] ./cluster/addons/fluentd-elasticsearch/es- [x] ./cluster/addons/fluentd-elasticsearch/fluentd-es- [x] (Done in: ) [x] ./cluster/centos/config- (Done in: ) [x] ./cluster/centos/config- (Done in: ) [x] ./cluster/centos/config- (Done in: ) [x] (Done in: ) [x] ./cluster/centos/make-ca- (Done in: ) [x] (Done in: ) [x] ./cluster/centos/node/bin/mk-docker- (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] [x] [x] ./cluster/gce/config- [x] ./cluster/gce/config- [x] ./cluster/gce/config- [x] ./cluster/gce/delete-stranded-load- (Done in: ) [x] ./cluster/gce/gci/configure- [x] [x] [x] ./cluster/gce/gci/health- [x] ./cluster/gce/gci/master- [x] ./cluster/gce/gci/mounter/stage- [x] ./cluster/gce/gci/node- [x] [x] ./cluster/gce/list- [x] ./cluster/gce/upgrade- [x] [x] [x] ./cluster/get-kube- (Done in: ) [x] ./cluster/get-kube- (Done in: ) [x] ./cluster/get- (Done in: ) [x] [x] ./cluster/images/etcd-empty-dir-cleanup/etcd-empty-dir- (Done in: ) [x] ./cluster/juju/prereqs/ubuntu- [x] [x] ./cluster/kube- (Done in: ) [x] ./cluster/kube- (Addressed in: ) [x] ./cluster/kube- (Addressed in: ) [x] (Done in: ) [x] (Addressed in: ) [x] ./cluster/kubemark/gce/config- [x] ./cluster/kubemark/iks/config- [x] [x] [x] ./cluster/log-dump/log- () [x] ./cluster/pre- [x] ./cluster/restore-from- [x] ./cluster/test- [x] ./cluster/test- [x] ./cluster/test- [x] ./cluster/update-storage- [x] ./cluster/validate- [x] ./hack/benchmark- (Done in: ) [x] ./hack/build- (Done in: ) [x] ./hack/build- (Done in: ) [x] ./hack/build- (Done in: ) [x] [x] ./hack/dev-build-and- (Done in: ) [x] ./hack/dev-build-and- (Done in: ) [x] ./hack/dev-push- (Done in: ) [x] ./hack/dev-push- (Done in: ) [x] ./hack/e2e-internal/e2e-cluster- (Done in: ) [x] ./hack/e2e-internal/e2e- (Done in: ) [x] ./hack/e2e-internal/e2e-grow- (Done in: ) [x] ./hack/e2e-internal/e2e-shrink- (Done in: ) [x] ./hack/e2e-internal/e2e- (Done in: ) [x] ./hack/e2e-internal/e2e- (Done in: ) [x] ./hack/e2e-node- (Done in: ) [x] ./hack/generate- [x] ./hack/generate- [x] ./hack/get- (Done in: ) [x] ./hack/ginkgo- [x] ./hack/godep- [x] ./hack/godep- [x] ./hack/grab- [x] ./hack/install- [x] ./hack/jenkins/benchmark- [x] [x] ./hack/jenkins/test- [x] ./hack/jenkins/upload-to- [x] ./hack/jenkins/verify- [x] [x] [x] [x] [x] [x] [x] [x] [x] [x] ./hack/list-feature- [x] ./hack/local-up- [x] ./hack/make- (Addressed in: ) [x] ./hack/make- [x] ./hack/make- (Addressed in: ) [x] ./hack/make- [x] ./hack/make-rules/make- (Addressed in: ) [x] ./hack/make-rules/test- (Addressed in: ) [x] ./hack/make-rules/test-e2e- [x] ./hack/make-rules/test- (Addressed in: ) [x] ./hack/make-rules/test-kubeadm- (Addressed in: ) [x] ./hack/make- [x] ./hack/make- [x] ./hack/make- [x] ./hack/make- [x] ./hack/print-workspace- (Done in: ) [x] ./hack/run-in- (Done in: ) [x] ./hack/test- (Done in: ) [x] ./hack/test- [x] ./hack/test-update-storage- [x] ./hack/update- (Done in: ) [x] ./hack/update-api-reference- (Done in: ) [x] ./hack/update- [x] ./hack/update- [x] ./hack/update-generated-device-plugin- (Done in: ) [x] ./hack/update-generated-device- (Done in: ) [x] ./hack/update-generated- (Done in: ) [x] ./hack/update-generated-kms- [x] ./hack/update-generated- (Done in: ) [x] ./hack/update-generated-kubelet-plugin-registration- (Done in: ) [x] ./hack/update-generated-kubelet-plugin- (Done in: ) [x] ./hack/update-generated-pod-resources- (Done in: ) [x] ./hack/update-generated-pod- (Done in: ) [x] ./hack/update-generated-protobuf- [x] ./hack/update-generated- (Done in: ) [x] ./hack/update-generated-runtime- [x] ./hack/update-generated- [x] ./hack/update-generated-swagger- [x] ./hack/update-godep- [x] ./hack/update- [x] ./hack/update-openapi- [x] ./hack/update-staging-godeps- [x] ./hack/update-staging- [x] ./hack/update-swagger- (Done in: ) [x] ./hack/update- [x] ./hack/update-workspace- [x] ./hack/verify- (Done in: ) [x] ./hack/verify-api- [x] ./hack/verify-api-reference- (Done in: ) [x] ./hack/verify- (Done in: ) [x] ./hack/verify- [x] ./hack/verify-cli- [x] ./hack/verify- [x] ./hack/verify- [x] ./hack/verify-generated-device- [x] ./hack/verify-generated- [x] ./hack/verify-generated-files- [x] ./hack/verify-generated- [x] ./hack/verify-generated- [x] ./hack/verify-generated-kubelet-plugin- [x] ./hack/verify-generated-pod- [x] ./hack/verify-generated- [x] ./hack/verify-generated- [x] ./hack/verify-generated-swagger- [x] ./hack/verify-godep- (Done in: ) [x] ./hack/verify- (Done in: ) [x] ./hack/verify- (Done in: ) [x] ./hack/verify- [x] ./hack/verify- [x] ./hack/verify-import- [x] ./hack/verify- (Done in: ) [x] ./hack/verify- [x] ./hack/verify-no-vendor- [x] ./hack/verify-openapi- [x] ./hack/verify-pkg- [x] ./hack/verify-readonly- [x] ./hack/verify- [x] ./hack/verify-staging- [x] ./hack/verify-staging-meta- [x] ./hack/verify-swagger- (Done in: ) [x] ./hack/verify- [x] ./hack/verify-test- [x] ./hack/verify-test- [x] ./hack/verify-test- [x] ./hack/verify- [x] [x] ./pkg/util/verify-util- [x] [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] [x] [x] [x] [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] [x] [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] (Done in: ) [x] [x] [x] (Addressed in: ) [x] [x] (Addressed in: ) [x] [x] [x] [x] [x] [x] [x] ./test/cmd/generic- [x] [x] [x] ./test/cmd/legacy- [x] ./test/cmd/node- (Addressed in: ) [x] ./test/cmd/old- (Addressed in: ) [x] (Addressed in: ) [x] (Addressed in: ) [x] ./test/cmd/request- (Addressed in: ) [x] (Addressed in: ) [x] ./test/cmd/save- [x] (Addressed in: ) [x] ./test/cmd/template- (Addressed in: ) [x] (Addressed in: ) [x] [x] [x] [x] ./test/e2enode/jenkins/conformance/conformance- [x] ./test/e2enode/jenkins/copy-e2e- [x] ./test/e2enode/jenkins/e2e-node- [x] ./test/e2enode/jenkins/ubuntu-14.04-nvidia- [x] ./test/images/image- [x] ./test/images/pets/redis-installer/on- [x] ./test/images/pets/zookeeper- [x] ./test/images/pets/zookeeper-installer/on- [x] [x] [x] [x] [x] [x] [x] [x] ./test/integration/ipamperf/test- (Done in: ) [x] ./test/integration/schedulerperf/test- (Done in: ) [x] [x] ./test/kubemark/configure- (Done in: ) [x] [x] [x] [x] [x] ./test/kubemark/master-log- [x] ./test/kubemark/pre- (Done in: ) [x] ./test/kubemark/resources/start-kubemark- [x] ./test/kubemark/run-e2e- [x] ./test/kubemark/start- [x] ./test/kubemark/stop- [x] [x] [x] ./thirdparty/multiarch/qemu-user-static/register/qemu-binfmt- [x] ./third_party/multiarch/qemu-user-
I am tackling this optimistically for 1.14, but I could see it slipping to 1.15 depending on time-to-review, bandwidth, etc..
/priority important-longterm
/milestone v1.14
would it be ok if I helped out with this? I was thinking I could go through and cover the scripts in to start with
That would be great! there's a lot to tackle here :sweatsmile: If you could reference this issue (just include a link somewhere, please don't mark it as "fixes #" :upsidedown_face:) that would be helpful for attempting to avoid overlap :-) I'll continue to do the same as I get to more of these.
Can I help with
Go for it! We might even want multiple PRs for that one - If I remember correctly, there was plenty to fix in that one
I will fix ./hack/dev-build-and- ./hack/dev-build-and- ./hack/dev-push- ./hack/dev-push-
I'll work on the scripts in
I will fix ./cluster/addons/addon-manager/kube- ./cluster/addons/fluentd-elasticsearch/es- ./cluster/addons/fluentd-elasticsearch/fluentd-es-
I will fix
/help [we have various people contributing, but there's so many of these to tackle!]
This request has been marked as needing help from a contributor. Please ensure the request meets the requirements listed . If this request no longer meets these requirements, the label can be removed by commenting with the command. <detailsIn response to : /help [we have various people contributing, but there's so many of these to tackle!] Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
I will fix: ./hack/print-workspace- ./hack/run-in- ./hack/test- ./hack/test-
i have fix /hack/test- and /hack/test- in
i will fix
I've reverted my changes from those 2 files.
I will fix and
I'd like to fix files under .
I'm fixing at
I'd like to fix files under . FYI: have been included in
The kubemark scripts should be fixed in
I'll work towards fixing everything under next.
Fix in
Woops, somehow overlooked that was tackling .
I've updated the tracking list in the original post with every merged PR up to (the most recent currently) AFAICT. 45 / 283 merged currently :sweat_smile:
I will tackle next.
should be fixed in
fix cluster/addons/fluentd-elasticsearch/fl……uentd-es- at
in
in
in
I'll do next.
in
in
in
Releasing a diff () with fixes for the following :) Thanks for leading efforts to tackle this :)
/reopen unintentionally
Reopened this issue. <detailsIn response to : /reopen unintentionally Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
For those working on the the shellcheck issues, please do not put " in your PR. This is an umbrella issue for tracking that shouldn't be closed until all the shellcheck issues are resolved.
I'm sorry , I'll take care of it
There may be many files that have been repaired or are under approval. Could you please update the files to be repaired in issue? This will be more convenient! thanks
The following scripts fixed by
I tried to update some of the entries but it's relatively manual stuff to verify, and I had to wave off eventually for other work
I had previously called , but I haven't had much time to work on this. There are a lot there, so don't let me block anyone from taking those on
Putting out a diff () for the following rn:
The following scripts fixed by
Thanks and thanks all! I updated the checklist in the original post again. 89/284 down (we gained one new file since we started)
I addressed all of in a PR this morning :) Can be found here:
Fixed by hack/generate- hack/generate- hack/install- hack/update-
I put out a diff this morning to address the following in hack:
Fixed by
If you are looking to take on fixing an item on the list, please remember to go up half-way through this issue and expand the hidden items. There are a lot of comments and PRs of items that people are actively working on that will not show up when searching unless it is expanded. <img width="866" alt="screen shot 2019-02-23 at 10 45 35 am" src="https://user-"
A bit of advice for those working on this: make it easy on your reviewers. Explain why you're changing what you're changing. "Fixing shellcheck failures" is not enough context. Some details that could help your reviewer: what shellcheck failure are you fixing? why are you doing it this way? why is this more maintainable than what was there before? if you need to ignore a shellcheck failure, why? is there some other way of doing things that would accomplish the same goals and not trigger shellcheck?
should be resolved in
Hello! Code freeze for 1.14 is coming up in 2 days. Will the work in this issue be implemented in the next week?
Fixed by
/milestone v1.15 just moving it for tracking purposes as it's too big - work can continue normally
thanks for moving this, +1 for 1.15, we might actually finish by then :sweat_smile:
/reopen
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
please don't use , use .
I list script files which lint failures are not fixed in PRs. Please refer to this. (fix a part of failure in ) ./cluster/gce/config- ./cluster/gce/config- ./cluster/gce/config- ./cluster/gce/gci/configure- ./cluster/gce/gci/health- ./cluster/gce/gci/master- ./cluster/gce/list- ./cluster/gce/upgrade- ./cluster/restore-from- ./hack/ginkgo- ./hack/grab- ./hack/update- ./hack/verify-import- ./hack/verify-no-vendor- ./hack/verify-openapi- ./hack/verify-readonly- ./hack/verify-test- ./test/cmd/generic- ./test/cmd/legacy- ./test/cmd/node- ./test/cmd/old- ./test/cmd/request- ./test/cmd/save-
The remaining ones in should be fixed in
some files in /hack/make-rules/ were fixed in 2 PRs. could you help to review? /hack/make- /hack/make- /hack/make- /hack/make- /hack/make-
we're getting there! sorry I haven't had time to keep editing that checklist, is dwindling!
Hello! We are starting Bug Freeze for 1.15. Is this issue still planned on being incorporated into 1.15?
I think optimistically we'll actually finish this in 1.16. there's been considerable progress but I doubt the remainder will complete before code freeze... On Wed, May 29, 2019, 20:51 Dave Strebel <:
/milestone v1.16
we're getting close! some of the remaining ones are pretty gnarly though :-)
On Tue, Jun 25, 2019 at 10:23:48PM -0700, Benjamin Elder wrote: Great work leading this :) Thank you for your work!!
I updated the checklist since that felt nice but stopped trying to track every single PR mapped to it Super close :-)
I don't think we'll make 1.16, I've not had quite as much time to work on these and some of the remaining ones are ... challenging. We're down to only 24 files though!
On Thu, Jul 25, 2019 at 12:30:04AM -0700, Benjamin Elder wrote: Wow, fantastic work to only have 24 files to go :)
I created PRs fix the following script files. Could someone review PRs? ./cluster/test- ./test/images/image-
Trying to get back on this. PR submitted for
Could you please review PRs? validate- image-
Hi, I'm spending this afternoon catching up on PR review and my inbox currently.... I will get to these. Kohei Toyoda <:
In the future please add me to the PR for review, for approval if it's reviewed and I am an OWNER of the relevant files). I use to monitor incoming PRs, those PRs seem to be assigned to others (who are not responding :()
Hello! I'm part of the bug triage team for the 1.16 release cycle and considering this issue is tagged for 1.16, but not updated for a long time, I'd like to check its status. The code freeze is starting on August 29th which means that there should be a PR ready (and merged) until then. Do we still target this issue to be fixed for 1.16? If not please re-tag the issue to the planned milestone.
It's really close but going to be 1.17. I don't believe I have permission to change milestones, or I would have already. On Wed, Aug 28, 2019, 06:44 Tarun Pothulapati <:
/milestone v1.17
I want help. let me work on thses files:
I will fix
Hi Bug Triage Release Team checking in. Code freeze for the 1.17 release is on November 14. Is this still intended for 1.17? Thanks!
This will go into 1.18 most likely. We have some new issues to fix with the next version of shellcheck WIP. On Sat, Oct 26, 2019, 11:56 Kirsten <:
The provided milestone is not valid for this repository. Milestones in this repository: [, , , , , , , , ] Use to clear the milestone. <detailsIn response to : /milestone next Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/milestone v1.18
What is the current status of these? The first two of those files are still found in hack/.shellcheck_failures, but perhaps there are fixes coming in? Or would you like a wingman on this?
Suggestion for fixing found in
Hi, most of these have some attempts to patch them in flight but they've been tricky to land (between some awkward failures, and getting review :/) and tend to be somewhat stalled ... :disappointed: I can't approve some of the changes yet (), but I will happily find time to review PRs.
Hello ! Bug Triage team here for the 1.18 release. This is a friendly reminder that code freeze is scheduled for 5 March. Is this issue still intended for milestone 1.18, or should it extend to the next one? Thanks in advance!
we'll have to punt this one again, we have made a little progress but it's getting harder to get approvals on the remaining files (I can't approve these :(). I would guess we need at least 1.19 if not 1.20 to finish.
Hello thanks for your response. I will move this to 1.19 for now. Have a good day /milestone v1.19
updated the checklist, 9 to go! have a PR out for one of them
has for cluster/pre- which seems to be stranded since November?
We've gained a new cluster/ approver or two since then, I'll drop a note and see if we can get that approved finally ... On Mon, Feb 24, 2020, 01:41 Joakim Roubert <:
Awesome!
Searching the comments here, and the section for currently open PRs, it seems these files are remaining as not currently having either a PR or someone who claimed it? ./cluster/gce/config- ./cluster/gce/gci/configure- ./cluster/gce/gci/master-
Created a stab at cluster/gce/config- in
Can I take some of them? ./cluster/gce/gci/master-
That would be a question for the admins, I guess, but as for me, I am not working on those.
anyone is free to work on anything, PRs welcome the question will just be getting them in. I apologize for my own review latency these days, have a bit too much going on. Joakim Roubert <:
now all tests have passed.
Suggestion for fixing for in PR .
I do believe there is now actions going on for all remaining files in hack/.shellcheck_failures: ./cluster/gce/gci/configure- ./cluster/gce/gci/master- (needs rebase, owner ./cluster/log-dump/log-
/milestone v1.20 I don't think we're quite going to hit 1.19 and that's OK. Sorry I've become ~inactive here, I've gained more duties and we're struggling with test health right now, I don't expect much time for this myself this release.
Updated the checklist, rebasing a PR I have open for log-
It sure is pretty close now!
Closing in now, log- seems to be almost in. Current status of remaining files: ./cluster/gce/gci/master- (needs rebase, owner now stale due to inactivity) ./cluster/log-dump/log-
log- is now merged. Remaining: ./cluster/gce/gci/master- (needs rebase, owner now stale due to inactivity)
The PR for is very large (since there are many things that need to be fixed in it). When the (big) size of it was mentioned, I suggested it might perhaps be split into a couple of sub-PRs, but there has been no input regarding that yet. What do you guys think about that?
+1, let's try breaking it up a little. Sorry for the lack of input () and thank you for working on this!
Very good, I'll give it a shot and see if I can group it into some good way. :-D
's sub-PR has now been approved.
Hey :wave: Bug Triage here. Wanted to follow up on the status of this issue as we're approaching code freeze on 12.11.2020. This issue is tagged for 1.20, is it still planned for this release?
Current status is (still) 3 remaining (although a handful of the sub-PRs for have been merged): (all tests passed, ready for jay or nay) ./cluster/gce/gci/master- (closed due to inactivity!) (has sub-PRs breaking up all the changes into smaller pieces easier to handle)
I have now created which is bringing closed-due-to-inactivity back to life with a few updates. With that one, the lineup of active ongoings would look like: (all tests passed, ready for jay or nay) ./cluster/gce/gci/master- (has sub-PRs breaking up all the changes into smaller pieces easier to handle)
Hi, Bug Triage here, we're pretty late into the code freeze for 1.20 - I am going to put this in the 1.21 milestone /milestone v1.21
Since I just did this out of curiousity for hack/.golintfailures... There have been 258 commits that touched in the past 2 years !
So close now! Getting there...
The sub-PRs are now merged and the size of changes that remain in significantly decreased.<br/ and have both passed all tests in the CI pipeline and are waiting for someone to approve (or further comment anything that should be changed) them.
I think we should be landing these soon, well within 1.21. Then we can follow up with making the verify-shellcheck script much simpler and faster (by not supporting known failures). ~~ Updated the checklist again, looking at outstanding PRs.
still may hit some test flakes, but I believe the remaining fixes are all LGTM+approve.
Joy to the world, all fixes for () are finally in place!
And BAM now is also merged, leaving an empty file.
removes the file and associated logic. No more failures allowed, CI will enforce this now  unless someone really needs to ignore something and adds a instead Thank you so much all!
xref: - thank you! (invite to join: )

Discussion:
# upstream shellcheck latest stable image as of October 23rd, 2019 SHELLCHECK_IMAGE="koalaman/shellcheck-alpine:v0.7.0@sha256:24bbf52aae6eaa27accc9f61de32d30a1498555e6ef452966d0702ff06f38ecb" <del> # fixed name for the shellcheck docker container so we can reliably clean it up SHELLCHECK_CONTAINER="k8s-shellcheck" </del> # disabled lints disabled=( # this lint disallows non-constant source, which we use extensively without

SHELLCHECK_DISABLED="$(join_by , "${disabled[@]}")" readonly SHELLCHECK_DISABLED <del> # creates the shellcheck container for later use create_container () { # TODO(bentheelder): this is a performance hack, we create the container with # a sleep MAX_INT32 so that it is effectively paused. # We then repeatedly exec to it to run each shellcheck, and later rm it when # we're done. # This is incredibly much faster than creating a container for each shellcheck # call ... docker run --name "${SHELLCHECK_CONTAINER}" -d --rm -v "${KUBE_ROOT}:${KUBE_ROOT}" -w "${KUBE_ROOT}" --entrypoint="sleep" "${SHELLCHECK_IMAGE}" 2147483647 } # removes the shellcheck container remove_container () { docker rm -f "${SHELLCHECK_CONTAINER}" &> /dev/null || true } </del> # ensure we're linting the k8s source tree cd "${KUBE_ROOT}"

( -path ./third_party* -a -not -path ./third_party/forked* )  )) <del> # make sure known failures are sorted failure_file="${KUBE_ROOT}/hack/.shellcheck_failures" kube::util::check-file-in-alphabetical-order "${failure_file}" # load known failure files failing_files=() while IFS=$'n' read -r script; do failing_files+=("$script"); done < <(cat "${failure_file}") </del> # detect if the host machine has the required shellcheck version installed # if so, we will use that instead. HAVE_SHELLCHECK=false

fi fi <del> # tell the user which we've selected and possibly set up the container if ${HAVE_SHELLCHECK}; then echo "Using host shellcheck ${SHELLCHECK_VERSION} binary." else echo "Using shellcheck ${SHELLCHECK_VERSION} docker image." # remove any previous container, ensure we will attempt to cleanup on exit, # and create the container remove_container kube::util::trap_add 'remove_container' EXIT if ! output="$(create_container 2>&1)"; then { echo "Failed to create shellcheck container with output: " echo "" echo "${output}" } >&2 exit 1 fi fi </del> # if KUBE_JUNIT_REPORT_DIR is set, disable colorized output. # Colorized output causes malformed XML in the JUNIT report. SHELLCHECK_COLORIZED_OUTPUT="auto"

"--color=${SHELLCHECK_COLORIZED_OUTPUT}" ) <del> # lint each script, tracking failures errors=() not_failing=() for f in "${all_shell_scripts[@]}"; do set +o errexit if ${HAVE_SHELLCHECK}; then failedLint=$(shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}") else failedLint=$(docker exec -t ${SHELLCHECK_CONTAINER}  shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}") fi set -o errexit kube::util::array_contains "${f}" "${failing_files[@]}" && in_failing=$? || in_failing=$? if [[ -n "${failedLint}" ]] && [[ "${in_failing}" -ne "0" ]]; then errors+=( "${failedLint}" ) fi if [[ -z "${failedLint}" ]] && [[ "${in_failing}" -eq "0" ]]; then not_failing+=( "${f}" ) fi done </del> <ins> # tell the user which we've selected and lint all scripts res=0 if ${HAVE_SHELLCHECK}; then echo "Using host shellcheck ${SHELLCHECK_VERSION} binary." shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" || res=$? else echo "Using shellcheck ${SHELLCHECK_VERSION} docker image." docker run  --rm -v "${KUBE_ROOT}:${KUBE_ROOT}" -w "${KUBE_ROOT}"  "${SHELLCHECK_IMAGE}"  shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" || res=$? fi </ins> <del> # Check to be sure all the files that should pass lint are. if [ ${#errors[@]} -eq 0 ]; then </del> <ins> # print a message based on the result if [ $res -eq 0 ]; then </ins> echo 'Congratulations! All shell files are passing lint (excluding those in hack/.shellcheck_failures).' else { <del> echo "Errors from shellcheck:" for err in "${errors[@]}"; do echo "$err" done </del> echo echo 'Please review the above warnings. You can test via "./hack/verify-shellcheck.sh"' <del> echo 'If the above warnings do not make sense, you can exempt this package from shellcheck' echo 'checking by adding it to hack/.shellcheck_failures (if your reviewer is okay with it).' echo } >&2 exit 1 fi if [[ ${#not_failing[@]} -gt 0 ]]; then { echo "Some files in hack/.shellcheck_failures are passing shellcheck. Please remove them." echo for f in "${not_failing[@]}"; do echo "  $f" done </del> <ins> echo 'If the above warnings do not make sense, you can exempt this warning with a comment' echo ' (if your reviewer is okay with it).' echo 'In general please prefer to fix the error, we have already disabled specific lints' echo ' that the project chooses to ignire.' echo 'See: https://github.com/koalaman/shellcheck/wiki/Ignore#ignoring-one-specific-instance-in-a-file' </ins> echo } >&2 exit 1 fi <del> # Check that all failing_files actually still exist gone=() for f in "${failing_files[@]}"; do kube::util::array_contains "$f" "${all_shell_scripts[@]}" || gone+=( "$f" ) done if [[ ${#gone[@]} -gt 0 ]]; then { echo "Some files in hack/.shellcheck_failures do not exist anymore. Please remove them." echo for f in "${gone[@]}"; do echo "  $f" done echo } >&2 exit 1 fi </del> <ins> # preserve the result exit $res </ins>