fix: Framework detection, circular deps, and GDScript test discovery

FIXES:

1. Framework Detection (Unity → Godot)
   PROBLEM: Detected Unity instead of Godot due to generic "Assets" marker
   - "Assets" appears in comments: "// TODO: Replace with actual music assets"
   - Triggered false positive for Unity framework

   SOLUTION: Made Unity markers more specific
   - Before: "Assets", "ProjectSettings" (too generic)
   - After: "Assembly-CSharp.csproj", "UnityEngine.dll", "Library/" (specific)
   - Godot markers: "project.godot", ".godot", ".tscn", ".tres", ".gd"

   FILE: architectural_pattern_detector.py line 92-94

2. Circular Dependencies (Self-References)
   PROBLEM: Files showing circular dependency to themselves
   - WARNING: Cycle: analysis-config.gd -> analysis-config.gd
   - 3 self-referential cycles detected

   ROOT CAUSE: No self-loop filtering in build_graph()
   - File resolves class_name to itself
   - Edge created from file to same file

   SOLUTION: Skip self-dependencies in build_graph()
   - Added check: `target != file_path`
   - Prevents file from depending on itself

   FILE: dependency_analyzer.py line 728

3. GDScript Test File Detection
   PROBLEM: Found 0 test files (expected 20 GUT tests with 396 tests)
   - TEST_PATTERNS missing GDScript patterns
   - Only had: test_*.py, *_test.go, Test*.java, etc.

   SOLUTION: Added GDScript test patterns
   - Added: "test_*.gd", "*_test.gd" (GUT, gdUnit4, WAT)
   - Added ".gd": "GDScript" to LANGUAGE_MAP

   FILES:
   - test_example_extractor.py line 886-887
   - test_example_extractor.py line 901

IMPACT:
-  Godot projects correctly detected as "Godot" (not Unity)
-  No more false circular dependency warnings
-  GUT/gdUnit4/WAT test files now discovered and analyzed
-  Better test example extraction for Godot projects

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-02 22:11:38 +03:00
parent fca0951e52
commit 50b28fe561
3 changed files with 7 additions and 3 deletions

View File

@@ -89,9 +89,9 @@ class ArchitecturalPatternDetector:
# Framework detection patterns
FRAMEWORK_MARKERS = {
# Game Engines (checked first to avoid false positives)
"Unity": ["Assembly-CSharp", "UnityEngine", "Assets", ".unity", "ProjectSettings"],
"Unity": ["Assembly-CSharp.csproj", "UnityEngine.dll", "ProjectSettings/ProjectVersion.txt", ".unity", "Library/"],
"Unreal": ["Source/", ".uproject", "Config/DefaultEngine.ini", "Binaries/", "Content/"],
"Godot": ["project.godot", ".godot", "scenes/", ".tscn", ".gd"],
"Godot": ["project.godot", ".godot", ".tscn", ".tres", ".gd"],
# Web Frameworks
"Django": ["django", "manage.py", "settings.py", "urls.py"],
"Flask": ["flask", "app.py", "wsgi.py"],

View File

@@ -724,7 +724,8 @@ class DependencyAnalyzer:
# Try to resolve the imported module to an actual file
target = self._resolve_import(file_path, dep.imported_module, dep.is_relative)
if target and target in self.file_nodes:
# Skip self-dependencies (file depending on itself)
if target and target in self.file_nodes and target != file_path:
# Add edge from source to dependency
self.graph.add_edge(
file_path, target, import_type=dep.import_type, line_number=dep.line_number

View File

@@ -883,6 +883,8 @@ class TestExampleExtractor:
"Test*.cs",
"*Test.php",
"*_spec.rb",
"test_*.gd", # GUT, gdUnit4, WAT test files
"*_test.gd",
]
# Language detection by extension
@@ -896,6 +898,7 @@ class TestExampleExtractor:
".cs": "C#",
".php": "PHP",
".rb": "Ruby",
".gd": "GDScript",
}
def __init__(