public void RequestAnalysis(string path, string charset, IEnumerable <SonarLanguage> detectedLanguages)
        {
            IssueTagger tracker;

            if (!taggers.TryGetValue(path, out tracker))
            {
                return;
            }

            bool handled = false;

            foreach (var language in detectedLanguages)
            {
                switch (language)
                {
                case SonarLanguage.Javascript:
                    handled = true;
                    daemon.RequestAnalysis(path, charset, "js", null, this);
                    break;

                case SonarLanguage.CFamily:
                    handled = true;
                    CFamily.ProcessFile(daemon, this, logger, tracker.ProjectItem, path, charset);
                    break;

                default:
                    break;
                }
            }

            if (!handled)
            {
                logger.WriteLine($"Unsupported content type for {path}");
            }
        }
        public void RequestAnalysis(string path, string charset, IList <IContentType> contentTypes)
        {
            IssueTagger tracker;

            if (taggers.TryGetValue(path, out tracker))
            {
                foreach (IContentType type in contentTypes)
                {
                    if (type.IsOfType("JavaScript"))
                    {
                        daemon.RequestAnalysis(path, charset, "js", null, this);
                        return;
                    }
                    if (type.IsOfType("C/C++"))
                    {
                        string sqLanguage;
                        string json = CFamily.TryGetConfig(tracker.ProjectItem, path, out sqLanguage);
                        if (json != null && sqLanguage != null)
                        {
                            daemon.RequestAnalysis(path, charset, sqLanguage, json, this);
                        }
                        return;
                    }
                }
                VsShellUtils.WriteToSonarLintOutputPane(ServiceProvider.GlobalProvider, "Unsupported content type for " + path);
            }
        }
예제 #3
0
        private void UnsafeRequestAnalysis(string path, string charset, IEnumerable <SonarLanguage> detectedLanguages, IIssueConsumer issueConsumer, ProjectItem projectItem)
        {
            bool handled = false;

            foreach (var language in detectedLanguages)
            {
                switch (language)
                {
                case SonarLanguage.Javascript:
                    handled = true;
                    daemon.RequestAnalysis(path, charset, "js", null, issueConsumer);
                    break;

                case SonarLanguage.CFamily:
                    handled = true;
                    CFamily.ProcessFile(daemon, issueConsumer, logger, projectItem, path, charset);
                    break;

                default:
                    break;
                }
            }

            if (!handled)
            {
                logger.WriteLine($"Unsupported content type for {path}");
            }
        }
예제 #4
0
        public void RequestAnalysis(string path, string charset, IEnumerable <SonarLanguage> detectedLanguages)
        {
            IssueTagger tracker;

            if (taggers.TryGetValue(path, out tracker))
            {
                foreach (var language in detectedLanguages)
                {
                    switch (language)
                    {
                    case SonarLanguage.Javascript:
                        daemon.RequestAnalysis(path, charset, "js", null, this);
                        break;

                    case SonarLanguage.CFamily:
                        string sqLanguage;
                        string json = CFamily.TryGetConfig(logger, tracker.ProjectItem, path, out sqLanguage);
                        if (json != null && sqLanguage != null)
                        {
                            daemon.RequestAnalysis(path, charset, sqLanguage, json, this);
                        }
                        break;

                    default:
                        break;
                    }
                }

                logger.WriteLine($"Unsupported content type for {path}");
            }
        }