Open coolaj86 opened 2 years ago
This is partially negated by #656
Would you like to create a cheatsheet with all using SC disable
at files?
If yes I created a one line for that, using a documentation about ShellCheck:
yorune@Hana ~/git/webi-installers main $ shellcheck_gist=$(curl --silent https://gist.githubusercontent.com/nicerobot/53cee11ee0abbdc997661e65b348f375/raw/d5a97b3b18ead38f323593532050f0711084acf1/_shellcheck.md); for i in $(grep --color=no -hroE 'SC[0-9]+' | sort -u | grep SC); do echo -e "$i $(echo $shellcheck_gist | grep $i | sed 's/\[SC.*) //g' )"; done
SC1003 - Want to escape a single quote? echo 'This is how it'\''s done'.
SC1004 - This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
SC1090 - Can't follow non-constant source. Use a directive to specify location.
SC2005 - Useless `echo`? Instead of `echo $(cmd)`, just use `cmd`
SC2010 - Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.
SC2016 - Expressions don't expand in single quotes, use double quotes for that.
SC2030 - Modification of var is local (to subshell caused by pipeline).
SC2034 - foo appears unused. Verify it or export it.
SC2046 - Quote this to prevent word splitting
SC2059 - Don't use variables in the printf format string. Use printf "..%s.." "$foo".
SC2086 - Double quote to prevent globbing and word splitting.
SC2088 - Tilde does not expand in quotes. Use $HOME.
SC2154 - var is referenced but not assigned.
I'm gonna add the error codes that I disable the most often to the cheat sheet: