fix: resolve all lint issues and fix failing tests

- Fix blank line whitespace issues (W293) using ruff --unsafe-fixes
- Reformat code using ruff format for consistent styling
- Fix analyze_package_quality function to return list[Message] instead of string
- Add missing 'assessment' keyword to package analysis template
- Update tests to use real prompt functions instead of mocks for structure validation
- Fix import ordering in test files
- All 64 tests now pass with 47% code coverage

Signed-off-by: longhao <hal.long@outlook.com>
This commit is contained in:
longhao 2025-05-29 18:38:10 +08:00 committed by Hal
parent d63ef02ef3
commit a28d999958
18 changed files with 554 additions and 390 deletions

View file

@ -24,21 +24,21 @@ async def analyze_pyside2_dependencies():
python_version="3.10",
include_extras=[],
include_dev=False,
max_depth=3
max_depth=3,
)
print(f"✅ Successfully resolved dependencies for {result['package_name']}")
print("📊 Summary:")
summary = result['summary']
summary = result["summary"]
print(f" - Total packages: {summary['total_packages']}")
print(f" - Runtime dependencies: {summary['total_runtime_dependencies']}")
print(f" - Max depth: {summary['max_depth']}")
print("\n📦 Package list:")
for i, pkg in enumerate(summary['package_list'][:10], 1): # Show first 10
for i, pkg in enumerate(summary["package_list"][:10], 1): # Show first 10
print(f" {i}. {pkg}")
if len(summary['package_list']) > 10:
if len(summary["package_list"]) > 10:
print(f" ... and {len(summary['package_list']) - 10} more packages")
return result
@ -63,12 +63,12 @@ async def download_pyside2_packages():
include_dev=False,
prefer_wheel=True,
verify_checksums=True,
max_depth=2 # Limit depth for demo
max_depth=2, # Limit depth for demo
)
print("✅ Download completed!")
print("📊 Download Summary:")
summary = result['summary']
summary = result["summary"]
print(f" - Total packages: {summary['total_packages']}")
print(f" - Successful downloads: {summary['successful_downloads']}")
print(f" - Failed downloads: {summary['failed_downloads']}")
@ -76,9 +76,9 @@ async def download_pyside2_packages():
print(f" - Success rate: {summary['success_rate']:.1f}%")
print(f" - Download directory: {summary['download_directory']}")
if result['failed_downloads']:
if result["failed_downloads"]:
print("\n⚠️ Failed downloads:")
for failure in result['failed_downloads']:
for failure in result["failed_downloads"]:
print(f" - {failure['package']}: {failure['error']}")
return result
@ -98,20 +98,20 @@ async def analyze_small_package():
python_version="3.10",
include_extras=[],
include_dev=False,
max_depth=5
max_depth=5,
)
print(f"✅ Successfully resolved dependencies for {result['package_name']}")
# Show detailed dependency tree
print("\n🌳 Dependency Tree:")
dependency_tree = result['dependency_tree']
dependency_tree = result["dependency_tree"]
for _pkg_name, pkg_info in dependency_tree.items():
indent = " " * pkg_info['depth']
indent = " " * pkg_info["depth"]
print(f"{indent}- {pkg_info['name']} ({pkg_info['version']})")
runtime_deps = pkg_info['dependencies']['runtime']
runtime_deps = pkg_info["dependencies"]["runtime"]
if runtime_deps:
for dep in runtime_deps[:3]: # Show first 3 dependencies
print(f"{indent} └─ {dep}")