for s in "$(mycommand)"; do echo "$s"; done
The correct code depends on your intention. Let's say you're in a directory with the files
My cat.png, and you want to loop over a command that outputs (or variable that contains):
hello world My *.png
mycommand | while IFS= read -r s; do echo "$s"; done
# relies on the fact that IFS by default contains space-tab-linefeed for s in $(mycommand); do echo "$s"; done
# explicitly set IFS to contain only a line feed IFS=' ' for s in $(mycommand); do echo "$s"; done
You get this warning because you have a loop that will only ever run exactly one iteration. Since you have a loop, you clearly expect it to run more than once. You just have to decide how it should be split up.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.