in DevSkim-VSCode-Plugin/server/src/devskimWorker.ts [679:729]
public static appliesToLangOrFile(languageID: string, applies_to: string[], does_not_apply_to: string[], documentURI: string): boolean
{
var pass = false;
//if the parameters are empty, assume it applies. Also, apply all the rules to plaintext documents
if (applies_to != undefined && applies_to && applies_to.length > 0)
{
for (let applies of applies_to)
{
//if the list of languages this rule applies to matches the current lang ID
if (languageID !== undefined && languageID != null && languageID.toLowerCase() == applies.toLowerCase())
{
pass = true;
}
else if (applies.indexOf(".") != -1 /*applies to is probably a specific file name instead of a langID*/
&& documentURI.toLowerCase().indexOf(applies.toLowerCase()) != -1) /*and its in the current doc URI*/
{
pass = true;
}
if (pass){
break;
}
}
}
else
{
pass = true;
}
if (pass = true)
{
if (does_not_apply_to != undefined && does_not_apply_to && does_not_apply_to.length > 0)
{
for (let does_not_apply of does_not_apply_to)
{
//if the list of languages this rule applies to matches the current lang ID
if (languageID !== undefined && languageID != null && languageID.toLowerCase() == does_not_apply.toLowerCase())
{
pass = false;
}
else if (does_not_apply.indexOf(".") != -1 /*applies to is probably a specific file name instead of a langID*/
&& documentURI.toLowerCase().indexOf(does_not_apply.toLowerCase()) != -1) /*and its in the current doc URI*/
{
pass = false;
}
if (!pass){
break;
}
}
}
}
return pass;
}