From 0093480c4b2c499b7edb9a1f5e0c4d2d83127249 Mon Sep 17 00:00:00 2001 From: Koen van der Veen <7250009+koenvanderveen@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:07:40 +0100 Subject: [PATCH] docs: name each check of a condition with more than two checks --- dev-guidelines/guidelines.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dev-guidelines/guidelines.md b/dev-guidelines/guidelines.md index 675abfb498f..491eca97807 100644 --- a/dev-guidelines/guidelines.md +++ b/dev-guidelines/guidelines.md @@ -176,6 +176,15 @@ Integration tests need OAuth tokens in the `credentials/` folder, and the env va - Prefer simple code that is easy to read. Avoid deeply nested dict and list comprehensions with complicated control flow. +- When a condition combines more than two checks, give each check a variable that says what it + checks, then combine the variables: + + ```python + has_file = path in self.file_hashes + in_immutable_collection = any(path.is_relative_to(p) for p in immutable_subpaths) + denied = self.freeze_private_datasets and has_file and in_immutable_collection + ``` + - Put a repeated or magic value in a module-level constant. - Build strings with f-strings. - Keep imports at the top of the file where possible, in this order: standard library,