Skip to content

Code quality constraints

Section 17 · From docs/INVENTORY_INTERNALS.md on GitHub

The repository is checked by Codacy and CodeQL on every pull request. Code that passes them:

Limit Value
Function length at most 50 lines of code (NLOC)
Parameters per function at most 8 (use an options dataclass or **options validated by a dataclass, as AWSDeepInventoryCollector and GCPCollector do)
File length at most 500 lines of code; split a package module before it grows past it
Cyclomatic complexity at most 15 per function (move branches into helpers or lookup tables)
Duplication no cloned blocks; factor shared shapes into the package _common.py
Re-exports names imported only to re-export must be listed in __all__
Hard-coded binds no 0.0.0.0 literals in code (use a constant from an existing module)
Names no variables or keyword arguments named like credentials (token, password) holding non-secrets; Bandit flags them

Formatting and linting: ruff format and ruff check must be clean.