Closed KaushikMalapati closed 1 month ago
I will turn this into a real pr once I test it a bit more.
Is the way to go here adding shellcheck AND shellfmt to precommit?
Is the way to go here adding shellcheck AND shellfmt to precommit?
Yes. There's some overlap but shellcheck would mainly be for catching errors and shfmt for consistent styling.
Very minor edits
46 files
First glance looks great but we're going to need to review and test carefully
I think shellfmt
and similar sorts of auto-formatting tools are great
As long as it doesn't disagree with shellcheck on anything we can include it
Description
Very minor edits that don't change anything important.
I shellchecked the bash scripts in /scripts (making edits based on warnings, errors and info messages that shellcheck gave). Some notes and questions I have are:
$()
for commands, using -gt instead of >, using grep -c or pgrep instead of grep | wc -l and ps | grep, and checking exit codes directly with if cmd; or if !cmd instead of cmd; if [$?]I also found a tool called shfmt which we could add a precommit job for. Here is an example of the diff it would print for kinit_helper
It basically formats things nicely. I have the indenting set to four spaces right now, but it could be a different number or tabs instead. I haven't formatted anything yet because I don't want to add this unilaterally,
Motivation and Context
182
To standardize style and fix existing shellcheck issues so that future contributors only see pre-commit/workflow errors related to their changes instead of what was already there.
How Has This Been Tested?
Interactively
Where Has This Been Documented?
N/A