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

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

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

File.setLanguage介绍

[英]Sets the language of the file
[中]设置文件的语言

代码示例

代码示例来源: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, Language language, boolean unitTest) {
 File file = create(relativePathFromBasedir);
 file.setLanguage(language);
 if (unitTest) {
  file.setQualifier(Qualifiers.UNIT_TEST_FILE);
 }
 return file;
}

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

private void saveMeasures(Collection<SourceCode> sourceFiles) {
 for (SourceCode squidFileCode : sourceFiles) {
  SourceFile squidFile = (SourceFile) squidFileCode;
  /* Create the sonar file */
  File sonarFile = File.fromIOFile(new java.io.File(squidFile.getKey()), project);
  sonarFile.setLanguage(cSharp);
  /* Fill the resource bridge API that can be used by other C# plugins to map logical resources to physical ones */
  cSharpResourcesBridge.indexFile(squidFile, sonarFile);
  /* No Sonar */
  noSonarFilter.addResource(sonarFile, squidFile.getNoSonarTagLines());
  /* Classes complexity distribution */
  saveClassesComplexityDistribution(sonarFile, squidFile);
  /* Methods complexity distribution */
  saveMethodsComplexityDistribution(sonarFile, squidFile);
  /* Check messages */
  saveViolations(squidFile, sonarFile);
  /* Metrics at the file level */
  saveMeasures(sonarFile, squidFile);
 }
 // and lock everything to prevent future modifications
 LOG.debug("Locking the C# Resource Bridge and the Sonar Index: future modifications won't be possible.");
 cSharpResourcesBridge.lock();
 resourceCreationLock.lock();
}

相关文章