private void exportResults(String exportPath) { File exportFile = new File(fileSystem.workDir(), exportPath); LOG.info("Export issues to {}", exportFile.getAbsolutePath()); try (FileOutputStream fos = new FileOutputStream(exportFile)) { writeJson(new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))); } catch (IOException e) { throw new IllegalStateException("Unable to write report results in file " + exportFile.getAbsolutePath(), e); } }
public File workDir() { return fs.workDir(); }
public File getTargetXMLReport() { return new File(fileSystem.workDir(), "findbugs-result.xml"); }
private File writeToWorkingDirectory(String content, String fileName) throws IOException { File file = new File(fileSystem.workDir(), fileName); Files.write(content, file, Charsets.UTF_8); return file; }
private void exportResults(String exportPath) { File exportFile = new File(fileSystem.workDir(), exportPath); LOG.info("Export issues to {}", exportFile.getAbsolutePath()); try (FileOutputStream fos = new FileOutputStream(exportFile)) { writeJson(new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))); } catch (IOException e) { throw new IllegalStateException("Unable to write report results in file " + exportFile.getAbsolutePath(), e); } }
private void exportResults(String exportPath) { File exportFile = new File(fileSystem.workDir(), exportPath); LOG.info("Export issues to " + exportFile.getAbsolutePath()); try (Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(exportFile), Charsets.UTF_8))) { writeJson(output); } catch (IOException e) { throw new IllegalStateException("Unable to write report results in file " + exportFile.getAbsolutePath(), e); } }
private void exportResults(String exportPath) { File exportFile = new File(fileSystem.workDir(), exportPath); LOG.info("Export issues to {}", exportFile.getAbsolutePath()); try (Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(exportFile), StandardCharsets.UTF_8))) { writeJson(output); } catch (IOException e) { throw new IllegalStateException("Unable to write report results in file " + exportFile.getAbsolutePath(), e); } }
private Properties loadReportTaskProps() { File reportTaskFile = new File(fileSystem.workDir(), "report-task.txt"); Properties reportTaskProps = new Properties(); try { reportTaskProps.load(Files.newReader(reportTaskFile, StandardCharsets.UTF_8)); } catch (IOException e) { throw new IllegalStateException("Unable to load properties from file " + reportTaskFile, e); } return reportTaskProps; }
public File getTargetXmlReport() { return conf.getBoolean(PROPERTY_GENERATE_XML) .map(aBoolean -> new File(fileSystem.workDir(), "checkstyle-result.xml")) .orElse(null); }
@VisibleForTesting File saveIncludeConfigXml() throws IOException { StringWriter conf = new StringWriter(); exportProfile(activeRules, conf); File file = new File(fileSystem.workDir(), "findbugs-include.xml"); FileUtils.write(file, conf.toString(), CharEncoding.UTF_8); return file; }
private File copyLib(String name) { InputStream input = null; try { input = getClass().getResourceAsStream(name); File dir = new File(fileSystem.workDir(), "findbugs"); FileUtils.forceMkdir(dir); File target = new File(dir, name); FileUtils.copyInputStreamToFile(input, target); return target; } catch (IOException e) { throw new IllegalStateException("Fail to extract Findbugs dependency", e); } finally { IOUtils.closeQuietly(input); } }
public File getXmlDefinitionFile() { final File xmlFile = new File(fileSystem.workDir(), "checkstyle.xml"); try (Writer writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), StandardCharsets.UTF_8)) { confExporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException ex) { throw new IllegalStateException("Fail to save the Checkstyle configuration to " + xmlFile.getPath(), ex); } }
public FindbugsSensor(ActiveRules activeRules, SensorContext sensorContext, FindbugsExecutor executor, JavaResourceLocator javaResourceLocator, FileSystem fs, ByteCodeResourceLocator byteCodeResourceLocator) { this.activeRules = activeRules; this.sensorContext = sensorContext; this.executor = executor; this.javaResourceLocator = javaResourceLocator; this.byteCodeResourceLocator = byteCodeResourceLocator; this.fs = fs; registerRepositories(REPOS); this.classMappingFile = new File(fs.workDir(), "class-mapping.csv"); try { this.classMappingWriter = new PrintWriter(new FileOutputStream(classMappingFile)); } catch (FileNotFoundException e) { } }
UastGeneratorWrapper(SensorContext sensorContext) throws IOException { this(new DefaultCommand(sensorContext.fileSystem().workDir())); }
public File workDir() { ProjectDefinition current = projectDefinition; if(current == null) { return fs.workDir(); } while (current.getParent() != null) { current = current.getParent(); } return current.getWorkDir(); }
public File workDir() { ProjectDefinition current = projectDefinition; if(current == null) { return fs.workDir(); } while (current.getParent() != null) { current = current.getParent(); } return current.getWorkDir(); }
@Override public void analyse(Project project, SensorContext context) { File baseDir = fileSystem.baseDir(); File reportUTs = pathResolver.relativeFile(baseDir, configuration.getReportPath()); File reportITs = pathResolver.relativeFile(baseDir, configuration.getItReportPath()); File reportOverall = new File(fileSystem.workDir(), JACOCO_OVERALL); reportOverall.getParentFile().mkdirs(); mergeReports(reportOverall, reportUTs, reportITs); new OverallAnalyzer(reportOverall, perspectives).analyse(project, context); }
public SonarLintInputProject(FileSystem fs) { super(ProjectDefinition.create().setBaseDir(fs.baseDir()).setWorkDir(fs.workDir())); }
@Override public void execute(SensorContext context) { File reportUTs = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getReportPath()); File reportITs = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getItReportPath()); if (shouldExecuteOnProject()) { File reportOverall = new File(context.fileSystem().workDir(), JACOCO_OVERALL); reportOverall.getParentFile().mkdirs(); JaCoCoReportMerger.mergeReports(reportOverall, reportUTs, reportITs); new OverallAnalyzer(reportOverall).analyse(context); } }
private void runCodeNarc(SensorContext context) { LOG.info("Executing CodeNarc"); File workdir = new File(context.fileSystem().workDir(), "codenarc"); prepareWorkDir(workdir); File codeNarcConfiguration = new File(workdir, "profile.xml"); exportCodeNarcConfiguration(codeNarcConfiguration); CodeNarcRunner runner = new CodeNarcRunner(); runner.setRuleSetFiles("file:" + codeNarcConfiguration.getAbsolutePath()); CodeNarcSourceAnalyzer analyzer = new CodeNarcSourceAnalyzer(groovyFileSystem.sourceInputFiles()); runner.setSourceAnalyzer(analyzer); runner.execute(); reportViolations(context, analyzer.getViolationsByFile()); }