thoughtbot / thoughtbot/dotfiles
Run ShellCheck over bin/ in CI
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 8.2k
- Forks
- 1.8k
- Avg merge
- 10d 14h
- Merged PRs (30d)
- 1
Description
bin/clear-port cites a ShellCheck rule by number, and the number is wrong.
The commit message for #789 says an unquoted $(...) "trips SC2086". It trips
SC2046. I checked with ShellCheck 0.11.0:
$ cat sc.sh
#!/bin/sh
kill $(lsof -ti4TCP:"$1" -sTCP:LISTEN)
$ shellcheck sc.sh
In sc.sh line 2:
kill $(lsof -ti4TCP:"$1" -sTCP:LISTEN)
^-- SC2046 (warning): Quote this to prevent word splitting.
SC2086 is the related rule for an unquoted variable. SC2046 is the one for an
unquoted command substitution.
Two things to do:
- Edit the pull request description on #789. That copy stays editable. The
commit message does not, once the branch is merged. - Run ShellCheck over
bin/in CI, so a cited rule can be checked rather
than trusted.
The second point is the one that lasts. Nothing in this repo runs ShellCheck
today, so rules get cited from memory and no build disagrees. bin/clear-port
on main currently trips SC2181, and #789 happens to clear it:
$ shellcheck bin/clear-port # before #789
In bin/clear-port line 9:
if [ $? -eq 0 ]; then
^-- SC2181 (style): Check exit code directly.
$ shellcheck bin/clear-port # after #789
(no findings)
Other scripts will have findings of their own. bin/replace and
bin/bundler-search both use &>, which is a bashism under a #!/bin/sh
shebang. A first pass should decide which rules this repo wants to enforce
before turning the build red.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the bin/ scripts, especially bin/clear-port, bin/replace, and bin/bundler-search, then check how CI is configured in this repository. Run ShellCheck over bin/ and decide which findings the project should enforce before making the build fail. Update #789's pull request description and make the CI check cover the intended scripts with documented rule choices.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100