-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fixing some style issues in shell scripts with shellcheck #77290
Comments
Can I have a go at this? I think I can work on it. |
Sure. But it's known that there are some false-positive suggestions in shellcheck. |
Alright, I'll have a look at what fails CI then! |
Just a question, I've reached src/ci/docker/scripts/android-start-emulator.sh, which starts with a shebang referencing #!/bin/sh instead of the usual #!/usr/bin/env bash, and then goes on to use &>, which shellcheck warns is not a thing on POSIX sh. Should this be changed to bash or is there a reason for this?
|
Also, what should I do about the unused variables that pop up here and there? Some like TARGET seem like they might be nice keeping if not just for making the file follow the same structure as the others, but since they're unused I'm not sure if I should delete them. |
Just use
You could grep for the unused variables in |
So if they're unused they should probably be exported then, no? The ones shellcheck is warning about aren't |
You could remove it. File a draft PR to see if it run successfully. |
The previous PR seems abondoned, I'll try it. |
…n514 Fix shellcheck error ## Overview Helps with rust-lang#77290 This pr fix only errors of shellcheck, the result of `git ls-files '*.sh' | xargs shellcheck --severity=error`. Fixing error are following. - https://github.com/koalaman/shellcheck/wiki/SC2148 - https://github.com/koalaman/shellcheck/wiki/SC1008 Disable error following. - https://github.com/koalaman/shellcheck/wiki/SC2068
…n514 Fix shellcheck error ## Overview Helps with rust-lang#77290 This pr fix only errors of shellcheck, the result of `git ls-files '*.sh' | xargs shellcheck --severity=error`. Fixing error are following. - https://github.com/koalaman/shellcheck/wiki/SC2148 - https://github.com/koalaman/shellcheck/wiki/SC1008 Disable error following. - https://github.com/koalaman/shellcheck/wiki/SC2068
Is there still work to do here now that #78666 has been merged? |
Triage: #78666 fixed the shellcheck errors and I don't think it's much worth applying shellcheck's suggestions to our source, while fighting a lot of regressions, so I'm going to close the issue. Thanks! |
There are some style issues in shell scripts in this repository.
ShellCheck is an useful tool to find bugs in shell scripts.
One could run
git ls-files '*.sh'
to find all shell script files and pipe the result toxargs shellcheck
.Or just fix it file-by-file.
Note that this issue doesn't talk about including shellcheck tests in CI.
@rustbot modify labels: E-easy E-mentor T-infra
The text was updated successfully, but these errors were encountered: