<commit_before>﻿param (
    [string]$CoverallsRepoToken=$(throw "-CoverallsRepoToken is required."),
    [string]$CoverFilter=$(throw "-CoverFilter is required.")
)

Write-Output "Starting code coverage with filter: $($CoverFilter)"

$alwaysFilter = "-[xunit*]* -[Microsoft*]* -[dotnet*]* -[NuGet*]* -[Newtonsoft*]* -[Consul*]* -[Nancy*]* -[csc]* -[Anonymously*]*"
$filter = "$CoverFilter $alwaysFilter"

$packagesPath = $env:USERPROFILE + "\.nuget\packages"
$opencoverPath = $packagesPath + "\OpenCover\4.6.519\tools\OpenCover.Console.exe"
$coverallsPath = $packagesPath + "\coveralls.io\1.3.4\tools\coveralls.net.exe"
$tempPath = "c:\codecoverage"
$tempCoveragePath = $tempPath + "\coverage\"
$tempCoverageFileName = $tempCoveragePath + "coverage.xml"

# create temp path
if (-not (test-path $tempPath) ) {
    mkdir $tempPath | Out-Null
}

# run opencover
Get-ChildItem -Path $PSScriptRoot\..\test -Filter project.json -Recurse | ForEach-Object {<commit_msg>work around filter string not being passed correctly from appveyor.yml<commit_after>﻿param (
    [string]$CoverallsRepoToken=$(throw "-CoverallsRepoToken is required."),
    [string]$CoverFilter=$(throw "-CoverFilter is required.")
)

Write-Output "Starting code coverage with filter: $CoverFilter"

$alwaysFilter = "-[xunit*]* -[Microsoft*]* -[dotnet*]* -[NuGet*]* -[Newtonsoft*]* -[Consul*]* -[Nancy*]* -[csc]* -[Anonymously*]*"
$actualFilter = "+[Nano*]* -[*]*.Logging.* -[*Tests]*" # while appveyor doesn't correctly give the entire filter string in environment, use this actual filter
Write-Output "Actually using filter: $actualFilter"
#$filter = "$CoverFilter $alwaysFilter"
$filter = "$actualFilter $alwaysFilter"

$packagesPath = $env:USERPROFILE + "\.nuget\packages"
$opencoverPath = $packagesPath + "\OpenCover\4.6.519\tools\OpenCover.Console.exe"
$coverallsPath = $packagesPath + "\coveralls.io\1.3.4\tools\coveralls.net.exe"
$tempPath = "c:\codecoverage"
$tempCoveragePath = $tempPath + "\coverage\"
$tempCoverageFileName = $tempCoveragePath + "coverage.xml"

# create temp path
if (-not (test-path $tempPath) ) {
    mkdir $tempPath | Out-Null
}

# run opencover
Get-ChildItem -Path $PSScriptRoot\..\test -Filter project.json -Recurse | ForEach-Object {
{'fraction_non_alphanumeric': 0.17549371633752245, 'fraction_numerical': 0.00718132854578097, 'mean_word_length': 5.26123595505618, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3462017', 'n_tokens_mistral': 790, 'n_tokens_neox': 742, 'n_words': 166}