mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
16 lines (15 loc) • 558 B
YAML
rules:
- id: use-count-method
message:
Looks like you need to determine the number of records. Django provides the count() method which is more efficient
than .len(). See https://docs.djangoproject.com/en/3.0/ref/models/querysets/
languages: [python]
severity: ERROR
pattern-either:
- pattern: $X.objects.$FUNC(...).len()
- pattern: $X.objects.$FUNC(...).$FILTER().len()
- pattern: $X.objects.$FUNC(...).$FILTER().$UPDATE(...).len()
metadata:
category: performance
technology:
- django