mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-23 05:02:15 -05:00
Update PowerShell module validation
This commit is contained in:
parent
9b13062ca0
commit
5f2cd423a4
1 changed files with 23 additions and 25 deletions
|
@ -57,7 +57,7 @@ function LintCodebase()
|
||||||
else
|
else
|
||||||
# Success
|
# Success
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
||||||
echo "Successfully found binary in system"
|
echo "Successfully found binary for [$LINTER_NAME] in system"
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -67,32 +67,30 @@ function LintCodebase()
|
||||||
###############################################################
|
###############################################################
|
||||||
if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
|
if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
|
||||||
VALIDATE_PSSA_MODULE=$(pwsh -c "(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name" 2>&1)
|
VALIDATE_PSSA_MODULE=$(pwsh -c "(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name" 2>&1)
|
||||||
echo "VALIDATE_PSSA_MODULE: $VALIDATE_PSSA_MODULE"
|
# If module found, ensure Invoke-ScriptAnalyzer command is available
|
||||||
fi
|
if [[ "$VALIDATE_PSSA_MODULE" == "PSScriptAnalyzer" ]]; then
|
||||||
# If module found, ensure Invoke-ScriptAnalyzer command is available
|
VALIDATE_PSSA_CMD=$(pwsh -c "(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name" 2>&1)
|
||||||
if [[ "$VALIDATE_PSSA_MODULE" == "PSScriptAnalyzer" ]]; then
|
fi
|
||||||
VALIDATE_PSSA_CMD=$(pwsh -c "(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name" 2>&1)
|
|
||||||
echo "VALIDATE_PSSA_CMD: $VALIDATE_PSSA_CMD"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
#######################
|
#######################
|
||||||
ERROR_CODE=$?
|
ERROR_CODE=$?
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Check the shell for errors #
|
# Check the shell for errors #
|
||||||
##############################
|
##############################
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
# Failed
|
# Failed
|
||||||
echo "ERROR! Failed to import [PSScriptAnalyzer] for [$LINTER_NAME] in system!"
|
echo "ERROR! Failed find module [PSScriptAnalyzer] for [$LINTER_NAME] in system!"
|
||||||
echo "ERROR:[PSSA_MODULE $VALIDATE_PSSA_MODULE] [PSSA_CMD $VALIDATE_PSSA_CMD]"
|
echo "ERROR:[PSSA_MODULE $VALIDATE_PSSA_MODULE] [PSSA_CMD $VALIDATE_PSSA_CMD]"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Success
|
# Success
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
||||||
echo "Successfully imported module [$VALIDATE_PSSA_MODULE]"
|
echo "Successfully found module [$VALIDATE_PSSA_MODULE] in system"
|
||||||
echo "Successfully found command in system [$VALIDATE_PSSA_CMD]"
|
echo "Successfully found command [$VALIDATE_PSSA_CMD] in system"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue