private void Analyze(TOptions analyzeOptions, AggregatingLogger logger) { // 0. Log analysis initiation logger.AnalysisStarted(); // 1. Create context object to pass to skimmers. The logger // and configuration objects are common to all context // instances and will be passed on again for analysis. this.rootContext = CreateContext(analyzeOptions, logger, RuntimeErrors); // 2. Perform any command line argument validation beyond what // the command line parser library is capable of. ValidateOptions(this.rootContext, analyzeOptions); // 3. Create our configuration property bag, which will be // shared with all rules during analysis //ConfigureFromOptions(this.rootContext, analyzeOptions); // 4. Produce a comprehensive set of analysis targets HashSet <string> targets = CreateTargetsSet(analyzeOptions); // 5. Proactively validate that we can locate and // access all analysis targets. Helper will return // a list that potentially filters out files which // did not exist, could not be accessed, etc. targets = ValidateTargetsExist(this.rootContext, targets); // 6. Initialize report file, if configured. InitializeOutputFile(analyzeOptions, this.rootContext, targets); // 7. Instantiate skimmers. HashSet <ISkimmer <TContext> > skimmers = CreateSkimmers(this.rootContext); // 8. Initialize configuration. This step must be done after initializing // the skimmers, as rules define their specific context objects and // so those assemblies must be loaded. InitializeConfiguration(analyzeOptions, this.rootContext); // 9. Initialize skimmers. Initialize occurs a single time only. This // step needs to occurs after initializing configuration in order // to allow command-line override of rule settings skimmers = InitializeSkimmers(skimmers, this.rootContext); // 10. Run all analysis AnalyzeTargets(analyzeOptions, skimmers, this.rootContext, targets); // 11. For test purposes, raise an unhandled exception if indicated if (RaiseUnhandledExceptionInDriverCode) { throw new InvalidOperationException(this.GetType().Name); } }
private void Analyze(TOptions analyzeOptions, AggregatingLogger logger) { // 0. Log analysis initiation logger.AnalysisStarted(); // 1. Create context object to pass to skimmers. The logger // and configuration objects are common to all context // instances and will be passed on again for analysis. _rootContext = CreateContext(analyzeOptions, logger, RuntimeErrors); // 2. Perform any command line argument validation beyond what // the command line parser library is capable of. ValidateOptions(analyzeOptions, _rootContext); // 5. Initialize report file, if configured. InitializeOutputFile(analyzeOptions, _rootContext); // 6. Instantiate skimmers. ISet <Skimmer <TContext> > skimmers = CreateSkimmers(analyzeOptions, _rootContext); // 7. Initialize configuration. This step must be done after initializing // the skimmers, as rules define their specific context objects and // so those assemblies must be loaded. InitializeConfiguration(analyzeOptions, _rootContext); // 8. Initialize skimmers. Initialize occurs a single time only. This // step needs to occurs after initializing configuration in order // to allow command-line override of rule settings skimmers = InitializeSkimmers(skimmers, _rootContext); // 9. Run all multi-threaded analysis operations. AnalyzeTargets(analyzeOptions, _rootContext, skimmers); // 10. For test purposes, raise an unhandled exception if indicated if (RaiseUnhandledExceptionInDriverCode) { throw new InvalidOperationException(GetType().Name); } }