コード例 #1
0
        internal Comment CloseComment()
        {
            var comment = new Comment()
            {
                File = this.FileName,
                Text = commentBuffer.ToString(),
                Start = commentBegin,
                End = lineCount
            };

            commentBuffer.Clear();
            commentBegin = -1;

            return comment;
        }
コード例 #2
0
		private double Score(Comment comment, TextAnalyzer.AnalysisResult result)
		{
			double score = 0;

			if (result.WhiteSpace == 1)
			{
				// whitespace only skip it.
			}
			else
			{
				Char endsWith = comment.Text[comment.Text.Length - 1];

				if (endsWith == ';')
				{
					score += 10;
				}
				else if (endsWith == '.')
				{
					// c# lines (in general) shouldn't end with a period.
					score -= 5;
				}

				if (result.WhiteSpace > 0.5)
				{
					score += 5;
				}

				if (result.Letters > 0.8)
				{
					score -= 5;
				}

				if (result.Punctuation > 0.3)
				{
					score += 3;
				}
			}

			return score;
		}