예제 #1
0
        /// <summary>
        /// Checks the document for single line comments that start with three slashes.
        /// </summary>
        /// <param name="root">The document root.</param>
        private void CheckSingleLineComments(CsDocument root)
        {
            Param.AssertNotNull(root, "root");

            for (SingleLineComment comment = root.FindFirstDescendent<SingleLineComment>(); comment != null; comment = comment.FindNextDescendentOf<SingleLineComment>(root))
            {
                string text = comment.Text;
                if (text.StartsWith("///", StringComparison.Ordinal) &&
                    (text.Length == 3 || (text.Length > 3 && text[3] != '/')))
                {
                    this.AddViolation(
                        comment.FindParentElement(),
                        comment.LineNumber,
                        Rules.SingleLineCommentsMustNotUseDocumentationStyleSlashes);
                }
            }
        }