This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new 7a1b7baed chore(powershell): Fix PSScriptAnalyzer warnings (#5158)
7a1b7baed is described below

commit 7a1b7baede4efaed92539e3315a7abc927a6fd81
Author: Ronny Berndt <[email protected]>
AuthorDate: Wed Jul 31 20:43:22 2024 +0200

    chore(powershell): Fix PSScriptAnalyzer warnings (#5158)
    
    Fix some PSScriptAnalyzer warnings and remove unused variable.
---
 configure.ps1 | 41 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/configure.ps1 b/configure.ps1
index 4dfc663bc..2734c9e73 100644
--- a/configure.ps1
+++ b/configure.ps1
@@ -145,7 +145,6 @@ $InstallDir="$LibDir\couchdb"
 $LogFile="$LogDir\couch.log"
 $BuildFauxton = (-not $DisableFauxton).ToString().ToLower()
 $BuildDocs = (-not $DisableDocs).ToString().ToLower()
-$Hostname = [System.Net.Dns]::GetHostEntry([string]"localhost").HostName
 $WithProper = (-not $DisableProper).ToString().ToLower()
 $ErlangMD5 = ($EnableErlangMD5).ToString().ToLower()
 $WithSpiderMonkey = (-not $DisableSpiderMonkey).ToString().ToLower()
@@ -252,14 +251,14 @@ $ConfigERL = @"
 "@
 $ConfigERL | Out-File "$rootdir\config.erl" -encoding ascii
 
-if (((Get-Command "rebar.cmd" -ErrorAction SilentlyContinue) -eq $null) -or
-    ((Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue) -eq $null) -or
-    ((Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue) -eq $null)) {
+if (($null -eq (Get-Command "rebar.cmd" -ErrorAction SilentlyContinue)) -or
+    ($null -eq (Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue)) -or
+    ($null -eq (Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue))) {
   $env:Path += ";$rootdir\bin"
 }
 
 # check for rebar; if not found, build it and add it to our path
-if ((Get-Command "rebar.cmd" -ErrorAction SilentlyContinue) -eq $null)
+if ($null -eq (Get-Command "rebar.cmd" -ErrorAction SilentlyContinue))
 {
    Write-Verbose "==> rebar.cmd not found; bootstrapping..."
    if (-Not (Test-Path "src\rebar"))
@@ -267,42 +266,42 @@ if ((Get-Command "rebar.cmd" -ErrorAction 
SilentlyContinue) -eq $null)
       git clone --depth 1 https://github.com/apache/couchdb-rebar.git 
$rootdir\src\rebar
    }
    cmd /c "cd src\rebar && $rootdir\src\rebar\bootstrap.bat"
-   cp $rootdir\src\rebar\rebar $rootdir\bin\rebar
-   cp $rootdir\src\rebar\rebar.cmd $rootdir\bin\rebar.cmd
+   Copy-Item $rootdir\src\rebar\rebar $rootdir\bin\rebar
+   Copy-Item $rootdir\src\rebar\rebar.cmd $rootdir\bin\rebar.cmd
    make -C $rootdir\src\rebar clean
 }
 
 # check for rebar3; if not found, build it and add it to our path
-if ((Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue) -eq $null)
+if ($null -eq (Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue))
 {
    Write-Verbose "==> rebar3.cmd not found; bootstrapping..."
    if (-Not (Test-Path "src\rebar3"))
    {
       git clone --depth 1 https://github.com/erlang/rebar3.git 
$rootdir\src\rebar3
    }
-   cd src\rebar3
+   Set-Location src\rebar3
    .\bootstrap.ps1
-   cp $rootdir\src\rebar3\rebar3 $rootdir\bin\rebar3
-   cp $rootdir\src\rebar3\rebar3.cmd $rootdir\bin\rebar3.cmd
-   cp $rootdir\src\rebar3\rebar3.ps1 $rootdir\bin\rebar3.ps1
+   Copy-Item $rootdir\src\rebar3\rebar3 $rootdir\bin\rebar3
+   Copy-Item $rootdir\src\rebar3\rebar3.cmd $rootdir\bin\rebar3.cmd
+   Copy-Item $rootdir\src\rebar3\rebar3.ps1 $rootdir\bin\rebar3.ps1
    make -C $rootdir\src\rebar3 clean
-   cd ..\..
+   Set-Location ..\..
 }
 
 # check for erlfmt; if not found, build it and add it to our path
-if ((Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue) -eq $null)
+if ($null -eq (Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue))
 {
    Write-Verbose "==> erlfmt.cmd not found; bootstrapping..."
    if (-Not (Test-Path "src\erlfmt"))
    {
       git clone --depth 1 https://github.com/WhatsApp/erlfmt.git 
$rootdir\src\erlfmt
    }
-   cd src\erlfmt
+   Set-Location src\erlfmt
    rebar3 as release escriptize
-   cp $rootdir\src\erlfmt\_build\release\bin\erlfmt $rootdir\bin\erlfmt
-   cp $rootdir\src\erlfmt\_build\release\bin\erlfmt.cmd $rootdir\bin\erlfmt.cmd
+   Copy-Item $rootdir\src\erlfmt\_build\release\bin\erlfmt $rootdir\bin\erlfmt
+   Copy-Item $rootdir\src\erlfmt\_build\release\bin\erlfmt.cmd 
$rootdir\bin\erlfmt.cmd
    make -C $rootdir\src\erlfmt clean
-   cd ..\..
+   Set-Location ..\..
 }
 
 $ClouseauDir = "$rootdir\clouseau"
@@ -337,9 +336,9 @@ if ($WithClouseau)
            Write-Output "ERROR: Clouseau distribution package (clouseau.zip) 
could not be extracted."
            exit 1
        }
-       mv "$ClouseauDir\*\*.jar" "$ClouseauDir"
-       rm "$ClouseauDir\clouseau-$ClouseauVersion"
-       rm clouseau.zip
+       Move-Item "$ClouseauDir\*\*.jar" "$ClouseauDir"
+       Remove-Item "$ClouseauDir\clouseau-$ClouseauVersion"
+       Remove-Item clouseau.zip
 
        Invoke-WebRequest -MaximumRedirection 1 -OutFile 
"$ClouseauDir\$Slf4jSimpleJar" $Slf4jSimpleUrl
        If ($LASTEXITCODE -ne 0) {

Reply via email to