private void geppettoValidation(Collection<File> moduleLocations, Diagnostic result) throws IOException { Collection<File> importedModuleLocations = null; List<Metadata> metadatas = new ArrayList<Metadata>(); for (File moduleRoot : moduleLocations) { Metadata md = getModuleMetadata(moduleRoot, result); if (md != null) metadatas.add(md); } if (result.getSeverity() == Diagnostic.ERROR) return; if (checkModuleSemantics) { File importedModulesDir = new File(getBuildDir(), IMPORTED_MODULES_ROOT); importedModuleLocations = getForge().downloadDependencies(metadatas, importedModulesDir, result); } if (importedModuleLocations == null) importedModuleLocations = Collections.emptyList(); RubyHelper.setRubyServicesFactory(JRubyServices.FACTORY); ValidationOptions options = getValidationOptions(moduleLocations, importedModuleLocations); new PPDiagnosticsSetup(complianceLevel, options.getProblemsAdvisor()) .createInjectorAndDoEMFRegistration(); getValidationService() .validate( result, getModulesDir(), options, importedModuleLocations.toArray(new File[importedModuleLocations.size()]), new NullProgressMonitor()); }
private void lintValidation(Collection<File> moduleLocations, Diagnostic result) throws IOException { PuppetLintRunner runner = PuppetLintService.getInstance().getPuppetLintRunner(); getLog().debug("Performing puppet lint validation on all modules"); if (puppetLintOptions == null) puppetLintOptions = new PuppetLintRunner.Option[0]; for (File moduleRoot : moduleLocations) { for (PuppetLintRunner.Issue issue : runner.run(moduleRoot, puppetLintOptions)) { Diagnostic diag = convertPuppetLintDiagnostic(moduleRoot, issue); if (diag != null) result.addChild(diag); } } }
@Override protected void addModules(Diagnostic diagnostic, List<Module> modules) { super.addModules(diagnostic, modules); if (cacheLocation != null && diagnostic.getSeverity() <= Diagnostic.WARNING) modules.add( new AbstractModule() { @Override protected void configure() { bind(File.class) .annotatedWith(Names.named(Forge.CACHE_LOCATION)) .toInstance(new File(cacheLocation)); } }); }
@Override protected void invoke(Diagnostic result) throws IOException { Collection<File> moduleRoots = findModuleRoots(); if (moduleRoots.isEmpty()) { result.addChild( new Diagnostic( Diagnostic.ERROR, ValidationService.GEPPETTO, "No modules found in repository")); return; } if (checkLayout || checkModuleSemantics || checkReferences) geppettoValidation(moduleRoots, result); if (enablePuppetLintValidation) lintValidation(moduleRoots, result); }