本文整理汇总了Java中org.sonar.plugins.java.api.JavaFileScannerContext类的典型用法代码示例。如果您正苦于以下问题:Java JavaFileScannerContext类的具体用法?Java JavaFileScannerContext怎么用?Java JavaFileScannerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaFileScannerContext类属于org.sonar.plugins.java.api包,在下文中一共展示了JavaFileScannerContext类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeEG
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
private void computeEG() {
JavaFileScannerContext mockContext = mock(JavaFileScannerContext.class);
when(mockContext.getTree()).thenReturn(cut);
when(mockContext.getSemanticModel()).thenReturn(semanticModel);
// explicitly enable X-File analysis
this.behaviorCache = new BehaviorCache(classLoader, true);
SymbolicExecutionVisitor sev = new SymbolicExecutionVisitor(Lists.newArrayList(), behaviorCache) {
@Override
public void execute(MethodTree methodTree) {
this.context = mockContext;
super.execute(methodTree);
}
};
sev.behaviorCache.setFileContext(sev, semanticModel);
ExplodedGraphWalker.ExplodedGraphWalkerFactory egwFactory = new ExplodedGraphWalker.ExplodedGraphWalkerFactory(Collections.emptyList());
ExplodedGraphWalker walker = egwFactory.createWalker(sev.behaviorCache, semanticModel);
walker.visitMethod(methodToAnalyze, new MethodBehavior(((JavaSymbol.MethodJavaSymbol) methodToAnalyze.symbol()).completeSignature()));
this.explodedGraph = getExplodedGraph(walker);
}
开发者ID:SonarSource,项目名称:source-graph-viewer,代码行数:21,代码来源:EGDotGraph.java
示例2: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
// The call to the scan method on the root of the tree triggers the visit of the AST by this visitor
scan(context.getTree());
// For debugging purpose, you can print out the entire AST of the analyzed file
System.out.println(PrinterVisitor.print(context.getTree()));
}
开发者ID:SonarSource,项目名称:sonar-custom-rules-examples,代码行数:11,代码来源:AvoidBrandInMethodNamesRule.java
示例3: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
/**
* Implementation of the method of the JavaFileScanner interface.
* @param context Object used to attach issues to source file.
*/
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
// The call to the scan method on the root of the tree triggers the visit of the AST by this visitor
scan(context.getTree());
// For debugging purpose, you can print out the entire AST of the analyzed file
System.out.println(PrinterVisitor.print(context.getTree()));
}
开发者ID:SonarSource,项目名称:sonar-custom-rules-examples,代码行数:15,代码来源:AvoidMethodDeclarationRule.java
示例4: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
System.out.println(PrinterVisitor.print(context.getTree()));
}
开发者ID:SonarSource,项目名称:sonar-custom-rules-examples,代码行数:9,代码来源:AvoidAnnotationRule.java
示例5: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
System.out.println(context.getTree());
}
开发者ID:startupheroes,项目名称:startupheroes-checkstyle,代码行数:9,代码来源:AvoidAnnotationRule.java
示例6: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
exceptions = new ArrayList<>();
Iterables.addAll(exceptions, Splitter.on(",").trimResults().split(exceptionsCommaSeparated));
scan(context.getTree());
}
开发者ID:Axway,项目名称:sonar-rules,代码行数:8,代码来源:CaughtExceptionTouchedCheck.java
示例7: ClassVisitor
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
ClassVisitor(JavaFileScannerContext context, JavaFileScanner javaFileScanner) {
this.context = context;
this.javaFileScanner = javaFileScanner;
this.sliceAnnotationPresent = false;
this.implementedInitializableModel = false;
this.ignoreAnonymousClass = false;
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:8,代码来源:ClassVisitor.java
示例8: handleSmellAnnotation
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
private void handleSmellAnnotation(final AnnotationTree annotationTree) {
String message = "";
Integer minutes = 0;
SmellType type = null;
final Arguments arguments = annotationTree.arguments();
for (final ExpressionTree expressionTree : arguments) {
if (expressionTree.is(Tree.Kind.ASSIGNMENT)) {
final AssignmentExpressionTree aet = (AssignmentExpressionTree) expressionTree;
final String variable = ((IdentifierTree) aet.variable()).name();
switch (variable) {
case "minutes":
minutes += Integer.valueOf(((LiteralTree) aet.expression()).value());
LOGGER.debug("{} = {}", variable, minutes);
break;
case "reason":
message = extractMessage(aet.expression());
LOGGER.debug("{} = {}", variable, message);
break;
case "type":
type = SmellType.valueOf(((MemberSelectExpressionTree) aet.expression()).identifier()
.name());
break;
default:
break;
}
}
}
if (smellType().equals(type)) {
final Matcher matcher = PATTERN.matcher(message);
if (matcher.matches()) {
message = matcher.group(1);
}
reportIssue(annotationTree, message, new ArrayList<JavaFileScannerContext.Location>(), minutes);
}
}
开发者ID:QualInsight,项目名称:qualinsight-plugins-sonarqube-smell,代码行数:36,代码来源:AbstractSmellCheck.java
示例9: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
}
开发者ID:SonarSource,项目名称:sonar-custom-rules-examples,代码行数:7,代码来源:SpringControllerRequestMappingEntityRule.java
示例10: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
}
开发者ID:SonarSource,项目名称:sonar-custom-rules-examples,代码行数:6,代码来源:SecurityAnnotationMandatoryRule.java
示例11: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
}
开发者ID:Axway,项目名称:sonar-rules,代码行数:6,代码来源:UnusedNotAnnotatedPrivateFieldCheck.java
示例12: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(@Nonnull JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:6,代码来源:ModelsShouldNotUseSessionCheck.java
示例13: MethodInvocationVisitor
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
MethodInvocationVisitor(JavaFileScanner javaFileScanner, JavaFileScannerContext context) {
this.javaFileScanner = javaFileScanner;
this.context = context;
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:5,代码来源:MethodInvocationVisitor.java
示例14: SessionUsageVisitor
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
SessionUsageVisitor(JavaFileScanner javaFileScanner, JavaFileScannerContext context) {
this.javaFileScanner = javaFileScanner;
this.context = context;
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:5,代码来源:SessionUsageVisitor.java
示例15: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
scan(context.getTree());
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:6,代码来源:JcrPropertyFieldsInConstructorCheck.java
示例16: CheckUsageInConstructorVisitor
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
private CheckUsageInConstructorVisitor(JavaCheck javaCheck, JavaFileScannerContext context, final Set<String> methodParams) {
this.javaCheck = javaCheck;
this.context = context;
this.methodParams = methodParams;
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:6,代码来源:JcrPropertyFieldsInConstructorCheck.java
示例17: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext javaFileScannerContext) {
context = javaFileScannerContext;
scan(context.getTree());
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:6,代码来源:ThreadSafeFieldCheck.java
示例18: scanFile
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
@Override
public void scanFile(JavaFileScannerContext context) {
this.context = context;
gatherAppliedAnnotations(context);
scan(context.getTree());
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:7,代码来源:PreferSlingServletAnnotation.java
示例19: gatherAppliedAnnotations
import org.sonar.plugins.java.api.JavaFileScannerContext; //导入依赖的package包/类
private void gatherAppliedAnnotations(JavaFileScannerContext context) {
annotations = new CheckAppliedAnnotationsVisitor();
context.getTree().accept(annotations);
}
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:5,代码来源:PreferSlingServletAnnotation.java
注:本文中的org.sonar.plugins.java.api.JavaFileScannerContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论