@@ -11,13 +11,13 @@ Set-StrictMode -Version 2.0
1111
1212. $PSScriptRoot \..\tools.ps1
1313
14- # Cache/HashMap (File -> Exist flag) used to consult whether a file exist
14+ # Cache/HashMap (File -> Exist flag) used to consult whether a file exist
1515# in the repository at a specific commit point. This is populated by inserting
1616# all files present in the repo at a specific commit point.
1717$global :RepoFiles = @ {}
1818
1919$ValidatePackage = {
20- param (
20+ param (
2121 [string ] $PackagePath # Full path to a Symbols.NuGet package
2222 )
2323
@@ -32,7 +32,7 @@ $ValidatePackage = {
3232 # Extensions for which we'll look for SourceLink information
3333 # For now we'll only care about Portable & Embedded PDBs
3434 $RelevantExtensions = @ (" .dll" , " .exe" , " .pdb" )
35-
35+
3636 Write-Host - NoNewLine " Validating" ([System.IO.Path ]::GetFileName($PackagePath )) " ... "
3737
3838 $PackageId = [System.IO.Path ]::GetFileNameWithoutExtension($PackagePath )
@@ -46,13 +46,13 @@ $ValidatePackage = {
4646 try {
4747 $zip = [System.IO.Compression.ZipFile ]::OpenRead($PackagePath )
4848
49- $zip.Entries |
49+ $zip.Entries |
5050 Where-Object {$RelevantExtensions -contains [System.IO.Path ]::GetExtension($_.Name )} |
5151 ForEach-Object {
5252 $FileName = $_.FullName
5353 $Extension = [System.IO.Path ]::GetExtension($_.Name )
5454 $FakeName = -Join ((New-Guid ), $Extension )
55- $TargetFile = Join-Path - Path $ExtractPath - ChildPath $FakeName
55+ $TargetFile = Join-Path - Path $ExtractPath - ChildPath $FakeName
5656
5757 # We ignore resource DLLs
5858 if ($FileName.EndsWith (" .resources.dll" )) {
@@ -62,7 +62,7 @@ $ValidatePackage = {
6262 [System.IO.Compression.ZipFileExtensions ]::ExtractToFile($_ , $TargetFile , $true )
6363
6464 $ValidateFile = {
65- param (
65+ param (
6666 [string ] $FullPath , # Full path to the module that has to be checked
6767 [string ] $RealPath ,
6868 [ref ] $FailedFiles
@@ -83,15 +83,15 @@ $ValidatePackage = {
8383 ForEach-Object {
8484 $Link = $_
8585 $CommitUrl = " https://raw.githubusercontent.com/${ using:GHRepoName } /${ using:GHCommit } /"
86-
86+
8787 $FilePath = $Link.Replace ($CommitUrl , " " )
8888 $Status = 200
8989 $Cache = $using :RepoFiles
9090
9191 if ( ! ($Cache.ContainsKey ($FilePath )) ) {
9292 try {
9393 $Uri = $Link -as [System.URI ]
94-
94+
9595 # Only GitHub links are valid
9696 if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match " github" -or $Uri.Host -match " githubusercontent" )) {
9797 $Status = (Invoke-WebRequest - Uri $Link - UseBasicParsing - Method HEAD - TimeoutSec 5 ).StatusCode
@@ -128,15 +128,15 @@ $ValidatePackage = {
128128 }
129129 }
130130 }
131-
131+
132132 & $ValidateFile $TargetFile $FileName ([ref ]$FailedFiles )
133133 }
134134 }
135135 catch {
136-
136+
137137 }
138138 finally {
139- $zip.Dispose ()
139+ $zip.Dispose ()
140140 }
141141
142142 if ($FailedFiles -eq 0 ) {
@@ -163,13 +163,13 @@ function ValidateSourceLinkLinks {
163163 ExitWithExitCode 1
164164 }
165165
166- $RepoTreeURL = -Join (" https ://api.github.com/repos/" , $GHRepoName , " /git/trees/" , $GHCommit , " ?recursive=1" )
166+ $RepoTreeURL = -Join (" http ://api.github.com/repos/" , $GHRepoName , " /git/trees/" , $GHCommit , " ?recursive=1" )
167167 $CodeExtensions = @ (" .cs" , " .vb" , " .fs" , " .fsi" , " .fsx" , " .fsscript" )
168168
169169 try {
170170 # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash
171171 $Data = Invoke-WebRequest $RepoTreeURL - UseBasicParsing | ConvertFrom-Json | Select-Object - ExpandProperty tree
172-
172+
173173 foreach ($file in $Data ) {
174174 $Extension = [System.IO.Path ]::GetExtension($file.path )
175175
@@ -183,7 +183,7 @@ function ValidateSourceLinkLinks {
183183 Write-Host $_
184184 ExitWithExitCode 1
185185 }
186-
186+
187187 if (Test-Path $ExtractPath ) {
188188 Remove-Item $ExtractPath - Force - Recurse - ErrorAction SilentlyContinue
189189 }
0 commit comments