Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

claude: Move Python-only code quality rules into a path-scoped rule.

Evy Kassirer0438a135c395
diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md
index bffb70543f4..b7b7df179b8 100644
--- a/.claude/CLAUDE.md
+++ b/.claude/CLAUDE.md
@@ -177,6 +177,9 @@ automatically when you work on frontend JS/TS and template files).
CSS rules can be found in `.claude/rules/css.md` (loaded
automatically when you work on CSS files).
+Python rules can be found in `.claude/rules/python.md` (loaded
+automatically when you work on .py files).
+
See: https://zulip.readthedocs.io/en/latest/contributing/code-style.html
## Commit Discipline
@@ -289,24 +292,6 @@ faster and easier to just plan and write them well the first time.
## What Not To Do
-### Code Quality:
-
-- Don't use `Any` type annotations without comments justifying it.
-- Don't use `cursor.execute()` with string formatting (SQL injection risk)
-- Don't use `.extra()` in Django without careful review and commenting
-- Don't create N+1 query patterns:
-
- ```python
- # BAD
- for bar in bars:
- foo = Foo.objects.get(id=bar.foo_id)
-
- # GOOD
- foos = {f.id: f for f in Foo.objects.filter(id__in=[b.foo_id for b in bars])}
- ```
-
-### Process:
-
- Always check if you're working on top of the latest upstream/main, and
fetch + rebase when starting a project so you're not using a stale branch.
If you're continuing a project, start by rebasing, resolving merge
diff --git a/.claude/rules/python.md b/.claude/rules/python.md
new file mode 100644
index 00000000000..0f36559b1c4
--- /dev/null
+++ b/.claude/rules/python.md
@@ -0,0 +1,20 @@
+---
+paths:
+ - "**/*.py"
+---
+
+# Python Code
+
+- Don't use `Any` type annotations without comments justifying it.
+- Don't use `cursor.execute()` with string formatting (SQL injection risk)
+- Don't use `.extra()` in Django without careful review and commenting
+- Don't create N+1 query patterns:
+
+ ```python
+ # BAD
+ for bar in bars:
+ foo = Foo.objects.get(id=bar.foo_id)
+
+ # GOOD
+ foos = {f.id: f for f in Foo.objects.filter(id__in=[b.foo_id for b in bars])}
+ ```