예제 #1
0
 /// <summary>
 /// Performs code analysis of a repo
 /// </summary>
 public void AnalyzeRepo()
 {
     foreach (var file in repoSource.GetFiles())
     {
         try
         {
             var analyzer = new CodeAnalyzer(file);
             AnalysisResult.Add(analyzer.AnalyzeCode());
         }
         catch (Esprima.ParserException e)
         {
             var error = new ParseErrorResponse()
             {
                 errorName = "PARSE_ERROR",
                 message   = e.Description,
                 line      = e.LineNumber,
                 column    = e.Column
             };
             AnalysisResult.Add(new FileAnalysisResult()
             {
                 error = error, FileName = file.fileName
             });
         }
     }
 }
        public FileAnalysisResult Analyze([FromBody] AnalyzeCodeResource data)
        {
            var analyzer = new CodeAnalyzer(data.Code);
            var res      = analyzer.AnalyzeCode();

            UpdateStats(res.LinesAnalyzed, res.SmellCount, 1, 0);
            return(res);
        }