Move ignoredDependency logic into the artifact scanner.

Speeds up when many artifacts are ignored and also makes the code easier to read.