semgrep: Broaden select_related() and prefetch_related() rules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-03-22 13:22:00 -07:00 committed by Alex Vandiver
parent a20b454ebb
commit 0cc40605b0
1 changed files with 2 additions and 2 deletions

View File

@ -45,8 +45,8 @@ rules:
- id: dont-use-empty-select_related
pattern-either:
- pattern: $X.objects. ... .select_related()
- pattern: $X.objects. ... .prefetch_related()
- pattern: $X.select_related()
- pattern: $X.prefetch_related()
message: |
Do not use a bare '.select_related()' or '.prefetch_related()', which can join many more tables than expected. Specify the relations to follow explicitly.
languages: [python]