Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 15 additions & 6 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#requires -Version 5

[CmdletBinding()]
Param

Check warning on line 4 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Param' to 'param'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHe&open=AZ8OotKzlDUuF1_p1MHe&pullRequest=281
(
$RootProjectDir,
$Configuration = 'Release',
Expand Down Expand Up @@ -30,11 +30,11 @@
'powershell-yaml' = $null
'ps1xmlgen' = $null
'PlatyPS' = $null
'Pester' = @{ MinimumVersion = '5.0' }
'Pester' = @{ RequiredVersion = '6.0.0-rc4'; AllowPrerelease = $true }
}
}

Function Assert-DotNetSdk {

Check warning on line 37 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHf&open=AZ8OotKzlDUuF1_p1MHf&pullRequest=281
$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue
if (-not $dotnet) {
throw "dotnet SDK not found. Please install .NET SDK 8 or later from https://dotnet.microsoft.com/download"
Expand All @@ -53,7 +53,7 @@
Write-Verbose "dotnet SDK $sdkVersion found"
}

Function Install-Dependencies {

Check warning on line 56 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHg&open=AZ8OotKzlDUuF1_p1MHg&pullRequest=281
Write-Verbose "Restoring missing dependencies"

$dotNetTools = $script:DependencyVersions.DotNetTools
Expand All @@ -77,7 +77,7 @@
}
}

Function Install-DotNetTool($Tool, $Version) {

Check warning on line 80 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHh&open=AZ8OotKzlDUuF1_p1MHh&pullRequest=281
Write-Verbose "Restoring dotnet local tool $Tool $Version"

# Ensure a tool manifest exists
Expand All @@ -102,7 +102,7 @@
dotnet tool install --local $Tool --version $Version *>&1 | Write-Verbose
}

Function Install-NugetPackage($Package, $Version, $OutputDirectory = 'packages') {

Check warning on line 105 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHi&open=AZ8OotKzlDUuF1_p1MHi&pullRequest=281
Write-Verbose "Restoring NuGet package $Package"

$pkgDir = Join-Path $RootProjectDir "$OutputDirectory/$Package"
Expand All @@ -118,15 +118,19 @@
dotnet nuget @addArgs *>&1 | Write-Verbose
}

Function Install-PsModule($Module, $Version) {

Check warning on line 121 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHk&open=AZ8OotKzlDUuF1_p1MHk&pullRequest=281

Check failure on line 121 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHj&open=AZ8OotKzlDUuF1_p1MHj&pullRequest=281
Write-Verbose "Restoring module $Module"

$minVersion = if ($Version -is [hashtable]) { $Version['MinimumVersion'] } else { $null }
$exactVersion = if ($Version -is [hashtable]) { $null } else { $Version }
$exactVersion = if ($Version -is [hashtable]) { $Version['RequiredVersion'] } else { $Version }
$allowPrerelease = ($Version -is [hashtable]) -and $Version['AllowPrerelease']

$existing = Get-Module $Module -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1
if ($existing) {
if ($exactVersion -and $existing.Version -ne [version]$exactVersion) { <# fall through to install #> }
$existingVersion = $existing.Version.ToString()
if ($existing.PrivateData.PSData.Prerelease) { $existingVersion = "$existingVersion-$($existing.PrivateData.PSData.Prerelease)" }

if ($exactVersion -and $existingVersion -ne $exactVersion) { <# fall through to install #> }
elseif ($minVersion -and $existing.Version -lt [version]$minVersion) { <# fall through to install #> }
else {
Write-Verbose "PowerShell module $Module found; Skipping..."
Expand All @@ -140,8 +144,9 @@
}

$installArgs = @{ Name = $Module; Scope = 'CurrentUser'; Force = $true; AllowClobber = $true }
if ($exactVersion) { $installArgs['RequiredVersion'] = $exactVersion }
if ($minVersion) { $installArgs['MinimumVersion'] = $minVersion }
if ($exactVersion) { $installArgs['RequiredVersion'] = $exactVersion }
if ($minVersion) { $installArgs['MinimumVersion'] = $minVersion }
if ($allowPrerelease) { $installArgs['AllowPrerelease'] = $true }
Install-Module @installArgs | Write-Verbose
}

Expand Down Expand Up @@ -200,6 +205,8 @@

$pesterSpec = $script:DependencyVersions.PsModules['Pester']
$pesterMinVersion = if ($pesterSpec -is [hashtable]) { $pesterSpec['MinimumVersion'] } else { $null }
$pesterRequiredVersion = if ($pesterSpec -is [hashtable]) { $pesterSpec['RequiredVersion'] } else { $pesterSpec }
$pesterAllowPrerelease = ($pesterSpec -is [hashtable]) -and $pesterSpec['AllowPrerelease']

Invoke-Psake -Nologo -BuildFile $psakeScript -TaskList $Targets -Verbose:$IsVerbose -ErrorAction SilentlyContinue `
-Parameters @{
Expand All @@ -210,12 +217,14 @@
ModuleDescription = $ModuleDescription
BuildName = $BuildName
BuildNumber = $ProjectBuildNumber
VersionMetadata = $VersionMetadata

Check warning on line 220 in Build.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotKzlDUuF1_p1MHl&open=AZ8OotKzlDUuF1_p1MHl&pullRequest=281
SkipTests = $SkipTests.IsPresent
SkipReleaseNotes = $SkipReleaseNotes.IsPresent
Incremental = $Incremental.IsPresent
IsCI = $isCI
PesterMinVersion = $pesterMinVersion
PesterMinVersion = $pesterMinVersion
PesterRequiredVersion = $pesterRequiredVersion
PesterAllowPrerelease = $pesterAllowPrerelease
}

Write-Verbose "=== END PSAKE ==="
Expand Down
12 changes: 10 additions & 2 deletions psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$CompatiblePSEditions = @('Desktop', 'Core')
$TfsPackageNames = @('Microsoft.TeamFoundationServer.ExtendedClient', 'Microsoft.VisualStudio.Services.ServiceHooks.WebApi', 'Microsoft.VisualStudio.Services.Release.Client')
$Copyright = "(c) 2014 ${ModuleAuthor}. All rights reserved."

Check warning on line 33 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHy&open=AZ8OotPLlDUuF1_p1MHy&pullRequest=281
# Nuget packaging
$NugetExePath = Join-Path $RootProjectDir 'BuildTools/nuget.exe'
$NugetPackagesDir = Join-Path $RootProjectDir 'Packages'
Expand All @@ -57,6 +57,8 @@

# Test dependencies
$PesterMinVersion = $null
$PesterRequiredVersion = $null
$PesterAllowPrerelease = $false
}

Task Rebuild -Depends Clean, Build {
Expand All @@ -74,8 +76,8 @@
Task CleanOutputDir -PreCondition { -not $Incremental } {

Write-Verbose "Cleaning output path $ModuleDir"

Check warning on line 79 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHz&open=AZ8OotPLlDUuF1_p1MHz&pullRequest=281
if (Test-Path $ModuleDir -PathType Container) {

Check warning on line 80 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH0&open=AZ8OotPLlDUuF1_p1MH0&pullRequest=281
Remove-Item $ModuleDir -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
}

Expand Down Expand Up @@ -113,7 +115,7 @@
exec { & $xmldocExePath $assemblyFile -out $helpFile -rootUrl $RootUrl | Write-Verbose }

$helpContents = (Get-Content $helpFile -Raw -Encoding utf8)
$helpTokens = (Invoke-Expression (Get-Content (Join-Path $RootProjectDir 'Docs/CommonHelpText.psd1') -Raw -Encoding utf8))

Check failure on line 118 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of Invoke-Expression.

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHm&open=AZ8OotPLlDUuF1_p1MHm&pullRequest=281

foreach ($token in $helpTokens.GetEnumerator()) {
$helpContents = $helpContents -replace $token.Key, $token.Value
Expand Down Expand Up @@ -178,22 +180,22 @@

Task UpdateModuleManifest {

Function GetExportedFunctionsList {

Check warning on line 183 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHn&open=AZ8OotPLlDUuF1_p1MHn&pullRequest=281
$modulePath = (Join-Path $SolutionDir "TfsCmdlets/bin/$Configuration/$($TargetFrameworks.Desktop)/TfsCmdlets.dll")
Get-Module TfsCmdlets | Remove-Module
Import-Module $modulePath
return @(
Get-Command -Module TfsCmdlets -ErrorAction SilentlyContinue |

Check warning on line 188 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH1&open=AZ8OotPLlDUuF1_p1MH1&pullRequest=281
Where-Object { $_.Visibility -eq 'Public' } |

Check warning on line 189 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH2&open=AZ8OotPLlDUuF1_p1MH2&pullRequest=281
Sort-Object -Property Name |
Select-Object -ExpandProperty Name)

}

Function GetFileList {

Check warning on line 195 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHo&open=AZ8OotPLlDUuF1_p1MHo&pullRequest=281
return (
Get-ChildItem -Path $ModuleDir -File -Recurse -Exclude *.resources.dll |

Check warning on line 197 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH3&open=AZ8OotPLlDUuF1_p1MH3&pullRequest=281
Select-Object -ExpandProperty FullName |

Check warning on line 198 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH4&open=AZ8OotPLlDUuF1_p1MH4&pullRequest=281
ForEach-Object { "$($_.SubString($ModuleDir.Length+1))" })
}

Expand Down Expand Up @@ -247,15 +249,21 @@

try {
Write-Output ' == PowerShell Core =='
if ($PesterMinVersion) {
if ($PesterRequiredVersion) {
$allowPrereleaseArg = if ($PesterAllowPrerelease) { '-AllowPrerelease' } else { '' }
Exec { pwsh.exe -NonInteractive -NoLogo -Command "if (-not (Get-Module Pester -ListAvailable | Where-Object { `$version = `$_.Version.ToString(); if (`$_.PrivateData.PSData.Prerelease) { `$version = `$version + '-' + `$_.PrivateData.PSData.Prerelease }; `$version -eq '$PesterRequiredVersion' })) { Install-Module Pester -RequiredVersion $PesterRequiredVersion $allowPrereleaseArg -Force -Scope CurrentUser -SkipPublisherCheck -AllowClobber }" }
} elseif ($PesterMinVersion) {
Exec { pwsh.exe -NonInteractive -NoLogo -Command "if (-not (Get-Module Pester -ListAvailable | Where-Object { `$_.Version -ge [version]'$PesterMinVersion' })) { Install-Module Pester -MinimumVersion $PesterMinVersion -Force -Scope CurrentUser -SkipPublisherCheck -AllowClobber }" }
}
Exec { pwsh.exe -NonInteractive -NoLogo -Command "`$cfg = New-PesterConfiguration; `$cfg.Run.Exit = `$true; `$cfg.TestResult.Enabled = `$true; `$cfg.Output.Verbosity = '$outputLevel'; `$cfg.Filter.ExcludeTag = @('Desktop', 'Server'); Invoke-Pester -Configuration `$cfg" }
Move-Item 'testResults.xml' -Destination $OutDir/TestResults-Pester-Core.xml -Force
Move-Item 'coverage.xml' -Destination $OutDir/Coverage-Pester-Core.xml -Force

Check warning on line 261 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH5&open=AZ8OotPLlDUuF1_p1MH5&pullRequest=281
Write-Output ' == PowerShell Desktop =='
if ($PesterMinVersion) {
if ($PesterRequiredVersion) {
$allowPrereleaseArg = if ($PesterAllowPrerelease) { '-AllowPrerelease' } else { '' }
Exec { powershell.exe -NonInteractive -NoLogo -Command "if (-not (Get-Module Pester -ListAvailable | Where-Object { `$version = `$_.Version.ToString(); if (`$_.PrivateData.PSData.Prerelease) { `$version = `$version + '-' + `$_.PrivateData.PSData.Prerelease }; `$version -eq '$PesterRequiredVersion' })) { Install-Module Pester -RequiredVersion $PesterRequiredVersion $allowPrereleaseArg -Force -Scope CurrentUser -SkipPublisherCheck -AllowClobber }" }
} elseif ($PesterMinVersion) {
Exec { powershell.exe -NonInteractive -NoLogo -Command "if (-not (Get-Module Pester -ListAvailable | Where-Object { `$_.Version -ge [version]'$PesterMinVersion' })) { Install-Module Pester -MinimumVersion $PesterMinVersion -Force -Scope CurrentUser -SkipPublisherCheck -AllowClobber }" }
}
Exec { powershell.exe -NonInteractive -NoLogo -Command "`$cfg = New-PesterConfiguration; `$cfg.Run.Exit = `$true; `$cfg.TestResult.Enabled = `$true; `$cfg.Output.Verbosity = '$outputLevel'; `$cfg.Filter.ExcludeTag = @('Core', 'Server'); Invoke-Pester -Configuration `$cfg" }
Expand All @@ -269,10 +277,10 @@

Task RemoveEmptyFolders {

Get-ChildItem $ModuleDir -Recurse -Force -Directory |

Check warning on line 280 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH6&open=AZ8OotPLlDUuF1_p1MH6&pullRequest=281
Sort-Object -Property FullName -Descending |
Where-Object { $($_ | Get-ChildItem -Force | Select-Object -First 1).Count -eq 0 } |
Remove-Item | Write-Verbose

Check warning on line 283 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Pipeline stages should have consistent indentation

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHp&open=AZ8OotPLlDUuF1_p1MHp&pullRequest=281
}

Task Clean {
Expand All @@ -290,7 +298,7 @@
Get-ChildItem (Join-Path $SolutionDir '*/bin') -Directory | Remove-Item -Recurse
Get-ChildItem (Join-Path $SolutionDir '*/obj') -Directory | Remove-Item -Recurse

}

Check warning on line 301 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH7&open=AZ8OotPLlDUuF1_p1MH7&pullRequest=281

Task ValidateReleaseNotes -PreCondition { -not $SkipReleaseNotes } {

Expand All @@ -317,7 +325,7 @@

Write-Verbose "Command line: [$cmdLine]"

Invoke-Expression $cmdLine *>&1 | Write-Verbose

Check failure on line 328 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of Invoke-Expression.

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHq&open=AZ8OotPLlDUuF1_p1MHq&pullRequest=281
}

Task PackageChocolatey -Depends PackageNuget, GenerateLicenseFile, GenerateVerificationFile {
Expand All @@ -339,14 +347,14 @@
<projectSourceUrl>$($nuspecXml.package.metadata.projectUrl)</projectSourceUrl>
<packageSourceUrl>$($nuspecXml.package.metadata.projectUrl)</packageSourceUrl>
"@

Check warning on line 350 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH8&open=AZ8OotPLlDUuF1_p1MH8&pullRequest=281
Set-Content $NugetSpecPath -Encoding utf8 -Value ($nuspec.Replace('<!-- choco-extras -->', $chocoExtras))

$cmdLine = "$ChocolateyPath Pack $ChocolateySpecPath -OutputDirectory $ChocolateyDir --Version $ThreePartVersion"

Write-Verbose "Command line: [$cmdLine]"

Invoke-Expression $cmdLine *>&1 | Write-Verbose

Check failure on line 357 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of Invoke-Expression.

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHr&open=AZ8OotPLlDUuF1_p1MHr&pullRequest=281
}

Task PackageMsi { #-Depends Build {
Expand All @@ -357,7 +365,7 @@
Copy-Item -Path $WixProjectDir\License.rtf -Destination $ModuleDir -Force
Copy-Item -Path $RootProjectDir\Assets\*.bmp -Destination $ModuleDir -Force

exec {

Check warning on line 368 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH9&open=AZ8OotPLlDUuF1_p1MH9&pullRequest=281
dotnet build $WixProjectFileName -o $WixOutputPath -v d `
-p WixSourceDir=$ModuleDir\ `
-p WixProductVersion=$ThreePartVersion `
Expand All @@ -378,7 +386,7 @@
-p TargetPath=$WixOutputPath\$ModuleName-$ThreePartVersion.msi `
*>&1 | Write-Verbose
}

Check warning on line 389 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH-&open=AZ8OotPLlDUuF1_p1MH-&pullRequest=281
if (-not (Test-Path $MSIDir)) { New-Item $MSIDir -ItemType Directory | Out-Null }

Copy-Item "$WixOutputPath\*.msi" -Destination $MSIDir -Force
Expand All @@ -386,19 +394,19 @@

Task PackageWinget -Depends PackageMsi {

Function GetMsiProperty($Path, $Property) {

Check warning on line 397 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHs&open=AZ8OotPLlDUuF1_p1MHs&pullRequest=281
try {
$windowsInstaller = New-Object -ComObject 'WindowsInstaller.Installer'
$database = $windowsInstaller.GetType().InvokeMember('OpenDatabase', 'InvokeMethod', $null, $windowsInstaller, @((Get-Item -Path $Path).FullName, 0))
$view = $database.GetType().InvokeMember('OpenView', 'InvokeMethod', $null, $database, ("SELECT Value FROM Property WHERE Property = '$Property'"))
$view.GetType().InvokeMember('Execute', 'InvokeMethod', $null, $view, $null)
$record = $view.GetType().InvokeMember('Fetch', 'InvokeMethod', $null, $view, $null)
$value = ($record.GetType().InvokeMember('StringData', 'GetProperty', $null, $record, 1) -Join '').Replace(' ', '')

Check warning on line 404 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of operator from '-Join' to '-join'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHt&open=AZ8OotPLlDUuF1_p1MHt&pullRequest=281

$view.GetType().InvokeMember('Close', 'InvokeMethod', $null, $view, $null)

return $value
}

Check warning on line 409 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MH_&open=AZ8OotPLlDUuF1_p1MH_&pullRequest=281
catch {
Write-Error -Message $_.ToString()
}
Expand All @@ -421,7 +429,7 @@

foreach ($f in (Get-ChildItem $WinGetProjectDir -File)) {
$outputPath = (Join-Path $WinGetOutDir $f.Name)
Get-Content $f.FullName -Raw | Invoke-Expression | Out-File $outputPath -Force

Check failure on line 432 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of Invoke-Expression.

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHu&open=AZ8OotPLlDUuF1_p1MHu&pullRequest=281
}
}

Expand Down Expand Up @@ -458,7 +466,7 @@
<description>$($SourceManifest.Description)</description>
<releaseNotes><![CDATA[$($SourceManifest.ReleaseNotes)]]></releaseNotes>
<copyright>$($SourceManifest.Copyright)</copyright>
<tags>$($SourceManifest.Tags -Join ' ')</tags>

Check warning on line 469 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of operator from '-Join' to '-join'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHv&open=AZ8OotPLlDUuF1_p1MHv&pullRequest=281
<!-- choco-extras -->
</metadata>
</package>
Expand All @@ -468,13 +476,13 @@
}

Task GenerateLicenseFile {

Check warning on line 479 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MIA&open=AZ8OotPLlDUuF1_p1MIA&pullRequest=281
$outLicenseFile = Join-Path $ChocolateyToolsDir 'LICENSE.txt'

if (-not (Test-Path $ChocolateyToolsDir -PathType Container)) {
New-Item $ChocolateyToolsDir -Force -ItemType Directory | Write-Verbose
}

Check warning on line 485 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MIB&open=AZ8OotPLlDUuF1_p1MIB&pullRequest=281
Copy-Item $RootProjectDir\LICENSE.md $outLicenseFile -Force -Recurse

$specFiles = Get-ChildItem $NugetPackagesDir -Include *.nuspec -Recurse
Expand Down Expand Up @@ -539,7 +547,7 @@

}

Function _IsUpToDate($Inputs, $Output) {

Check warning on line 550 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change case of keyword from 'Function' to 'function'

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHw&open=AZ8OotPLlDUuF1_p1MHw&pullRequest=281
if (-not $Incremental -or (-not (Test-Path $Output))) {
return $false
}
Expand All @@ -547,10 +555,10 @@
if ($Output -isnot [System.IO.FileSystemInfo]) {
$Output = Get-ChildItem $Output
}

Check warning on line 558 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove trailing whitespace from this line

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MIC&open=AZ8OotPLlDUuF1_p1MIC&pullRequest=281
foreach ($input in $Inputs) {
if ($input -isnot [System.IO.FileSystemInfo]) {
$input = Get-ChildItem $input

Check warning on line 561 in psake.ps1

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'$input' is a PowerShell automatic variable; use a different variable name.

See more on https://sonarcloud.io/project/issues?id=igoravl_TfsCmdlets&issues=AZ8OotPLlDUuF1_p1MHx&open=AZ8OotPLlDUuF1_p1MHx&pullRequest=281
}

if ($input.LastWriteTimeUtc -gt $Output.LastWriteTimeUtc) {
Expand Down
Loading