-
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copies shared csharp files from Profiler module, which is expected to be | ||
# in a folder named Profiler next to Pester repo folder. | ||
|
||
$ErrorActionPreference = 'Stop' | ||
$profilerPath = "$PSScriptRoot\..\..\..\Profiler" | ||
|
||
if (-not (Test-Path $profilerPath)) { | ||
Check warning Code scanning / PSScriptAnalyzer Unsafe call to 'Test-Path' found. Pester module defines a $SafeCommands dictionary for external commands to avoid hijacking. To fix a violation of this rule, update the call to use SafeCommands-variant, ex. & $SafeCommands['CommandName'] -Param1 Value1. Warning
Unsafe call to 'Test-Path' found. Pester module defines a $SafeCommands dictionary for external commands to avoid hijacking. To fix a violation of this rule, update the call to use SafeCommands-variant, ex. & $SafeCommands['CommandName'] -Param1 Value1.
|
||
throw "Profiler module not found at '$profilerPath'." | ||
} | ||
|
||
|
||
$commit = git -C $profilerPath log --format="%h %B" -n 1 | ||
$branch = git -C $profilerPath branch --show-current | ||
$profilerSources = "$profilerPath\csharp\Profiler" | ||
$pesterSources = "$PSScriptRoot\Pester\Tracing\" | ||
$names = @( | ||
"ExternalTracerAdapter.cs" | ||
"ITracer.cs" | ||
"Tracer.cs" | ||
"TracerHostUI.cs" | ||
) | ||
foreach ($name in $names ) { | ||
$destination = "$pesterSources\$name" | ||
Copy-Item -Path "$profilerSources\$name" -Destination $destination -Force | ||
$content = Get-Content $destination -Raw | ||
Check warning Code scanning / PSScriptAnalyzer Unsafe call to 'Get-Content' found. Pester module defines a $SafeCommands dictionary for external commands to avoid hijacking. To fix a violation of this rule, update the call to use SafeCommands-variant, ex. & $SafeCommands['CommandName'] -Param1 Value1. Warning
Unsafe call to 'Get-Content' found. Pester module defines a $SafeCommands dictionary for external commands to avoid hijacking. To fix a violation of this rule, update the call to use SafeCommands-variant, ex. & $SafeCommands['CommandName'] -Param1 Value1.
|
||
$n = [System.Environment]::NewLine | ||
("// Copied from Profiler module, branch: $branch, commit: $commit$n$n" + $content) | Set-Content $destination -NoNewline | ||
Check warning Code scanning / PSScriptAnalyzer Unsafe call to 'Set-Content' found. Pester module defines a $SafeCommands dictionary for external commands to avoid hijacking. To fix a violation of this rule, update the call to use SafeCommands-variant, ex. & $SafeCommands['CommandName'] -Param1 Value1. Warning
Unsafe call to 'Set-Content' found. Pester module defines a $SafeCommands dictionary for external commands to avoid hijacking. To fix a violation of this rule, update the call to use SafeCommands-variant, ex. & $SafeCommands['CommandName'] -Param1 Value1.
|
||
} |