Visual Studio 2010 and higher has this built in: Analyze > Calculate Code Metrics
Visual Studio Plugin: http://www.wndtabs.com/
Powershell (counts non blanks):
1 2 3 | PS C:\> (dir -include *.cs,*.xaml -recurse | select-string .).Count 8396 PS C:\> |
Customize the extension list as needed:
1 2 3 | PS C:\> (dir -include *.cs,*.cpp,*.h,*.idl,*.asmx -recurse | select-string .).Count 909402 PS C:\> |
Slick Edit Gadgets http://www.slickedit.com looked promising but I didnt try it.
https://gist.github.com/jehugaleahsa/7f1b7cc5ffdb50fd023842b7485e8dea
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | $path = "C:\path\to\solution\folder" $files = Get-ChildItem -Path $path -Include *.cs,*.ts,*.vb -Recurse ` | ? { $_.FullName -notmatch ".*\\obj\\.*" } ` | ? { $_.FullName -notmatch ".*\\node_modules\.*" } $shortNames = $files | % { $fullName = $_.FullName $lines = [System.IO.File]::ReadAllLines($fullName) $lines = $lines | ? { -not [System.String]::IsNullOrWhiteSpace($_) } $data = @{}; $data.Name = $_.Name $data.LineCount = $lines.Length New-Object -TypeName PSObject -Property $data } | Sort-Object -Property LineCount -Descending #$biggest = $shortNames | Select-Object -First 100 $count = $shortNames | Measure-Object -Sum -Average -Property LineCount Write-Host $count.Sum $count.Average |
Returns 1.4million lines
1 2 3 4 5 6 7 8 9 10 11 | PS C:\> choco install cloc --version=1.80 PS C:\> cloc --include-lang=PHP,JavaScript,HTML --exclude-dir=.git,.github,.idea,.platform,.vscode,cache,config,libraries,PHP,releases,resources,node_modules . ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- PHP 4633 90307 180256 426931 JavaScript 200 2092 1464 16225 HTML 95 262 459 9499 ------------------------------------------------------------------------------- SUM: 4928 92661 182179 452655 ------------------------------------------------------------------------------- |