---
title: "2026-08-27 Infrastructure Python complexity audit"
description: "Audited Ruff configuration and source-level McCabe complexity across monorepo Python projects."
image: "https://docs.virdx.dev/img/virdx-social-card.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.virdx.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 2026-08-27 Infrastructure Python complexity audit

## Work Done

- Inventoried all ten Nx projects tagged `lang:python`, their Ruff dependencies, project-local settings, Pixi tasks, and Nx lint targets.
- Measured Ruff C901 McCabe complexity for every function in each project's production source root with an isolated C901-only invocation.
- Found 1,710 functions, a median complexity of 2, and 20 functions above 15. The maximum is 30 in `vxdata-jobs`.
- Found that `dashboard-api` has no Ruff setup or Nx lint target, and that `vxdata-api`'s `include = ["src"]` causes its current lint task to scan no Python files.
- Made no changes to the monorepo.

## Lessons Learned: Pitfalls

- The root README inventory is stale: it omits several current Python projects. Nx `project.json` tags are the reliable inventory.
- Running C901 through each project configuration can silently omit `vxdata-api`; use `--isolated` for a consistent audit, then separately inspect the actual lint task.
- Ruff versions vary significantly between independent Pixi locks, although the C901 results were stable across the installed versions used here.

## Lessons Learned: Improvements

- Document a workspace-wide Ruff baseline and standard lint scope for Python projects.
- Add a check that each `lang:python` project has a working lint target and that Ruff discovers at least one Python file.
- A McCabe ceiling of 15 is a practical target: it affects about 1.2% of current production functions and can be introduced with a short legacy baseline before ratcheting toward 10.

Source: https://docs.virdx.dev/knowledge/inbox/2026-08-27-infrastructure-python-complexity-audit/index.mdx
