Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): gate PLC0415 (no inline imports) (#57494)

Raúl Negrón-Oterob50005e6963c
diff --git a/products/ruff.toml b/products/ruff.toml
index 9ba3119e88a3..5177f77c6f90 100644
--- a/products/ruff.toml
+++ b/products/ruff.toml
@@ -42,3 +42,52 @@ extend-select = ["ANN001", "ANN201", "ANN202", "ANN204"]
"tasks/backend/**" = ["ANN"]
"visual_review/backend/**" = ["ANN"]
"workflows/backend/**" = ["ANN"]
+
+# PLC0415 exemptions. New products not listed here are enforced.
+# Run `ruff check <product>/ --select PLC0415 --statistics` before removing an entry.
+"access_control/**" = ["PLC0415"]
+"actions/**" = ["PLC0415"]
+"alerts/**" = ["PLC0415"]
+"analytics_platform/**" = ["PLC0415"]
+"batch_exports/**" = ["PLC0415"]
+"business_knowledge/**" = ["PLC0415"]
+"cdp/**" = ["PLC0415"]
+"conversations/**" = ["PLC0415"]
+"customer_analytics/**" = ["PLC0415"]
+"dashboards/**" = ["PLC0415"]
+"data_modeling/**" = ["PLC0415"]
+"data_warehouse/**" = ["PLC0415"]
+"deployments/**" = ["PLC0415"]
+"desktop_recordings/**" = ["PLC0415"]
+"early_access_features/**" = ["PLC0415"]
+"endpoints/**" = ["PLC0415"]
+"error_tracking/**" = ["PLC0415"]
+"experiments/**" = ["PLC0415"]
+"feature_flags/**" = ["PLC0415"]
+"growth/**" = ["PLC0415"]
+"legal_documents/**" = ["PLC0415"]
+"links/**" = ["PLC0415"]
+"live_debugger/**" = ["PLC0415"]
+"llm_analytics/**" = ["PLC0415"]
+"logs/**" = ["PLC0415"]
+"marketing_analytics/**" = ["PLC0415"]
+"mcp_analytics/**" = ["PLC0415"]
+"mcp_store/**" = ["PLC0415"]
+"messaging/**" = ["PLC0415"]
+"notebooks/**" = ["PLC0415"]
+"notifications/**" = ["PLC0415"]
+"posthog_ai/**" = ["PLC0415"]
+"product_analytics/**" = ["PLC0415"]
+"product_tours/**" = ["PLC0415"]
+"query_performance_ai/**" = ["PLC0415"]
+"replay_vision/**" = ["PLC0415"]
+"revenue_analytics/**" = ["PLC0415"]
+"signals/**" = ["PLC0415"]
+"slack_app/**" = ["PLC0415"]
+"streamlit_apps/**" = ["PLC0415"]
+"surveys/**" = ["PLC0415"]
+"tasks/**" = ["PLC0415"]
+"tracing/**" = ["PLC0415"]
+"user_interviews/**" = ["PLC0415"]
+"visual_review/**" = ["PLC0415"]
+"web_analytics/**" = ["PLC0415"]
diff --git a/pyproject.toml b/pyproject.toml
index d43e6cb74dda..7b10f7fc59df 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -332,6 +332,7 @@ select = [
"E",
"F",
"I",
+ "PLC0415",
"RUF005",
"RUF013",
"RUF015",
@@ -355,6 +356,18 @@ select = [
# Not portable to explicit re-exports without losing the settings-loading semantics.
"posthog/settings/**" = ["F403", "F405"]
+# PLC0415 exemptions. products/ and services/llm-gateway/ have their own ruff configs.
+# Run `ruff check <path> --select PLC0415 --statistics` before removing an entry.
+".github/**" = ["PLC0415"]
+"bin/**" = ["PLC0415"]
+"common/**" = ["PLC0415"]
+"ee/**" = ["PLC0415"]
+"manage.py" = ["PLC0415"]
+"posthog/**" = ["PLC0415"]
+"scripts/**" = ["PLC0415"]
+"services/stripe-mock/**" = ["PLC0415"]
+"tools/**" = ["PLC0415"]
+
[tool.ruff.lint.mccabe]
max-complexity = 10
diff --git a/services/llm-gateway/pyproject.toml b/services/llm-gateway/pyproject.toml
index 8dfac0dbf51e..e515b315f80a 100644
--- a/services/llm-gateway/pyproject.toml
+++ b/services/llm-gateway/pyproject.toml
@@ -73,12 +73,19 @@ select = [
"I",
"B",
"C4",
+ "PLC0415",
"UP",
]
ignore = [
"E501",
]
+# PLC0415 exemptions.
+# Run `ruff check <path> --select PLC0415 --statistics` before removing an entry.
+[tool.ruff.lint.per-file-ignores]
+"src/**" = ["PLC0415"]
+"tests/**" = ["PLC0415"]
+
[tool.ruff.format]
quote-style = "double"
indent-style = "space"