feat: add shadow module and repeated field pattern audit rules (#635, #441)#943
Merged
feat: add shadow module and repeated field pattern audit rules (#635, #441)#943
Conversation
Detect directories that are near-copies of each other — overlapping file names with high content similarity. Stronger signal than individual DuplicateFunction findings because it indicates systemic duplication (an entire module was copy-pasted instead of properly refactored). Algorithm is language-agnostic: - Groups fingerprints by parent directory - Compares all directory pairs for file name overlap (≥50%) - Verifies content similarity via method/structural hash overlap (≥50%) - Filters out test directories and parent/child relationships - Emits ShadowModule findings for both directories in a pair Wired into the audit pipeline as Phase 4n.
Detect groups of fields that appear together in 3+ struct definitions. When the same name+type fields co-occur across multiple types, they're candidates for extraction into a shared struct with flatten/embed. Algorithm is language-agnostic: - Walks source files, extracts struct/class/interface definitions - Parses field declarations using line-level pattern matching - Groups fields by signature, finds co-occurring groups - Reports when MIN_GROUP_SIZE (2) fields appear in MIN_OCCURRENCES (3+) structs Handles Rust (struct), PHP (class), TS/JS (interface), Go (struct). Wired into the audit pipeline as Phase 4o.
This was referenced Mar 23, 2026
Contributor
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two new audit rules, both language-agnostic:
Shadow Module Detection (#635)
Detects directories that are near-copies — overlapping file names with high content similarity. Stronger signal than individual
DuplicateFunctionfindings because it indicates systemic duplication (an entire module was copy-pasted).ShadowModuleRepeated Struct Field Pattern (#441)
Detects groups of fields that appear together in 3+ struct/class/interface definitions. Candidates for extraction into a shared type.
RepeatedFieldPatternAlso
Addresses #635, #441