/** * Gets the report directory for a given project. * * @param pom * the project definition * @return the report directory */ public File getReportsDirectory(Project project) { return project.getFileSystem().getBuildDir(); }
private void saveMeasuresForFile(final CoverageMeasuresBuilder measureBuilder, final String filePath) { LoggerFactory.getLogger(getClass()).debug("Saving measures for {}", filePath); final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), filePath), project); if (fileExists(context, objcfile)) { LoggerFactory.getLogger(getClass()).debug( "File {} was found in the project.", filePath); saveMeasures(measureBuilder, objcfile); } }
private File getReportFromProperty(Project project) { String path = settings.getString(REPORT_PATH_PROPERTY); if (StringUtils.isNotEmpty(path)) { return project.getFileSystem().resolvePath(path); } return null; }
public CSharpCPDMapping(CSharp csharp, Project project) { super(); this.csharp = csharp; this.charset = project.getFileSystem().getSourceCharset(); ignoreLiterals = project.getConfiguration().getBoolean(CSharpSquidConstants.CPD_IGNORE_LITERALS_PROPERTY, CSharpSquidConstants.CPD_IGNORE_LITERALS_DEFVALUE); }
@Override public boolean shouldExecuteOnProject(Project project) { return project.getAnalysisType().isDynamic(true) && (!project.getFileSystem().mainFiles("java").isEmpty() || !project.getFileSystem().testFiles("java").isEmpty()); }
/** * Gets the coverage report file. * * @return the coverage report file */ public File getCoverageReportFile() { Configuration configuration = getProject().getConfiguration(); return new File(getProject().getFileSystem().getBuildDir(), new StringBuilder().append(getReportFileRelativePath()) .append(File.separator) .append(configuration.getString(PHPUNIT_COVERAGE_REPORT_FILE_PROPERTY_KEY, PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE)).toString()); }
/** * Gets the source directories. * * @return the source directories */ public List<File> getSourceDirectories() { return getProject().getFileSystem().getSourceDirs(); }
private static File getReportsDirectoryFromProperty(Project project) { String path = (String) project.getProperty(CoreProperties.SUREFIRE_REPORTS_PATH_PROPERTY); if (path != null) { return project.getFileSystem().resolvePath(path); } return null; }
/** * Gets the project source folders. * * @return List<File> the source folders */ public List<File> getSourceDir() { return getProject().getFileSystem().getSourceDirs(); }
/** * @return the created working directory. */ public File createWorkingDirectory() { File target = getProject().getFileSystem().getBuildDir(); File logs = new File(target, getReportFileRelativePath()); synchronized (this) { logs.mkdirs(); } return logs; }
/** * Gets the project test source directories. * * @return List<File> A list of all test source folders */ public List<File> getTestDirectories() { return getProject().getFileSystem().getTestDirs(); }
public void analyse(final Project project, final SensorContext context) { final CoverageMeasuresPersistor measuresPersistor = new CoverageMeasuresPersistor( project, context); final String projectBaseDir = project.getFileSystem().getBasedir() .getPath(); measuresPersistor.saveMeasures(parseReportsIn(projectBaseDir)); }
public void analyse(final Project project, final SensorContext context) { final String projectBaseDir = project.getFileSystem().getBasedir() .getPath(); final OCLintParser parser = new OCLintParser(project, context); saveViolations(parseReportIn(projectBaseDir, parser), context); }
private void initResource(AuditEvent event) { if (currentResource == null) { String absoluteFilename = event.getFileName(); currentResource = JavaFile.fromAbsolutePath(absoluteFilename, project.getFileSystem().getSourceDirs(), false); } }
private CSharpConfiguration createParserConfiguration(Project project) { CSharpConfiguration conf = new CSharpConfiguration(project.getFileSystem().getSourceCharset()); conf.setIgnoreHeaderComments(project.getConfiguration().getBoolean(CSharpSquidConstants.IGNORE_HEADER_COMMENTS, true)); return conf; }
private static File getReportsDirectoryFromPluginConfiguration(Project project) { MavenPlugin plugin = MavenPlugin.getPlugin(project.getPom(), MavenSurefireUtils.GROUP_ID, MavenSurefireUtils.ARTIFACT_ID); if (plugin != null) { String path = plugin.getParameter("reportsDirectory"); if (path != null) { return project.getFileSystem().resolvePath(path); } } return null; }
private static File getReportsDirectoryFromPluginConfiguration(Project project) { MavenPlugin plugin = MavenPlugin.getPlugin(project.getPom(), MavenSurefireUtils.GROUP_ID, MavenSurefireUtils.ARTIFACT_ID); if (plugin != null) { String path = plugin.getParameter("reportsDirectory"); if (path != null) { return project.getFileSystem().resolvePath(path); } } return null; }
/** * {@inheritDoc} */ @Override public org.sonar.api.resources.File fromIOFile(File file, Project project) { if (isTestSensor()) { return org.sonar.api.resources.File.fromIOFile(file, project.getFileSystem().getTestDirs()); } return super.fromIOFile(file, project); }
/** * Gets the php file pointed by the report. * * @param report * the unit test report * @param project * the project * @return PhpFile pointed by the report */ private PhpFile getUnitTestResource(PhpUnitTestReport report, Project project) { return PhpFile.getInstance(project).fromAbsolutePath(report.getFile(), project.getFileSystem().getTestDirs(), true); }
public void analyse(Project project, SensorContext context) { this.project = project; this.context = context; Collection<SquidCheck> squidChecks = annotationCheckFactory.getChecks(); this.scanner = ObjectiveCAstScanner.create(createConfiguration(project), squidChecks.toArray(new SquidCheck[squidChecks.size()])); scanner.scanFiles(InputFileUtils.toFiles(project.getFileSystem().mainFiles(ObjectiveC.KEY))); Collection<SourceCode> squidSourceFiles = scanner.getIndex().search(new QueryByType(SourceFile.class)); save(squidSourceFiles); }