Created
March 14, 2011 15:58
-
-
Save house9/869367 to your computer and use it in GitHub Desktop.
powershell script to generate a TODO report
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
$fileName = "_2-DO_log.txt" | |
$max = 20 | |
$encoding = "ASCII" | |
# remove previous file if exists | |
if(Test-Path $fileName) { Remove-Item $fileName } | |
# dump 2-do report to the file system | |
Get-ChildItem –rec –include *.config,*.cs,*.js,*.cshtml,*.css,*.aspx | | |
where { $_ -notmatch 'lib' } | | |
where { $_ -notmatch 'Test' } | | |
select-string TODO | | |
out-string -width 4096 | | |
out-file $fileName -encoding $encoding | |
# get the line count of the report | |
$content = Get-Content .\$fileName | |
$count = $content.Count.ToString() | |
# Write-Host "Total count is $count" | |
# verify we don't have too many entries | |
if($content.Count -gt $max) | |
{ | |
$message = "TO DO comment count has been exceeded. Max Allowed is $max but found $count for the entire solution, excluding lib files and Test projects" | |
# prepend the message before the data | |
$message | out-file $fileName -encoding $encoding | |
$content | add-content $fileName | |
Throw [system.Exception]($message) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for a huge headstart on getting this info into my TeamCity build