public int ReturnCode => _analysisReportInProgress.IsFailure() ? -1 : 0; //bug UI implementation leak public static Analysis PrepareFor(IEnumerable <CsharpProjectDto> csharpProjectDtos, INScanSupport support) { return(new Analysis(new AnalysisReportInProgress(new RuleReportFactory()), DependencyAnalysis.PrepareFor(csharpProjectDtos, support), ProjectAnalysis.PrepareFor(csharpProjectDtos), ProjectNamespacesAnalysis.PrepareFor(csharpProjectDtos), new ResultBuilderFactory())); }
public void ShouldAddRuleToRuleSet() { //GIVEN var ruleSet = Substitute.For <IPathRuleSet>(); var ruleFactory = Substitute.For <IDependencyBasedRuleFactory>(); var analysis = new DependencyAnalysis(Any.Instance <ISolutionForDependencyPathBasedRules>(), ruleSet, ruleFactory); var dto1 = Any.Instance <IndependentRuleComplementDto>(); var dto2 = Any.Instance <IndependentRuleComplementDto>(); var dto3 = Any.Instance <IndependentRuleComplementDto>(); var projectScopedRuleUnionDtos = new List <DependencyPathBasedRuleUnionDto> { DependencyPathBasedRuleUnionDto.With(dto1), DependencyPathBasedRuleUnionDto.With(dto2), DependencyPathBasedRuleUnionDto.With(dto3) }; var rule1 = Any.Instance <IDependencyRule>(); var rule2 = Any.Instance <IDependencyRule>(); var rule3 = Any.Instance <IDependencyRule>(); ruleFactory.CreateDependencyRuleFrom(dto1).Returns(rule1); ruleFactory.CreateDependencyRuleFrom(dto2).Returns(rule2); ruleFactory.CreateDependencyRuleFrom(dto3).Returns(rule3); //WHEN analysis.Add(projectScopedRuleUnionDtos); //THEN Received.InOrder(() => { ruleSet.Add(rule1); ruleSet.Add(rule2); ruleSet.Add(rule3); }); }
List <string> depAnalysis(List <string> files) { List <string> depType = new List <string>(); List <List <Elem> > allTables = new List <List <Elem> >(); List <string> checkFiles = new List <string>(); List <string> tableType = new List <string>(); checkFiles = filePath(files); allTables = TypeAnalysis.analyse(checkFiles); List <CsNode <string, string> > nodes = DependencyAnalysis.getTables(allTables, checkFiles); depType = Display.showDependences(nodes); return(depType); }
//---------< get the depedency table for selected files >------------ List <string> getDependency(List <string> files) { List <CsNode <string, string> > nodes = new List <CsNode <string, string> >(); List <List <Elem> > dependency = new List <List <Elem> >(); List <string> selectedfiles = new List <string>(); List <string> dependencyList = new List <string>(); selectedfiles = getfilePath(files); TypeAnalysis typeAnalysisObj = new TypeAnalysis(selectedfiles); dependency = typeAnalysisObj.generateTypeTable(); nodes = DependencyAnalysis.GetDependency(dependency, selectedfiles); dependencyList = Display.showDependencies(nodes); return(dependencyList); }
//---------< get the scc for the selected files >---------------- List <string> getscc(List <string> files) { List <CsNode <string, string> > nodes = new List <CsNode <string, string> >(); List <List <Elem> > dependency = new List <List <Elem> >(); List <string> selectedfiles = new List <string>(); List <string> dependencyList = new List <string>(); selectedfiles = getfilePath(files); TypeAnalysis typeAnalysisObj = new TypeAnalysis(selectedfiles); dependency = typeAnalysisObj.generateTypeTable(); nodes = DependencyAnalysis.GetDependency(dependency, selectedfiles); dependencyList = Display.showDependencies(nodes); GraphTest gt = new GraphTest(); List <string> sccNodes1 = gt.Tarjan(nodes); List <string> sccNodes = Display.showsccGraph(sccNodes1); return(sccNodes); }
List <string> strongComponentList(List <string> files) { List <string> depType = new List <string>(); List <List <Elem> > allTables = new List <List <Elem> >(); List <string> checkFiles = new List <string>(); List <string> tableType = new List <string>(); List <string> scc = new List <string>(); List <string> sc = new List <string>(); List <string> SCC = new List <string>(); List <CsNode <string, string> > nodes = new List <CsNode <string, string> >(); checkFiles = filePath(files); allTables = TypeAnalysis.analyse(checkFiles); nodes = DependencyAnalysis.getTables(allTables, checkFiles); TestGraph t = new TestGraph(); scc = t.tarjan(nodes); SCC = Display.showSCC(scc); return(SCC); }
public void ShouldPrepareCachesAndApplyTheRulesetToSolution() { //GIVEN var ruleSet = Any.Instance <IPathRuleSet>(); var solution = Substitute.For <ISolutionForDependencyPathBasedRules>(); var projectAnalysis = new DependencyAnalysis(solution, ruleSet, Any.Instance <IDependencyBasedRuleFactory>()); var analysisReportInProgress = Any.Instance <IAnalysisReportInProgress>(); //WHEN projectAnalysis.Perform(analysisReportInProgress); //THEN Received.InOrder(() => { solution.ResolveAllProjectsReferences(); solution.BuildDependencyPathCache(); solution.Check(ruleSet, analysisReportInProgress); }); }
// public List<List<string>> static getTypeTable() static void Main(string[] args) { List <CsNode <string, string> > nodes = new List <CsNode <string, string> >(); List <List <Elem> > listOfTables = new List <List <Elem> >(); Console.WriteLine("<------------------------------ Demonstrating Project 3 : Type-Based Package Dependency Analysis ----------------------->"); Console.WriteLine(); ShowCommandLine(args); List <string> files = ProcessCommandline(args); TypeAnalysis typeAnalysisObj = new TypeAnalysis(files); listOfTables = typeAnalysisObj.generateTypeTable(); nodes = DependencyAnalysis.GetDependency(listOfTables, files); GraphTest gt = new GraphTest(); List <string> sccNodes = gt.Tarjan(nodes); displayRequirement1(listOfTables); displayRequirement2(nodes); displayRequirement3(sccNodes); Console.ReadLine(); }
static void Main(string[] args) { List <CsNode <string, string> > nodes; List <string> scc = new List <string>(); List <List <Elem> > allTables = new List <List <Elem> >(); Console.WriteLine("********Type-Based Package Dependency Analysis********\n\n"); Console.WriteLine("Demonstrating Requirement 4:"); Console.WriteLine("--------------------------------------------------------------------"); ShowCommandLine(args); List <string> files = ProcessCommandline(args); allTables = TypeAnalysis.analyse(files); tableType = displayRequirement1(allTables); nodes = DependencyAnalysis.getTables(allTables, files); displayRequirement2(nodes); TestGraph t = new TestGraph(); scc = t.tarjan(nodes); displayRequirement3(scc); Console.Read(); }
public void SetUp() { _analysis = new DependencyAnalysis(); }