static IssueStats[] GetScriptIssuesSummary(ProjectReport projectReport) { var statsDict = new Dictionary <int, IssueStats>(); var scriptIssues = projectReport.GetIssues(IssueCategory.Code); var numScriptIssues = scriptIssues.Length; for (var i = 0; i < numScriptIssues; ++i) { var descriptor = scriptIssues[i].descriptor; var id = descriptor.id; IssueStats stats; if (!statsDict.TryGetValue(id, out stats)) { stats = new IssueStats { id = id }; } ++stats.numOccurrences; if (scriptIssues[i].isPerfCriticalContext) { ++stats.numHotPathOccurrences; } statsDict[id] = stats; } return(statsDict.Values.OrderByDescending(x => x.numOccurrences).Take(k_MaxIssuesInAnalyzeSummary).ToArray()); }
internal static IEnumerable <ProjectIssue> FindScriptIssues(ProjectReport projectReport, string relativePath) { return(projectReport.GetIssues(IssueCategory.Code).Where(i => i.relativePath.Equals(relativePath))); }
void OnEnable() { var currentState = m_AnalysisState; m_AnalysisState = AnalysisState.Initializing; ProjectAuditorAnalytics.EnableAnalytics(); m_ProjectAuditor = new ProjectAuditor(); UpdateAreaSelection(); UpdateAssemblySelection(); if (m_TextFilter == null) { m_TextFilter = new TextFilter(); } var viewDescriptors = ViewDescriptor.GetAll(); Array.Sort(viewDescriptors, (a, b) => a.menuOrder.CompareTo(b.menuOrder)); m_ViewDropdownItems = new Utility.DropdownItem[viewDescriptors.Length]; m_Views = new AnalysisView[viewDescriptors.Length]; for (int i = 0; i < viewDescriptors.Length; i++) { var desc = viewDescriptors[i]; var layout = m_ProjectAuditor.GetLayout(desc.category); var isSupported = layout != null; m_ViewDropdownItems[i] = new Utility.DropdownItem { Content = new GUIContent(string.IsNullOrEmpty(desc.menuLabel) ? desc.name : desc.menuLabel), SelectionContent = new GUIContent("View: " + desc.name), Enabled = isSupported }; if (!isSupported) { Debug.Log("Project Auditor module " + desc.category + " is not supported."); continue; } var view = desc.viewType != null ? (AnalysisView)Activator.CreateInstance(desc.viewType) : new AnalysisView(); view.Create(desc, layout, m_ProjectAuditor.config, m_Preferences, this); if (currentState == AnalysisState.Valid) { view.AddIssues(m_ProjectReport.GetIssues(desc.category)); } m_Views[i] = view; } if (currentState != AnalysisState.Valid) { m_ProjectReport = new ProjectReport(); } AnalysisView.SetReport(m_ProjectReport); AnalysisView.OnChangeView = SelectView; GetView <ShaderVariantsView>().SetShadersAuditor(m_ProjectAuditor.GetAuditor <ShadersAuditor>()); // are we reloading from a valid state? if (currentState == AnalysisState.Valid && m_ActiveViewIndex < viewDescriptors.Length) { m_AnalysisState = currentState; } else { m_AnalysisState = AnalysisState.Initialized; } RefreshDisplay(); Instance = this; }