Skip to content

Commit

Permalink
✨ adding pylint-log json output
Browse files Browse the repository at this point in the history
  • Loading branch information
MaaniBeigy committed Aug 11, 2024
1 parent c633818 commit c8621d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .logs/pylint-log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"lintscore": 10
}
17 changes: 14 additions & 3 deletions .shell/pylint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Get-ChildItem -Path . -Recurse -Filter 'pylint-log.txt' | Remove-Item -Force

# Find and delete files named 'pylint.svg'
Get-ChildItem -Path . -Recurse -Filter 'pylint.svg' | Remove-Item -Force
# Get-ChildItem -Path . -Recurse -Filter 'pylint.svg' | Remove-Item -Force

# Run pylint using poetry and save the output to a log file
poetry run pylint pycvcqv | Tee-Object -FilePath ".logs/pylint-log.txt"
Expand All @@ -14,9 +14,20 @@ $lintscore = Select-String -Path ".logs/pylint-log.txt" -Pattern 'rated at' | Fo
$_ -split '/' | Select-Object -First 1
}

# Convert lintscore to a number
$lintscore = [double]$lintscore

# Create an object to store the lintscore in JSON format
$jsonOutput = @{
lintscore = $lintscore
} | ConvertTo-Json

# Save the JSON output to a file
$jsonOutput | Set-Content -Path ".logs/pylint-log.json"

# Output the lint score (for verification)
Write-Output "lintscore: $lintscore"

# Generate the pylint badge using anybadge and save it to a file
$command = "poetry run python -m anybadge -o --value=$lintscore --file=assets/images/pylint.svg pylint"
Invoke-Expression $command
# $command = "poetry run python -m anybadge -o --value=$lintscore --file=assets/images/pylint.svg pylint"
# Invoke-Expression $command

0 comments on commit c8621d1

Please sign in to comment.