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); } }
/** * Gets the main test class. * * @return the main test class */ public String getMainTestClass() { String reportFileName = getProject().getConfiguration().getString(PHPUNIT_MAIN_TEST_FILE_PROPERTY_KEY, PHPUNIT_DEFAULT_MAIN_TEST_FILE); List<File> directories = new ArrayList<File>(getTestDirectories()); directories.addAll(getSourceDirectories()); // find the first occurrence of the test file name class in the test directories. // if no file with that name is found in test directories, check in the sources for (File directory : directories) { if (directory.isDirectory()) { File file = new File(directory.getAbsolutePath(), reportFileName); if (file.exists()) { return file.getAbsolutePath(); } } } // Otherwise return the file in the base directory File file = new File(getProject().getFileSystem().getBasedir(), reportFileName); if ( !file.exists()) { StringBuilder message = new StringBuilder("The specificied main class file cannot be found: "); message.append(reportFileName).append(". If you don't have a main test file, consider using a phpunit.xml file and do not "); message.append("use ").append(PHPUNIT_MAIN_TEST_FILE_PROPERTY_KEY).append(" property."); throw new PhpUnitConfigurationException(message.toString()); } return file.getAbsolutePath(); }
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); }
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)); }
throw new SonarException("FxCop execution failed.", e); File projectDir = fileSystem.getBasedir(); reportFiles = Collections.singleton(new File(projectDir, reportDefaultPath));
throw new SonarException("Gendarme execution failed.", e); File projectDir = fileSystem.getBasedir(); reportFiles = Collections.singleton(new File(projectDir, reportDefaultPath));