Exemplo n.º 1
0
        private static void CompileRecurse(Linter linter, string directory)
        {
            var files = Directory.GetFiles(directory);

            foreach (var f in files)
            {
                if (linter.IsEntryPoint(f))
                {
                    linter.Lint(f);
                }
            }
            var dirs = Directory.GetDirectories(directory);

            foreach (var d in dirs)
            {
                CompileRecurse(linter, d);
            }
        }
        public static async Task <bool> Lint(bool showErrorList, bool fixErrors, bool callSync,
                                             string[] fileNames, bool clearAllErrors, Dictionary <string, string> fileToProjectMap)
        {
#if DEBUG
            if (fileNames.Length == 0)
            {
                throw new Exception("LinterService/Lint called with empty fileNames list");
            }
#endif
            bool hasVSErrors = false;
            try
            {
                WebLinterPackage.Dte.StatusBar.Text = "Analyzing...";
                WebLinterPackage.Dte.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral);

                await CopyResourceFilesToUserProfile(false, callSync);

                Linter        linter = new Linter(WebLinterPackage.Settings, fixErrors, Logger.LogAndWarn);
                LintingResult result = await linter.Lint(callSync, fileNames);

                if (result != null)
                {
                    ErrorListService.ProcessLintingResults(result, fileNames, clearAllErrors,
                                                           showErrorList, fixErrors, fileToProjectMap);
                    hasVSErrors = result.HasVsErrors;
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            finally
            {
                WebLinterPackage.Dte.StatusBar.Clear();
                WebLinterPackage.Dte.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral);
            }
            return(hasVSErrors);
        }
Exemplo n.º 3
0
 private static void CompileRecurse(Linter linter, string directory)
 {
     var files = Directory.GetFiles(directory);
     foreach(var f in files)
     {
         if(linter.IsEntryPoint(f))
             linter.Lint(f);
     }
     var dirs = Directory.GetDirectories(directory);
     foreach(var d in dirs)
         CompileRecurse(linter, d);
 }