org.sonar.api.resources.Project.getFileSystem()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.sonar.api.resources.Project.getFileSystem()方法的一些代码示例,展示了Project.getFileSystem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getFileSystem()方法的具体详情如下:
包路径:org.sonar.api.resources.Project
类名称:Project
方法名:getFileSystem

Project.getFileSystem介绍

[英]Note: it's better to get a reference on ProjectFileSystem as an IoC dependency (constructor parameter)
[中]注意:最好在ProjectFileSystem上获得一个作为IoC依赖项的引用(构造函数参数)

代码示例

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet/sonar-plugin-dotnet-core

/**
 * 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();
}

代码示例来源:origin: octo-technology/sonar-objective-c

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);
  }
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-clover-plugin

private File getReportFromProperty(Project project) {
 String path = settings.getString(REPORT_PATH_PROPERTY);
 if (StringUtils.isNotEmpty(path)) {
  return project.getFileSystem().resolvePath(path);
 }
 return null;
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet.csharp/sonar-csharp-squid-plugin

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);
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/sonar-surefire-plugin

@Override
public boolean shouldExecuteOnProject(Project project) {
 return project.getAnalysisType().isDynamic(true)
   && (!project.getFileSystem().mainFiles("java").isEmpty() || !project.getFileSystem().testFiles("java").isEmpty());
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * 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());
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * Gets the source directories.
 * 
 * @return the source directories
 */
public List<File> getSourceDirectories() {
 return getProject().getFileSystem().getSourceDirs();
}

代码示例来源:origin: org.codehaus.sonar.plugins/sonar-surefire-plugin

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;
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * Gets the project source folders.
 * 
 * @return List<File> the source folders
 */
public List<File> getSourceDir() {
 return getProject().getFileSystem().getSourceDirs();
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * @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;
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * Gets the project test source directories.
 * 
 * @return List<File> A list of all test source folders
 */
public List<File> getTestDirectories() {
 return getProject().getFileSystem().getTestDirs();
}

代码示例来源:origin: octo-technology/sonar-objective-c

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));
}

代码示例来源:origin: octo-technology/sonar-objective-c

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);
}

代码示例来源:origin: org.codehaus.sonar.plugins/sonar-checkstyle-plugin

private void initResource(AuditEvent event) {
 if (currentResource == null) {
  String absoluteFilename = event.getFileName();
  currentResource = JavaFile.fromAbsolutePath(absoluteFilename, project.getFileSystem().getSourceDirs(), false);
 }
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet.csharp/sonar-csharp-squid-plugin

private CSharpConfiguration createParserConfiguration(Project project) {
 CSharpConfiguration conf = new CSharpConfiguration(project.getFileSystem().getSourceCharset());
 conf.setIgnoreHeaderComments(project.getConfiguration().getBoolean(CSharpSquidConstants.IGNORE_HEADER_COMMENTS, true));
 return conf;
}

代码示例来源:origin: org.codehaus.sonar.plugins/sonar-surefire-plugin

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;
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/sonar-surefire-plugin

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;
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet/sonar-dotnet-plugin

/**
 * {@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);
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * 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);
}

代码示例来源:origin: octo-technology/sonar-objective-c

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);
}

相关文章