Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test
  • Loading branch information
MariusStorhaug committed Apr 13, 2024
commit 09e79efd20af76730434c52e99eb93eb661f9a39
14 changes: 9 additions & 5 deletions scripts/tests/PSModule/SourceCode.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ Describe 'PSModule - SourceCode tests' {
It "Should use '[System.Environment]::ProcessorCount' instead of '$env:NUMBER_OF_PROCESSORS'" {
$issues = @('')
$scriptFiles | ForEach-Object {
$fileContent = Get-Content -Path $_.FullName -Raw
if ($fileContent -match '\$env:NUMBER_OF_PROCESSORS') {
$issues += " - $($_.FullName)"
#Get linenumber of the match
Write-Verbose ($matches | Out-String) -Verbose
Select-String -Path $_.FullName -Pattern '\$env:NUMBER_OF_PROCESSORS' -AllMatches | ForEach-Object {
$issues += " - $($_.Path):$($_.LineNumber):$($_.Line)"
Write-Verbose ($_ | Out-String) -Verbose
}
# $fileContent = Get-Content -Path $_.FullName -Raw
# if ($fileContent -match '\$env:NUMBER_OF_PROCESSORS') {
# $issues += " - $($_.FullName)"
# #Get linenumber of the match
# Write-Verbose ($matches | Out-String) -Verbose
# }
}
$issues -join [Environment]::NewLine |
Should -BeNullOrEmpty -Because 'the script should use [System.Environment]::ProcessorCount instead of $env:NUMBER_OF_PROCESSORS'
Expand Down