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

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

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

File.getEffectiveKey介绍

暂无

代码示例

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

@Override
 public void scanFile(JavaFileScannerContext context) {
  Preconditions.checkNotNull(sensorContext);
  JavaFilesCache javaFilesCache = new JavaFilesCache();
  javaFilesCache.scanFile(context);
  org.sonar.api.resources.File currentResource = org.sonar.api.resources.File.fromIOFile(context.getFile(), project);
  if (currentResource == null) {
   throw new IllegalStateException("resource not found : " + context.getFileKey());
  }
  resourceMapping.addResource(currentResource, context.getFileKey());
  for (Map.Entry<String, File> classIOFileEntry : javaFilesCache.getResourcesCache().entrySet()) {
   resourcesByClass.put(classIOFileEntry.getKey(), currentResource);
   if (context.getFileKey() != null) {
    sourceFileByClass.put(classIOFileEntry.getKey(), context.getFileKey());
   }
  }
  methodStartLines.putAll(javaFilesCache.getMethodStartLines());
  org.sonar.api.resources.File indexedResource = sensorContext.getResource(currentResource);
  if (indexedResource != null && javaFilesCache.hasSuppressWarningLines()) {
   suppressWarningsFilter.addComponent(indexedResource.getEffectiveKey(), javaFilesCache.getSuppressWarningLines());
  }
 }
}

代码示例来源:origin: org.sonarsource.java/java-squid

@Override
 public void scanFile(JavaFileScannerContext context) {
  Preconditions.checkNotNull(sensorContext);
  JavaFilesCache javaFilesCache = new JavaFilesCache();
  javaFilesCache.scanFile(context);
  InputFile inputFile = fs.inputFile(fs.predicates().is(context.getFile()));
  org.sonar.api.resources.File currentResource = (org.sonar.api.resources.File) sensorContext.getResource(inputFile);
  if (currentResource == null) {
   throw new IllegalStateException("resource not found : " + context.getFileKey());
  }
  resourceMapping.addResource(currentResource, context.getFileKey());
  for (Map.Entry<String, File> classIOFileEntry : javaFilesCache.getResourcesCache().entrySet()) {
   resourcesByClass.put(classIOFileEntry.getKey(), currentResource);
   if (context.getFileKey() != null) {
    sourceFileByClass.put(classIOFileEntry.getKey(), context.getFileKey());
   }
  }
  methodStartLines.putAll(javaFilesCache.getMethodStartLines());
  if (javaFilesCache.hasSuppressWarningLines()) {
   suppressWarningsFilter.addComponent(currentResource.getEffectiveKey(), javaFilesCache.getSuppressWarningLines());
  }
 }
}

相关文章