Context
Discovered while validating the orphan_detection implementation (issue #17).
Description
The function orphan query currently hardcodes exclusions for pytest-style entry points only:
AND NOT f.name STARTS WITH 'test_'
AND NOT f.name IN ['setup_module', 'teardown_module',
'setup_function', 'teardown_function',
'setup_class', 'teardown_class',
'setup_method', 'teardown_method']
Users on unittest (setUp, tearDown, setUpClass, tearDownClass), nose (setup, teardown), or custom naming conventions will get false positives with no escape hatch short of disabling the policy entirely.
Suggested approach
Add two optional config fields to [policies.orphan_detection] in .arch-policies.toml:
[policies.orphan_detection]
enabled = true
exclude_prefixes = ["test_"] # function names starting with these are excluded
exclude_names = ["setUp", "tearDown", "setUpClass", "tearDownClass"] # exact names
OrphanDetectionConfig gains exclude_prefixes: list[str] and exclude_names: list[str] with sensible pytest defaults. The Cypher builder in _check_orphans injects them into the AND NOT f.name STARTS WITH ... / AND NOT f.name IN [...] clauses dynamically.
Context
Discovered while validating the
orphan_detectionimplementation (issue #17).Description
The function orphan query currently hardcodes exclusions for pytest-style entry points only:
Users on
unittest(setUp,tearDown,setUpClass,tearDownClass),nose(setup,teardown), or custom naming conventions will get false positives with no escape hatch short of disabling the policy entirely.Suggested approach
Add two optional config fields to
[policies.orphan_detection]in.arch-policies.toml:OrphanDetectionConfiggainsexclude_prefixes: list[str]andexclude_names: list[str]with sensible pytest defaults. The Cypher builder in_check_orphansinjects them into theAND NOT f.name STARTS WITH .../AND NOT f.name IN [...]clauses dynamically.