示例#1
0
        private void UseRegexAnalysis(Transformation transformation, string pattern, Term issueDescription, [CallerMemberName] string issueType = null)
        {
            var regex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

            var regexMatches = regex.Matches(transformation.Code);

            if (regexMatches.Count == 0)
            {
                return;
            }

            DetectedIssueTypes.TryAdd(issueType, issueDescription);

            foreach (Match match in regex.Matches(transformation.Code))
            {
                transformation.AddIssue(match.Index, match.Length, issueType);
            }
        }