refactor(scripts): reorganize scripts/ into seed/ and validate/ subfolders
Move 9 init/seed scripts into scripts/seed/ and 7 validation scripts (+ validators/ subfolder) into scripts/validate/ to reduce clutter in the root scripts/ directory. Update all references across Makefile, CI/CD configs, pre-commit hooks, docs (~40 files), and Python imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,19 +21,19 @@ This directory contains scripts for validating and enforcing architectural patte
|
||||
|
||||
```bash
|
||||
# Validate entire codebase
|
||||
python scripts/validate_architecture.py
|
||||
python scripts/validate/validate_architecture.py
|
||||
|
||||
# Validate specific directory
|
||||
python scripts/validate_architecture.py app/api/
|
||||
python scripts/validate/validate_architecture.py app/api/
|
||||
|
||||
# Verbose output with code context
|
||||
python scripts/validate_architecture.py --verbose
|
||||
python scripts/validate/validate_architecture.py --verbose
|
||||
|
||||
# Show only errors (suppress warnings)
|
||||
python scripts/validate_architecture.py --errors-only
|
||||
python scripts/validate/validate_architecture.py --errors-only
|
||||
|
||||
# Use custom config file
|
||||
python scripts/validate_architecture.py --config custom-rules.yaml
|
||||
python scripts/validate/validate_architecture.py --config custom-rules.yaml
|
||||
```
|
||||
|
||||
### Exit Codes
|
||||
@@ -175,7 +175,7 @@ jobs:
|
||||
|
||||
- name: Validate Architecture
|
||||
run: |
|
||||
python scripts/validate_architecture.py
|
||||
python scripts/validate/validate_architecture.py
|
||||
```
|
||||
|
||||
### Documentation
|
||||
@@ -192,7 +192,7 @@ To add new rules:
|
||||
1. Add rule definition to `.architecture-rules.yaml`
|
||||
2. Implement validation logic in `validate_architecture.py`
|
||||
3. Add examples to `docs/architecture/architecture-patterns.md`
|
||||
4. Test with `python scripts/validate_architecture.py --verbose`
|
||||
4. Test with `python scripts/validate/validate_architecture.py --verbose`
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ This provides a single entry point for comprehensive code validation,
|
||||
useful for CI/CD pipelines and pre-commit hooks.
|
||||
|
||||
Usage:
|
||||
python scripts/validate_all.py # Run all validators
|
||||
python scripts/validate_all.py --security # Run only security validator
|
||||
python scripts/validate_all.py --performance # Run only performance validator
|
||||
python scripts/validate_all.py --architecture # Run only architecture validator
|
||||
python scripts/validate_all.py --audit # Run only audit validator
|
||||
python scripts/validate_all.py -v # Verbose output
|
||||
python scripts/validate_all.py --fail-fast # Stop on first failure
|
||||
python scripts/validate_all.py --json # JSON output
|
||||
python scripts/validate/validate_all.py # Run all validators
|
||||
python scripts/validate/validate_all.py --security # Run only security validator
|
||||
python scripts/validate/validate_all.py --performance # Run only performance validator
|
||||
python scripts/validate/validate_all.py --architecture # Run only architecture validator
|
||||
python scripts/validate/validate_all.py --audit # Run only audit validator
|
||||
python scripts/validate/validate_all.py -v # Verbose output
|
||||
python scripts/validate/validate_all.py --fail-fast # Stop on first failure
|
||||
python scripts/validate/validate_all.py --json # JSON output
|
||||
|
||||
Options:
|
||||
--architecture Run architecture validator
|
||||
@@ -41,8 +41,7 @@ def run_architecture_validator(verbose: bool = False) -> tuple[int, dict]:
|
||||
"""Run the architecture validator"""
|
||||
try:
|
||||
# Import dynamically to avoid circular imports
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from scripts.validate_architecture import ArchitectureValidator
|
||||
from validate_architecture import ArchitectureValidator
|
||||
|
||||
config_path = Path.cwd() / ".architecture-rules.yaml"
|
||||
validator = ArchitectureValidator(config_path=config_path, verbose=verbose)
|
||||
@@ -12,12 +12,12 @@ This script checks that the codebase follows key architectural decisions:
|
||||
- API endpoint patterns
|
||||
|
||||
Usage:
|
||||
python scripts/validate_architecture.py # Check all files in current directory
|
||||
python scripts/validate_architecture.py -d app/api/ # Check specific directory
|
||||
python scripts/validate_architecture.py -f app/api/v1/stores.py # Check single file
|
||||
python scripts/validate_architecture.py -o merchant # Check all merchant-related files
|
||||
python scripts/validate_architecture.py -o store --verbose # Check store files with details
|
||||
python scripts/validate_architecture.py --json # JSON output
|
||||
python scripts/validate/validate_architecture.py # Check all files in current directory
|
||||
python scripts/validate/validate_architecture.py -d app/api/ # Check specific directory
|
||||
python scripts/validate/validate_architecture.py -f app/api/v1/stores.py # Check single file
|
||||
python scripts/validate/validate_architecture.py -o merchant # Check all merchant-related files
|
||||
python scripts/validate/validate_architecture.py -o store --verbose # Check store files with details
|
||||
python scripts/validate/validate_architecture.py --json # JSON output
|
||||
|
||||
Options:
|
||||
-f, --file PATH Validate a single file (.py, .js, or .html)
|
||||
@@ -11,10 +11,10 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# Add project root to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
# Add parent directory to path for imports
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
|
||||
from scripts.base_validator import BaseValidator
|
||||
from base_validator import BaseValidator
|
||||
|
||||
|
||||
class AuditValidator(BaseValidator):
|
||||
@@ -13,12 +13,12 @@ This script checks for common performance issues:
|
||||
- Missing timeouts and connection pooling
|
||||
|
||||
Usage:
|
||||
python scripts/validate_performance.py # Check all files
|
||||
python scripts/validate_performance.py -d app/services/ # Check specific directory
|
||||
python scripts/validate_performance.py -f app/api/v1/products.py # Check single file
|
||||
python scripts/validate_performance.py -v # Verbose output
|
||||
python scripts/validate_performance.py --json # JSON output
|
||||
python scripts/validate_performance.py --errors-only # Only show errors
|
||||
python scripts/validate/validate_performance.py # Check all files
|
||||
python scripts/validate/validate_performance.py -d app/services/ # Check specific directory
|
||||
python scripts/validate/validate_performance.py -f app/api/v1/products.py # Check single file
|
||||
python scripts/validate/validate_performance.py -v # Verbose output
|
||||
python scripts/validate/validate_performance.py --json # JSON output
|
||||
python scripts/validate/validate_performance.py --errors-only # Only show errors
|
||||
|
||||
Options:
|
||||
-f, --file PATH Validate a single file
|
||||
@@ -14,12 +14,12 @@ This script checks for common security vulnerabilities:
|
||||
- Data exposure risks
|
||||
|
||||
Usage:
|
||||
python scripts/validate_security.py # Check all files
|
||||
python scripts/validate_security.py -d app/api/ # Check specific directory
|
||||
python scripts/validate_security.py -f app/api/v1/auth.py # Check single file
|
||||
python scripts/validate_security.py -v # Verbose output
|
||||
python scripts/validate_security.py --json # JSON output
|
||||
python scripts/validate_security.py --errors-only # Only show errors
|
||||
python scripts/validate/validate_security.py # Check all files
|
||||
python scripts/validate/validate_security.py -d app/api/ # Check specific directory
|
||||
python scripts/validate/validate_security.py -f app/api/v1/auth.py # Check single file
|
||||
python scripts/validate/validate_security.py -v # Verbose output
|
||||
python scripts/validate/validate_security.py --json # JSON output
|
||||
python scripts/validate/validate_security.py --errors-only # Only show errors
|
||||
|
||||
Options:
|
||||
-f, --file PATH Validate a single file
|
||||
Reference in New Issue
Block a user