use of org.sonar.plugins.python.api.tree.Tree.Kind.CALL_EXPR in project sonar-python by SonarSource.
the class UnsafeHttpMethodsCheck method checkDjangoView.
private static void checkDjangoView(FunctionDef functionDef, SubscriptionContext ctx) {
for (Decorator decorator : functionDef.decorators()) {
if (getSymbolFromTree(decorator.expression()).filter(symbol -> symbol.fullyQualifiedName() == null || COMPLIANT_DECORATORS.contains(symbol.fullyQualifiedName())).isPresent()) {
return;
}
if (decorator.expression().is(CALL_EXPR)) {
CallExpression callExpression = (CallExpression) decorator.expression();
Symbol symbol = callExpression.calleeSymbol();
if (symbol != null && "django.views.decorators.http.require_http_methods".equals(symbol.fullyQualifiedName())) {
checkRequireHttpMethodsDecorator(ctx, callExpression);
return;
}
}
}
ctx.addIssue(functionDef.name(), MESSAGE);
}
Aggregations