示例#1
0
 public void CheckFunctions(IEnumerable <MethodDeclarationSyntax> functions)
 {
     foreach (var function in functions)
     {
         FileLinePositionSpan linePositionSpan     = function.Identifier.GetLocation().GetLineSpan();
         BlockSyntax          body                 = function.Body;
         FileLinePositionSpan fileLinePositionSpan = function.SyntaxTree.GetMappedLineSpan(body.Span);
         CheckFunctionScope(function);
         CheckFunctionInputs(function);
         Position position = new Position
         {
             row = linePositionSpan.StartLinePosition.Line + 1,
             col = linePositionSpan.StartLinePosition.Character + 1
         };
         Functions.Add(position, function.Identifier.ToString());
     }
     foreach (var item in Functions)
     {
         string   line  = MySpellChecker.SplitCamel(item.Value);
         string[] words = line.Split(' ');
         if (!MySpellChecker.HasCorrectSpell(item.Value))
         {
             Console.WriteLine("Please Check '{0}' in row {1} and col {2}", item.Value, item.Key.row, item.Key.col);
         }
         if (item.Value != "Main")
         {
             if (!MySpellChecker.IsVerb(words[0]))
             {
                 Console.WriteLine("\'{0}\' in row {1} and col {2} is not a verb", item.Value, item.Key.row, item.Key.col);
             }
         }
     }
 }
示例#2
0
        public void  CheckIdentifiers(IEnumerable <IdentifierNameSyntax> identifiers)
        {
            foreach (var item in identifiers)
            {
                SyntaxToken id_      = item.Identifier;
                Position    position = new Position
                {
                    row = id_.GetLocation().GetLineSpan().StartLinePosition.Line,
                    col = id_.GetLocation().GetLineSpan().StartLinePosition.Character
                };
                if (!ForIndexes.ContainsKey(position))
                {
                    Identifiers.Add(position, id_.ToString());
                }
            }

            foreach (var item in Identifiers)
            {
                if (!MySpellChecker.HasCorrectSpell(item.Value))
                {
                    Console.WriteLine("Please Check '{0}' in row {1} and col {2}", item.Value, item.Key.row, item.Key.col);
                }
            }
        }