File tree 2 files changed +8
-11
lines changed
2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 1
- module cloc
1
+ [<RequireQualifiedAccess>]
2
+ module cloc
2
3
open FSharp.Data
3
4
4
5
type cloc = CsvProvider< " SampleData\c loc.csv" >
5
6
type FileOfCode = { fileName: string ; language: string ; loc: int }
6
7
7
- let private shouldIgnoreFile ( fileName : string )=
8
- let lowerFileName = fileName.ToLower()
9
- lowerFileName.Contains( " \\ bin\\ " ) ||
10
- lowerFileName.Contains( " \\ obj\\ " ) ||
11
- lowerFileName.Contains( " \\ packages\\ " )
12
-
13
8
let private normalizePath ( path : string )=
14
9
path.Replace( " \\ " , " /" )
15
10
@@ -18,8 +13,7 @@ let private adjustFilePath filePath normalCheckoutDir =
18
13
19
14
let getClocData ( clocFilePath : string , checkoutDir ) =
20
15
let normalCheckoutDir = normalizePath checkoutDir
21
- cloc.Load( clocFilePath) .Rows
22
- |> Seq.filter ( fun x -> shouldIgnoreFile ( x.Filename) = false )
16
+ cloc.Load( clocFilePath) .Rows
23
17
|> Seq.map ( fun x ->
24
18
{ FileOfCode.fileName = adjustFilePath x.Filename normalCheckoutDir
25
19
language = x.Language
Original file line number Diff line number Diff line change 1
1
[CmdletBinding ()]
2
2
param (
3
3
$CheckoutDir ,
4
- [Parameter (Mandatory = $true )][ValidateSet (' SVN' , ' Git' )]$VCS
4
+ [Parameter (Mandatory = $true )][ValidateSet (' SVN' , ' Git' )]$VCS ,
5
+ [string []]$DirToExclude
5
6
)
6
7
7
8
$scriptPath = if ($PSScriptRoot -eq $null ){" ." } else {$PSScriptRoot }
@@ -29,7 +30,9 @@ function Get-FilesLOC
29
30
}
30
31
Write-Verbose " Start colecting LOC statistics"
31
32
Remove-Item $OutFilePath - ErrorAction SilentlyContinue
32
- & $clocExePath -- by- file -- csv -- skip-uniqueness -- out= " $OutFilePath " $CheckoutDir | Write-Verbose
33
+ $excludeParam = if ($DirToExclude ){" --exclude-dir=$ ( $DirToExclude -join ' ,' ) " }else {$null }
34
+ Write-Verbose " Exclude $excludeParam "
35
+ & $clocExePath -- by- file -- csv -- skip-uniqueness $excludeParam -- out= " $OutFilePath " $CheckoutDir | Write-Verbose
33
36
if (-not (Test-Path $OutFilePath ))
34
37
{
35
38
$PSCmdlet.ThrowTerminatingError (" Cannot create LOC statistics file" )
You can’t perform that action at this time.
0 commit comments