When running phpcs
with the --ignore
option (because I don’t want to scan the /vendor
nor /node_modules
directories), I kept getting the error zsh: no matches found: --ignore=/vendor/*,/node_modules/*
.
The problem is zsh tries to expand (a.k.a. glob) the command based on the asterisk (*
).
phpcs -p --ignore=/vendor/*,/node_modules/* .
zsh: no matches found: --ignore=/vendor/*,/node_modules/*
Solutions
Solution 1: Quotes
By adding quotes around the ignore
value, we can prevent the zsh globbing.
phpcs -p --ignore='/vendor/*,/node_modules/*' .
Solution 2: noglob
Zsh also includes precommand modifiers, one of which is noglob
which disables globbing for the following command.
noglob phpcs -p --ignore=/vendor/*,/node_modules/* .
Leave a Reply