Skip to content

2026-08-27 Infrastructure Python complexity audit

Audited Ruff configuration and source-level McCabe complexity across monorepo Python projects.

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.
Navigation

Type to search…

↑↓ navigate↵ selectEsc close