Example #1
0
 protected override void AnalyzeSpeakerData(IDocument document, IAnalyzerContext context)
 {
     foreach (string linkKey in SpeakerLinkAttribute.GetAll().Keys)
     {
         if (document.ContainsKey(linkKey) && !Uri.TryCreate(document.GetString(linkKey), UriKind.Absolute, out _))
         {
             context.Add(document, $"{linkKey} link {document.GetString(linkKey)} is invalid");
         }
     }
 }
Example #2
0
 protected override void AnalyzeSpeakerData(IDocument document, IAnalyzerContext context)
 {
     foreach (KeyValuePair <string, SpeakerLinkAttribute> linkAttribute in SpeakerLinkAttribute.GetAll())
     {
         if (document.ContainsKey(linkAttribute.Key))
         {
             if (!Uri.TryCreate(document.GetString(linkAttribute.Key), UriKind.Absolute, out Uri uri))
             {
                 context.AddAnalyzerResult(document, $"{linkAttribute.Key} link {document.GetString(linkAttribute.Key)} is invalid");
             }
             else if (linkAttribute.Value.EnforceHttps && uri.Scheme != Uri.UriSchemeHttps)
             {
                 context.AddAnalyzerResult(document, $"{linkAttribute.Key} link should be HTTPS and was not");
             }
         }
     }
 }