package-validator
package-validator copied to clipboard
Checking for commands instead of comments
Some of our validation stuff is a bit primitive in its checks through the powershell scripts. We should instead do this
Collection<PSParseError> errors = null;
var tokens = PSParser.Tokenize(contents, out errors);
var requiredCalls = tokens.Where(p => p.Type != PSTokenType.Comment &&
(
p.Content.to_lower().Contains("get-webfile") ||
p.Content.to_lower().Contains("something")
)
);
This we can do to avoid flagging on cinst/cup/choco upgrades and when checking for the presence of certain commands in the scripts.