Scripts/Analyze-VMwareExport.ps1
<#
.SYNOPSIS Analyzes VMware module export for documentation completeness #> param( [string]$FilePath = ".\TestOutput\Management-Commands.json" ) if (-not (Test-Path $FilePath)) { Write-Error "File not found: $FilePath" exit 1 } Write-Host "`n=== VMware Module Export Analysis ===" -ForegroundColor Cyan # Load the JSON data $jsonContent = Get-Content $FilePath | Out-String | ConvertFrom-Json Write-Host "`nModule: $($jsonContent.ModuleName)" -ForegroundColor White Write-Host "Version: $($jsonContent.ModuleVersion)" -ForegroundColor White Write-Host "Total Commands: $($jsonContent.Commands.Count)" -ForegroundColor Green # Group by command type Write-Host "`nCommand Types:" -ForegroundColor Yellow $jsonContent.Commands | Group-Object CommandType | Sort-Object Count -Descending | ForEach-Object { Write-Host " $($_.Name): $($_.Count)" -ForegroundColor Gray } # Analyze documentation quality $withSynopsis = ($jsonContent.Commands | Where-Object { $_.Synopsis -and $_.Synopsis -ne "No synopsis available" }).Count $withDescription = ($jsonContent.Commands | Where-Object { $_.Description -and $_.Description -ne "No description available" }).Count $withExamples = ($jsonContent.Commands | Where-Object { $_.Examples -and $_.Examples.Count -gt 0 }).Count $withParameters = ($jsonContent.Commands | Where-Object { $_.Parameters -and $_.Parameters.Count -gt 0 }).Count Write-Host "`nDocumentation Coverage:" -ForegroundColor Yellow Write-Host " Synopsis: $withSynopsis/$($jsonContent.Commands.Count) ($([Math]::Round($withSynopsis/$jsonContent.Commands.Count*100, 1))%)" -ForegroundColor Gray Write-Host " Description: $withDescription/$($jsonContent.Commands.Count) ($([Math]::Round($withDescription/$jsonContent.Commands.Count*100, 1))%)" -ForegroundColor Gray Write-Host " Examples: $withExamples/$($jsonContent.Commands.Count) ($([Math]::Round($withExamples/$jsonContent.Commands.Count*100, 1))%)" -ForegroundColor Gray Write-Host " Parameters: $withParameters/$($jsonContent.Commands.Count) ($([Math]::Round($withParameters/$jsonContent.Commands.Count*100, 1))%)" -ForegroundColor Gray # Find most documented commands Write-Host "`nBest Documented Commands (with examples):" -ForegroundColor Yellow $jsonContent.Commands | Where-Object { $_.Examples -and $_.Examples.Count -gt 0 } | Select-Object -First 5 | ForEach-Object { Write-Host " - $($_.Name) ($($_.Examples.Count) examples)" -ForegroundColor Gray } # Find commands with no documentation $undocumented = $jsonContent.Commands | Where-Object { ($_.Synopsis -eq "No synopsis available") -and ($_.Description -eq "No description available") } if ($undocumented) { Write-Host "`nCommands with no documentation: $($undocumented.Count)" -ForegroundColor Red if ($undocumented.Count -le 10) { $undocumented | ForEach-Object { Write-Host " - $($_.Name)" -ForegroundColor Gray } } } # File statistics $fileInfo = Get-Item $FilePath Write-Host "`nFile Statistics:" -ForegroundColor Yellow Write-Host " Size: $([Math]::Round($fileInfo.Length / 1MB, 2)) MB" -ForegroundColor Gray Write-Host " Path: $($fileInfo.FullName)" -ForegroundColor Gray |