Пример #1
0
        public static IEnumerable <ProjectIssue> AnalyzeAndFindScriptIssues(ScriptResource scriptResource)
        {
            var projectAuditor = new Unity.ProjectAuditor.Editor.ProjectAuditor();
            var projectReport  = projectAuditor.Audit();

            return(ScriptAuditor.FindScriptIssues(projectReport, scriptResource.relativePath));
        }
Пример #2
0
        public void ShouldNotReportMutedIssue()
        {
            var projectAuditor         = new Unity.ProjectAuditor.Editor.ProjectAuditor();
            var projectAuditorSettings = projectAuditor.config;
            var projectReport          = projectAuditor.Audit();
            var issues = ScriptAuditor.FindScriptIssues(projectReport, m_ScriptResource.relativePath);

            Assert.AreEqual(1, issues.Count());

            var issue = issues.FirstOrDefault();

            projectAuditorSettings.ClearAllRules();

            var action = projectAuditorSettings.GetAction(issue.descriptor, issue.callingMethod);

            // expect default action specified in descriptor
            Assert.AreEqual(issue.descriptor.action, action);

            // add rule with a filter.
            projectAuditorSettings.AddRule(new Rule
            {
                id     = issue.descriptor.id,
                action = Rule.Action.None,
                filter = issue.callingMethod
            });

            action = projectAuditorSettings.GetAction(issue.descriptor, issue.callingMethod);

            // issue has been muted so it should not be reported
            Assert.AreEqual(Rule.Action.None, action);
        }