@Override public void execute(SensorContext context) { Set<String> reportPaths = loadReportPaths(); for (String reportPath : reportPaths) { File reportFile = context.fileSystem().resolvePath(reportPath); LOG.info("Parsing {}", reportFile); GenericCoverageReportParser parser = new GenericCoverageReportParser(); parser.parse(reportFile, context); LOG.info("Imported coverage data for {} files", parser.numberOfMatchedFiles()); int numberOfUnknownFiles = parser.numberOfUnknownFiles(); if (numberOfUnknownFiles > 0) { LOG.info("Coverage data ignored for " + numberOfUnknownFiles + " unknown files, including:\n" + parser.firstUnknownFiles().stream().collect(Collectors.joining("\n"))); } } }
@Override public void execute(SensorContext context) { Set<String> reportPaths = loadReportPaths(); for (String reportPath : reportPaths) { LOG.debug("Importing issues from '{}'", reportPath); Path reportFilePath = context.fileSystem().resolvePath(reportPath).toPath(); ReportParser parser = new ReportParser(reportFilePath); Report report = parser.parse(); ExternalIssueImporter issueImporter = new ExternalIssueImporter(context, report); issueImporter.execute(); } }
@Override public void execute(SensorContext context) { if (configuration.getOriginalProperties().containsKey(OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY)) { LOG.warn("Property '{}' is deprecated. Please use '{}' instead.", OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY, REPORT_PATHS_PROPERTY_KEY); } for (String reportPath : configuration.getStringArray(REPORT_PATHS_PROPERTY_KEY)) { File reportFile = context.fileSystem().resolvePath(reportPath); LOG.info("Parsing {}", reportFile); GenericTestExecutionReportParser parser = new GenericTestExecutionReportParser(testPlanBuilder); parser.parse(reportFile, context); LOG.info("Imported test execution data for {} files", parser.numberOfMatchedFiles()); int numberOfUnknownFiles = parser.numberOfUnknownFiles(); if (numberOfUnknownFiles > 0) { LOG.info("Test execution data ignored for {} unknown files, including:\n{}", numberOfUnknownFiles, parser.firstUnknownFiles().stream().collect(Collectors.joining("\n"))); } } }
public File getSonarLintXrefDir() { return fileSystem.resolvePath(config.get(Constants.SLINT_XREF).orElse("")); }
private static Optional<File> getReport(Configuration settings, FileSystem fs, String reportPathPropertyKey, String msg) { Optional<String> reportPathProp = settings.get(reportPathPropertyKey); if (reportPathProp.isPresent()) { warnUsageOfDeprecatedProperty(settings, reportPathPropertyKey); String reportPathProperty = reportPathProp.get(); File report = fs.resolvePath(reportPathProperty); if (!report.isFile()) { LOG.info(msg, reportPathProperty); } else { return Optional.of(report); } } return Optional.empty(); }
public void analyse(Project project, SensorContext context) { String path = configuration.getSurefireReportsPath(); if (path != null) { File pathFile = fileSystem.resolvePath(path); FileSystem myFS = fileSystem; collect(project, context, pathFile, myFS); } }
private final void initializePropath(Configuration config, FileSystem fileSystem) { // PROPATH definition String propathProp = config.get(Constants.PROPATH).orElse(""); LOG.info("Using PROPATH : {}", propathProp); for (String str : Splitter.on(',').trimResults().split(propathProp)) { File entry = fileSystem.resolvePath(str); LOG.debug("Adding {} to PROPATH", entry.getAbsolutePath()); propath.add(entry); } String dlcInstallDir = config.get(Constants.DLC).orElse(null); boolean dlcInPropath = config.getBoolean(Constants.PROPATH_DLC).orElse(false); if (dlcInPropath && !Strings.isNullOrEmpty(dlcInstallDir)) { File dlc = new File(dlcInstallDir); LOG.info("Adding DLC directory '{}' to PROPATH", dlc.getAbsolutePath()); propath.add(new File(dlc, "gui")); propath.add(new File(dlc, "tty")); propath.add(new File(dlc, "src")); propath.add(dlc); } }
private static Set<File> getReportPaths(SensorContext context) { Set<File> reportPaths = new HashSet<>(); Configuration settings = context.config(); FileSystem fs = context.fileSystem(); for (String reportPath : settings.getStringArray(REPORT_PATHS_PROPERTY)) { File report = fs.resolvePath(reportPath); if (!report.isFile()) { if (settings.hasKey(REPORT_PATHS_PROPERTY)) { LOG.info("JaCoCo report not found: '{}'", reportPath); } } else { reportPaths.add(report); } } getReport(settings, fs, REPORT_PATH_PROPERTY, "JaCoCo UT report not found: '{}'").ifPresent(reportPaths::add); getReport(settings, fs, IT_REPORT_PATH_PROPERTY, "JaCoCo IT report not found: '{}'").ifPresent(reportPaths::add); return reportPaths; }
LOG.debug("Parsing {} with alias {}", fileSystem.resolvePath(str), dbName); File dfFile = fileSystem.resolvePath(str); File serFile = new File(fileSystem.baseDir(), ".sonarlint/" + str.replace(':', '_').replace('\\', '_').replace('/', '_') + ".bin"); desc = DumpFileUtils.getDatabaseDescription(fileSystem.resolvePath(str), dbName); } catch (IOException caught) { LOG.error("Unable to parse " + str, caught);
@Override public void execute(SensorContext context) { Set<String> reportPaths = loadReportPaths(); for (String reportPath : reportPaths) { LOG.debug("Importing issues from '{}'", reportPath); Path reportFilePath = context.fileSystem().resolvePath(reportPath).toPath(); ReportParser parser = new ReportParser(reportFilePath); Report report = parser.parse(); ExternalIssueImporter issueImporter = new ExternalIssueImporter(context, report); issueImporter.execute(); } }
@Override public void execute(SensorContext context) { // Should we reuse existing report from CodeNarc ? if (context.settings().hasKey(GroovyPlugin.CODENARC_REPORT_PATHS)) { // Yes String[] codeNarcReportPaths = context.settings().getStringArray(GroovyPlugin.CODENARC_REPORT_PATHS); String codeNarcReportPath = context.settings().getString(GroovyPlugin.CODENARC_REPORT_PATH); if (codeNarcReportPaths.length == 0) { codeNarcReportPaths = new String[] { codeNarcReportPath }; } List<File> reports = new ArrayList<File>(); for (String path : codeNarcReportPaths) { File report = context.fileSystem().resolvePath(path); if (!report.isFile() || !report.exists()) { LOG.warn("Groovy report " + GroovyPlugin.CODENARC_REPORT_PATHS + " not found at {}", report); } else { reports.add(report); } } if (!reports.isEmpty()) { parseReport(context, reports); } } else { // No, run CodeNarc runCodeNarc(context); } }
@Override public void execute(SensorContext context) { Set<String> reportPaths = loadReportPaths(); for (String reportPath : reportPaths) { File reportFile = context.fileSystem().resolvePath(reportPath); LOG.info("Parsing {}", reportFile); GenericCoverageReportParser parser = new GenericCoverageReportParser(); parser.parse(reportFile, context); LOG.info("Imported coverage data for {} files", parser.numberOfMatchedFiles()); int numberOfUnknownFiles = parser.numberOfUnknownFiles(); if (numberOfUnknownFiles > 0) { LOG.info("Coverage data ignored for " + numberOfUnknownFiles + " unknown files, including:\n" + parser.firstUnknownFiles().stream().collect(Collectors.joining("\n"))); } } }
@Override public void execute(SensorContext context) { if (configuration.getOriginalProperties().containsKey(OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY)) { LOG.warn("Property '{}' is deprecated. Please use '{}' instead.", OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY, REPORT_PATHS_PROPERTY_KEY); } for (String reportPath : configuration.getStringArray(REPORT_PATHS_PROPERTY_KEY)) { File reportFile = context.fileSystem().resolvePath(reportPath); LOG.info("Parsing {}", reportFile); GenericTestExecutionReportParser parser = new GenericTestExecutionReportParser(testPlanBuilder); parser.parse(reportFile, context); LOG.info("Imported test execution data for {} files", parser.numberOfMatchedFiles()); int numberOfUnknownFiles = parser.numberOfUnknownFiles(); if (numberOfUnknownFiles > 0) { LOG.info("Test execution data ignored for {} unknown files, including:\n{}", numberOfUnknownFiles, parser.firstUnknownFiles().stream().collect(Collectors.joining("\n"))); } } }
filePath = filePath.replace(baseDirCanonicalPath, baseDirPath); File matchingFile = fs.resolvePath(filePath); InputFile inputFile = null;