package-validator icon indicating copy to clipboard operation
package-validator copied to clipboard

Checking for commands instead of comments

Open ferventcoder opened this issue 10 years ago • 0 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.

ferventcoder avatar Jan 25 '16 17:01 ferventcoder