org.sonar.api.resources.File.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(161)

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

File.<init>介绍

暂无

代码示例

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

public Resource getUnitTestResource(String filename) {

    org.sonar.api.resources.File sonarFile = new org.sonar.api.resources.File(filename);
    sonarFile.setQualifier(Qualifiers.UNIT_TEST_FILE);
    return sonarFile;
  }
}

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

/**
* Creates a File from an io.file and a list of sources directories
* @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)}
*/
@Deprecated
@CheckForNull
public static File fromIOFile(java.io.File file, List<java.io.File> sourceDirs) {
 PathResolver.RelativePath relativePath = new PathResolver().relativePath(sourceDirs, file);
 if (relativePath != null) {
  return new File(relativePath.path());
 }
 return null;
}

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

/**
 * Internal use only.
 * @deprecated since 5.1 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)}
 */
@Deprecated
public static File create(String relativePathFromBasedir) {
 File file = new File();
 String normalizedPath = normalize(relativePathFromBasedir);
 file.setKey(normalizedPath);
 file.setPath(normalizedPath);
 String directoryPath;
 if (normalizedPath != null && normalizedPath.contains(Directory.SEPARATOR)) {
  directoryPath = StringUtils.substringBeforeLast(normalizedPath, Directory.SEPARATOR);
  file.filename = StringUtils.substringAfterLast(normalizedPath, Directory.SEPARATOR);
 } else {
  directoryPath = Directory.SEPARATOR;
  file.filename = normalizedPath;
 }
 file.parent = Directory.create(directoryPath);
 return file;
}

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

@Override
public void analyse(Project module, org.sonar.api.batch.SensorContext context) {
 createIssueOnDir(new Directory(""));
 File src = module.getFileSystem().getSourceDirs().get(0);
 for (File f : fileSystem.files(FileQuery.onMain().onLanguage(Xoo.KEY))) {
  String relativePathFromSourceDir = new PathResolver().relativePath(src, f);
  org.sonar.api.resources.File sonarFile = new org.sonar.api.resources.File(relativePathFromSourceDir);
  Issuable issuable = perspectives.as(Issuable.class, sonarFile);
  issuable.addIssue(issuable.newIssueBuilder()
   .ruleKey(RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY))
   .message("Issue created using deprecated API")
   .line(1)
   .build());
  sonarFile = context.getResource(sonarFile);
  Directory parent = sonarFile.getParent();
  createIssueOnDir(parent);
 }
}

相关文章