-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
tools: lint shell scripts #36099
tools: lint shell scripts #36099
Conversation
Edit: sorry, I didn't pay good enough attention to what your script was doing. There's already a GitHub action in the marketplace, though (I don't know what it's worth): https://github.com/ludeeus/action-shellcheck |
@targos this PR is precisely using ShellCheck ^^ It's just a wrapper script to find all the
Yes, I think we can get more value by having our own script so contributors can run the same test at home. Also I've added a |
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.
I read here that it is better to avoid which
and use command -v
instead: https://stackoverflow.com/a/677212
🙂
@Trott I've tried to add a fallback to use
|
Are you getting that locally? I'm running your |
By the way, totally OK with me to land this without |
Ah it must be a problem with my installation. Good news :) |
@nodejs/linting This is ready for review if you want to have a look. |
Ping @nodejs/linting. |
Commit Queue failed- Loading data for nodejs/node/pull/36099 ✔ Done loading data for nodejs/node/pull/36099 ----------------------------------- PR info ------------------------------------ Title tools: lint shell scripts (#36099) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch aduh95:lint-sh -> nodejs:master Labels author ready, meta, tools Commits 4 - tools: lint shell scripts - fixup! tools: lint shell scripts - fixup! tools: lint shell scripts - fixup! tools: lint shell scripts Committers 1 - Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/36099 Reviewed-By: Rich Trott ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/36099 Reviewed-By: Rich Trott -------------------------------------------------------------------------------- ✔ Last GitHub Actions successful ℹ Last Full PR CI on 2020-12-15T12:59:23Z: https://ci.nodejs.org/job/node-test-pull-request/34949/ - Querying data for job/node-test-pull-request/34949/ ✔ Build data downloaded - Querying failures of job/node-test-commit/42962/ ✔ Data downloaded ✖ 2 failure(s) on the last Jenkins CI run ℹ This PR was created on Thu, 12 Nov 2020 17:54:52 GMT ✔ Approvals: 1 ✔ - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/36099#pullrequestreview-552383843 -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/423801608 |
PR-URL: nodejs#36099 Reviewed-By: Rich Trott <rtrott@gmail.com>
Landed in 0e96dc1 |
PR-URL: #36099 Reviewed-By: Rich Trott <rtrott@gmail.com>
V8's `tools/dev/v8gen.py` does not like being passed an empty string (`""`). PR-URL: #36594 Refs: #36099 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
V8's `tools/dev/v8gen.py` does not like being passed an empty string (`""`). PR-URL: #36594 Refs: #36099 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
PR-URL: #36099 Reviewed-By: Rich Trott <rtrott@gmail.com>
V8's `tools/dev/v8gen.py` does not like being passed an empty string (`""`). PR-URL: #36594 Refs: #36099 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
This PR introduces ShellCheck to Node.js core.
This does not vendor ShellCheck, instead it:
SHELLCHECK
variable.command -v shellcheck
in case it has been installed in the PATH.npx shellcheck
(https://npmjs.org/shellcheck) to download it from the internetOn top of ShellChecks checks, it also enforces
#!/bin/sh
at the top of the file. There were a few scripts that were using either#!/usr/bin/env bash
or#!/bin/bash
, but it's easier to have all of them using the same shell. I've also open several PRs that make changes to files that were using bashisms and which should land before this PR.Reasons to prefer
sh
overbash
(copied from a StackOverflow answer):This PR also adds a new GH Actions in
linters.yml
, and fixes the failing checks on the existing.sh
files.Blocked on:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes