fix: exclude venv and .venv from architecture validation
- Update .architecture-rules.yaml to ignore venv/.venv directories - Improve _should_ignore_file() method to handle venv path exclusions - Add explicit checks for .venv/ and venv/ in file paths This prevents the architecture validator from scanning thousands of files in virtual environment directories, reducing validation time from scanning all dependency files to just project files. Before: Scanned venv files (thousands of violations in dependencies) After: Only scans project files (123 files checked) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -399,6 +399,10 @@ ignore:
|
||||
- "**/__pycache__/**"
|
||||
- "**/migrations/**"
|
||||
- "**/node_modules/**"
|
||||
- "**/.venv/**"
|
||||
- "**/venv/**"
|
||||
- ".venv/**"
|
||||
- "venv/**"
|
||||
|
||||
patterns:
|
||||
# Allow HTTPException in specific files
|
||||
|
||||
@@ -557,9 +557,18 @@ class ArchitectureValidator:
|
||||
"""Check if file should be ignored"""
|
||||
ignore_patterns = self.config.get("ignore", {}).get("files", [])
|
||||
|
||||
# Convert to string for easier matching
|
||||
file_path_str = str(file_path)
|
||||
|
||||
for pattern in ignore_patterns:
|
||||
# Check if any part of the path matches the pattern
|
||||
if file_path.match(pattern):
|
||||
return True
|
||||
# Also check if pattern appears in the path (for .venv, venv, etc.)
|
||||
if "/.venv/" in file_path_str or file_path_str.startswith(".venv/"):
|
||||
return True
|
||||
if "/venv/" in file_path_str or file_path_str.startswith("venv/"):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user