本文整理了Java中org.sonar.api.resources.File.getEffectiveKey()
方法的一些代码示例,展示了File.getEffectiveKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.getEffectiveKey()
方法的具体详情如下:
包路径:org.sonar.api.resources.File
类名称: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());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!