Output ShellCheck in diff format
Have ShellCheck write a fix as a patch with -f diff and apply it with patch -p1. It only offers fixes for findings that have one, like missing quotes.
ShellCheck reports forty missing quotes, and you would rather apply the fix than retype each one.
printf '#!/bin/bash\nname=$1\necho $name\n' > fix.sh
shellcheck -f diff fix.sh
echo ---
shellcheck -f diff fix.sh | patch -p1
cat fix.sh
shellcheck fix.sh && echo "clean"--- a/fix.sh
+++ b/fix.sh
@@ -1,3 +1,3 @@
#!/bin/bash
name=$1
-echo $name
+echo "$name"
---
patching file fix.sh
#!/bin/bash
name=$1
echo "$name"
clean-f diff prints a unified diff of the changes ShellCheck knows how to make, with a/ and b/ path prefixes, so patch -p1 or git apply can apply it. Here the single fix is the double quotes around the variable, which are the answer to SC2086 and the commonest finding. The format is listed in the ShellCheck manual. After patching, the plain run reports nothing.
Many findings have no automatic fix, so the diff covers only part of the report, and a second run shows what is left. Read the patch before applying it: a quote added around a variable that was meant to split into words changes what the script does. Commit first, so git diff shows exactly what was changed.