Noticed in a refactoring branch that the behaviour for SC2069 had changed so I didn't need disable statements surrounding my valid uses anymore, which got me thinking. Wouldn't a checker for code like this make sense;
foo=$(cmd >/dev/null)
foo=$(cmd >/dev/null 2>&1)
foo=$(cmd &>/dev/null)
foo=$(cmd >&/dev/null)
cmd >/dev/null | cmd
cmd >/dev/null 2>&1 | cmd
cmd &>/dev/null | cmd
cmd >&/dev/null | cmd
# etc.. (sorry for the sloppy edits)
Noticed in a refactoring branch that the behaviour for SC2069 had changed so I didn't need disable statements surrounding my valid uses anymore, which got me thinking. Wouldn't a checker for code like this make sense;