diff --git a/src/BuildForRelease.ps1 b/src/BuildForRelease.ps1 index f833a8d5c..ffc1ff5cb 100644 --- a/src/BuildForRelease.ps1 +++ b/src/BuildForRelease.ps1 @@ -13,7 +13,7 @@ $ErrorActionPreference = "Stop" Import-Module (Join-Path $PSScriptRoot Common.psm1) -Function ` AssertDotnet, ` - GetArtefactsDir + GetArtefactsDir function CopyContentForDemo($Destination) { diff --git a/src/Check.ps1 b/src/Check.ps1 index fb63728d3..3883603ae 100644 --- a/src/Check.ps1 +++ b/src/Check.ps1 @@ -16,8 +16,15 @@ function LogAndExecute($Expression) function Main { - LogAndExecute "$(Join-Path $PSScriptRoot "CheckFormat.ps1")" - LogAndExecute "$(Join-Path $PSScriptRoot "CheckHelpInReadme.ps1")" + LogAndExecute "$( Join-Path $PSScriptRoot "CheckFormat.ps1" )" + LogAndExecute "$( Join-Path $PSScriptRoot "CheckHelpInReadme.ps1" )" } -$previousLocation = Get-Location; try { Main } finally { Set-Location $previousLocation } +$previousLocation = Get-Location; try +{ + Main +} +finally +{ + Set-Location $previousLocation +} diff --git a/src/Common.psm1 b/src/Common.psm1 index c44256d9e..e87c29767 100644 --- a/src/Common.psm1 +++ b/src/Common.psm1 @@ -17,13 +17,14 @@ function AssertDotnet } else { - throw "dotnet could not be found in the PATH. Look if you could find it, e.g., in " + ` - "$( Join-Path $env:LOCALAPPDATA "Microsoft\dotnet" ) and add it to PATH." + throw "dotnet could not be found in the PATH. Look if you could find it, e.g., in " + ` + "$( Join-Path $env:LOCALAPPDATA "Microsoft\dotnet" ) and add it to PATH." } } } -function FindDotnetToolVersion($PackageID) { +function FindDotnetToolVersion($PackageID) +{ AssertDotnet $version = '' @@ -55,23 +56,24 @@ function FindDotnetToolVersion($PackageID) { .SYNOPSIS Check the version of the given dotnet tool. #> -function AssertDotnetToolVersion($PackageID, $ExpectedVersion) { +function AssertDotnetToolVersion($PackageID, $ExpectedVersion) +{ AssertDotnet $version = FindDotnetToolVersion -PackageID $PackageID if ($version -eq '') { - throw "No $PackageID could be found. Have you installed it? " + ` - "Check the list of the installed dotnet tools with: " + ` - "`dotnet tool list` and `dotnet tool list -g`." + throw "No $PackageID could be found. Have you installed it? " + ` + "Check the list of the installed dotnet tools with: " + ` + "`dotnet tool list` and `dotnet tool list -g`." } else { if ($version -ne $ExpectedVersion) { - throw "Expected $PackageID version $ExpectedVersion, but got: $version;" + ` - "Check the list of the installed dotnet tools with: " + ` - "`dotnet tool list` and `dotnet tool list -g`." + throw "Expected $PackageID version $ExpectedVersion, but got: $version;" + ` + "Check the list of the installed dotnet tools with: " + ` + "`dotnet tool list` and `dotnet tool list -g`." } # else: the version is correct. } @@ -95,5 +97,5 @@ function GetArtefactsDir Export-ModuleMember -Function ` AssertDotnet, ` - AssertDotnetFormatVersion, ` - GetArtefactsDir \ No newline at end of file + AssertDotnetFormatVersion, ` + GetArtefactsDir \ No newline at end of file diff --git a/src/FormatCode.ps1 b/src/FormatCode.ps1 index cfbbfc0fc..abe1bf0c1 100644 --- a/src/FormatCode.ps1 +++ b/src/FormatCode.ps1 @@ -7,7 +7,7 @@ $ErrorActionPreference = "Stop" Import-Module (Join-Path $PSScriptRoot Common.psm1) -Function ` AssertDotnet, ` - AssertDotnetFormatVersion + AssertDotnetFormatVersion function Main { @@ -18,4 +18,11 @@ function Main dotnet format --exclude "**/DocTest*.cs" } -$previousLocation = Get-Location; try { Main } finally { Set-Location $previousLocation } +$previousLocation = Get-Location; try +{ + Main +} +finally +{ + Set-Location $previousLocation +} diff --git a/src/PackageRelease.ps1 b/src/PackageRelease.ps1 index 3ea337070..a94efc257 100644 --- a/src/PackageRelease.ps1 +++ b/src/PackageRelease.ps1 @@ -61,7 +61,7 @@ function Main $versionRe = [Regex]::new( '^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|1[0-9]|2[0-9]|3[0-1])' + - '(\.(alpha|beta))?$') + '(\.(alpha|beta))?$') $latestVersionRe = [Regex]::new('^LATEST(\.(alpha|beta))?$')