public File getTargetXMLReport() { if (conf.getBoolean(PROPERTY_GENERATE_XML)) { return new File(fileSystem.getSonarWorkingDirectory(), "checkstyle-result.xml"); } return null; }
public File getTargetXMLReport() { if (conf.getBoolean(PROPERTY_GENERATE_XML)) { return new File(fileSystem.getSonarWorkingDirectory(), "checkstyle-result.xml"); } return null; }
public File getXMLDefinitionFile() { Writer writer = null; File xmlFile = new File(fileSystem.getSonarWorkingDirectory(), "checkstyle.xml"); try { writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), CharEncoding.UTF_8); confExporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException e) { throw new SonarException("Fail to save the Checkstyle configuration to " + xmlFile.getPath(), e); } finally { IOUtils.closeQuietly(writer); } }
protected File generateConfigurationFile() { File configFile = new File(fileSystem.getSonarWorkingDirectory(), FxCopConstants.FXCOP_RULES_FILE); FileWriter writer = null; try { writer = new FileWriter(configFile); profileExporter.exportProfile(rulesProfile, writer); writer.flush(); } catch (IOException e) { throw new SonarException("Error while generating the FxCop configuration file by exporting the Sonar rules.", e); } finally { IOUtils.closeQuietly(writer); } return configFile; }
public File getXMLDefinitionFile() { Writer writer = null; File xmlFile = new File(fileSystem.getSonarWorkingDirectory(), "checkstyle.xml"); try { writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), CharEncoding.UTF_8); confExporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException e) { throw new SonarException("Fail to save the Checkstyle configuration to " + xmlFile.getPath(), e); } finally { IOUtils.closeQuietly(writer); } }
protected File generateConfigurationFile() { File configFile = new File(fileSystem.getSonarWorkingDirectory(), GendarmeConstants.GENDARME_RULES_FILE); FileWriter writer = null; try { writer = new FileWriter(configFile); profileExporter.exportProfile(rulesProfile, writer); writer.flush(); } catch (IOException e) { throw new SonarException("Error while generating the Gendarme configuration file by exporting the Sonar rules.", e); } finally { IOUtils.closeQuietly(writer); } return configFile; }
/** * @return The temporary rulest file passed to phpcs to run only sniff for the ruleset. */ public File getRuleSet() { Writer writer = null; File xmlFile = new File(project.getFileSystem().getSonarWorkingDirectory(), PHP_CODESNIFFER_TMP_RULESET_FILENAME); try { writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), CharEncoding.UTF_8); exporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException e) { throw new SonarException("Fail to export temporary ruleset file to " + xmlFile.getPath(), e); } finally { IOUtils.closeQuietly(writer); } }
protected void launchGendarme(Project project, GendarmeRunner runner, File gendarmeConfigFile) throws GendarmeException { GendarmeCommandBuilder builder = runner.createCommandBuilder(getVSSolution(), getVSProject(project)); builder.setConfigFile(gendarmeConfigFile); builder.setReportFile(new File(fileSystem.getSonarWorkingDirectory(), GendarmeConstants.GENDARME_REPORT_XML)); builder.setConfidence(configuration.getString(GendarmeConstants.GENDARME_CONFIDENCE_KEY)); builder.setSeverity("all"); builder.setSilverlightFolder(getMicrosoftWindowsEnvironment().getSilverlightDirectory()); builder.setBuildConfiguration(configuration.getString(DotNetConstants.BUILD_CONFIGURATION_KEY)); builder.setBuildPlatform(configuration.getString(DotNetConstants.BUILD_PLATFORM_KEY)); String[] assemblies = configuration.getStringArray("sonar.gendarme.assemblies"); if (assemblies == null || assemblies.length == 0) { assemblies = getAssemblyPatterns(); } else { LOG.warn("Using deprecated key 'sonar.gendarme.assemblies', you should use instead " + DotNetConstants.ASSEMBLIES_TO_SCAN_KEY); } builder.setAssembliesToScan(assemblies); runner.execute(builder, configuration.getInt(GendarmeConstants.TIMEOUT_MINUTES_KEY)); }
protected void launchFxCop(Project project, FxCopRunner runner, File fxCopConfigFile) throws FxCopException { VisualStudioSolution vsSolution = getVSSolution(); VisualStudioProject vsProject = getVSProject(project); FxCopCommandBuilder builder = runner.createCommandBuilder(vsSolution, vsProject); builder.setConfigFile(fxCopConfigFile); builder.setReportFile(new File(fileSystem.getSonarWorkingDirectory(), FxCopConstants.FXCOP_REPORT_XML)); builder.setAssembliesToScan(getAssemblyPatterns()); builder.setAssemblyDependencyDirectories(configuration.getStringArray(FxCopConstants.ASSEMBLY_DEPENDENCY_DIRECTORIES_KEY)); builder.setIgnoreGeneratedCode(configuration.getBoolean(FxCopConstants.IGNORE_GENERATED_CODE_KEY)); builder.setBuildConfiguration(configuration.getString(DotNetConstants.BUILD_CONFIGURATION_KEY)); builder.setBuildPlatform(configuration.getString(DotNetConstants.BUILD_PLATFORM_KEY)); int timeout = configuration.getInt(FxCopConstants.TIMEOUT_MINUTES_KEY); builder.setTimeoutMinutes(timeout); builder.setSilverlightFolder(getMicrosoftWindowsEnvironment().getSilverlightDirectory()); runner.execute(builder, timeout); }