string rootFolder = silEnv("sil.home"); string [] ignoredFolderPrefixes = ".|_|!|examples"; //<-- add folder names or prefixes in order to have them ignored by search string seperator = "/"; //<-- for windows servers change to "\\" //searches for SIL code that is found in validators function searchValScripts(string dir) { string [] res; for(string file in findFiles(dir, ".*")) { string text = readFromTextFile(file); if(contains(text, "return false") == true && contains(text, "customfield") == true) { res += file; } } return res; } //searches for SIL code for use of null keyword function searchNullScripts(string dir) { string [] res; for(string file in findFiles(dir, ".*")) { string text = readFromTextFile(file); if(contains(text, " null") == true || contains(text, " Null") == true) { res += file; } } return res; } //an attempt to make a recursive directory search function getAllDirs(string root) { string [] dirs = findDirectories(root, ".*");; string [] subDirs = dirs; int loopCount = 0; while(size(subDirs) > 0 && loopCount < 100) { string [] temp; for(string sd in subDirs) { boolean systemFolder = false; string [] dirNames = split(replace(sd, seperator, "@"), "@"); for(string name in dirNames) { for(string pre in ignoredFolderPrefixes) { if(startsWith(name, pre)) { systemFolder = true; } } } if(!systemFolder) { temp += findDirectories(sd, ".*"); } } dirs += temp; subDirs = temp; loopCount ++; } dirs = arrayToSet(dirs); return arraySort(dirs, false); } //-----start checking the files----- string [] vals = searchValScripts(rootFolder); string [] nulls = searchNullScripts(rootFolder); //loop through all the files found for(string dir in getAllDirs(rootFolder)) { vals += searchValScripts(dir); //call validator function to check files nulls += searchNullScripts(dir); //call nulls function to check files } //make validator output pretty if(size(vals) > 0) { string list = "Validators to check [" + trim(size(vals)) + "]:\n
    \n"; for(string v in vals) { list += "
  1. " + replace(v, rootFolder + seperator, "") + "
  2. \n"; } list += "

"; list += "For more information about the change see this page in the documentation.

"; runnerLog(list, true); } //make nulls output pretty if(size(nulls) > 0) { string list = "Nulls used as keywords in script: [" + trim(size(nulls)) + "]:\n
    \n"; for(string n in nulls) { list += "
  1. " + replace(n, rootFolder + seperator, "") + "
  2. \n"; } list += "

"; list += "For more information about the change see this page in the documentation."; runnerLog(list, true); }