-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c830fe
commit c29bef4
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"complexity": "A" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Delete the 'complexity' files if it exists | ||
Get-ChildItem -Path . -Recurse -Filter 'complexity.txt' | Remove-Item -Force | ||
Get-ChildItem -Path . -Recurse -Filter 'complexity.json' | Remove-Item -Force | ||
|
||
# Run radon using poetry and save the output to a log file | ||
poetry run python -m radon cc pycvcqv -s -a | Out-File -FilePath ".logs/complexity.txt" -Append | ||
|
||
# Extract the average complexity from the log file | ||
$complexity = Select-String -Path ".logs/complexity.txt" -Pattern 'Average complexity:' | ForEach-Object { | ||
$_.Line -split ' ' | Select-Object -Index 2 | ||
} | ||
|
||
# Create an object to store the complexity in JSON format | ||
$jsonOutput = @{ | ||
complexity = $complexity | ||
} | ConvertTo-Json | ||
|
||
# Save the JSON output to a file | ||
$jsonOutput | Set-Content -Path ".logs/complexity.json" | ||
|
||
# Output the complexity (for verification) | ||
Write-Output "complexity: $complexity" |