The problem is exactly what shelcheckshellcheck is telling you: for loops iterating over the output of find or similar commands are fragile. For example:
$ ls
'a file with spaces'
$ for file in $(find . ); do echo "$file"; done
.
./a
file
with
spaces
The safe way would be either to use the -exec of find:
$ find . -exec echo {} \;
.
./a file with spaces
Or to use a while loop:
$ find . -print0 | while IFS= read -r -d '' file; do echo "$file"; done
.
./a file with spaces