From 0cc40605b089f64f6aec637e561dacdbd344094a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 22 Mar 2024 13:22:00 -0700 Subject: [PATCH] semgrep: Broaden select_related() and prefetch_related() rules. Signed-off-by: Anders Kaseorg --- tools/semgrep-py.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/semgrep-py.yml b/tools/semgrep-py.yml index 371d5828c0..2bee890dde 100644 --- a/tools/semgrep-py.yml +++ b/tools/semgrep-py.yml @@ -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]