-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1403 from Badgerati/develop
v2.11.0
- Loading branch information
Showing
364 changed files
with
29,024 additions
and
10,142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Codespace with PowerShell, Pester, Invoke-Build, and .NET 8", | ||
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu", | ||
"features": { | ||
"ghcr.io/devcontainers/features/powershell:1": {}, | ||
"ghcr.io/devcontainers/features/dotnet:1": { | ||
"version": "8.0" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-vscode.powershell", | ||
"pspester.pester-test" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "pwsh -Command 'Install-Module -Name InvokeBuild,Pester -Force -SkipPublisherCheck; sleep 5; Invoke-Build Build '" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ env: | |
POWERSHELL_VERSION: 'Preview' | ||
|
||
jobs: | ||
build: | ||
build-preview: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ jobs: | |
name: Add issue to project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected].1 | ||
- uses: actions/[email protected].2 | ||
with: | ||
project-url: https://github.com/users/Badgerati/projects/2 | ||
github-token: ${{ secrets.PROJECT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ jobs: | |
name: Add issue to project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected].1 | ||
- uses: actions/[email protected].2 | ||
with: | ||
project-url: https://github.com/users/Badgerati/projects/2 | ||
github-token: ${{ secrets.PROJECT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
# PSScriptAnalyzerSettings.psd1 | ||
@{ | ||
Severity = @('Error', 'Warning', 'Information') | ||
Severity = @('Error', 'Warning', 'Information') | ||
IncludeDefaultRules = $true | ||
|
||
Rules = @{ | ||
CustomRulePath = @( | ||
'./analyzers/AvoidNewObjectRule.psm1' | ||
) | ||
|
||
Rules = @{ | ||
PSReviewUnusedParameter = @{ | ||
CommandsToTraverse = @( | ||
'Where-Object','Remove-PodeRoute' | ||
'Where-Object', | ||
'Remove-PodeRoute' | ||
) | ||
} | ||
AvoidNewObjectRule = @{ | ||
Severity = 'Warning' | ||
} | ||
} | ||
ExcludeRules = @('PSAvoidUsingCmdletAliases' ,'PSAvoidUsingPlainTextForPassword','PSAvoidUsingWriteHost','PSAvoidUsingInvokeExpression','PSUseShouldProcessForStateChangingFunctions', | ||
'PSAvoidUsingUsernameAndPasswordParams','PSUseProcessBlockForPipelineCommand','PSAvoidUsingConvertToSecureStringWithPlainText','PSUseSingularNouns','PSReviewUnusedParameter' ) | ||
|
||
ExcludeRules = @( | ||
'PSAvoidUsingPlainTextForPassword', | ||
'PSUseShouldProcessForStateChangingFunctions', | ||
'PSAvoidUsingUsernameAndPasswordParams', | ||
'PSUseProcessBlockForPipelineCommand', | ||
'PSAvoidUsingConvertToSecureStringWithPlainText', | ||
'PSReviewUnusedParameter', | ||
'PSAvoidAssignmentToAutomaticVariable', | ||
'PSUseBOMForUnicodeEncodedFile', | ||
'PSAvoidTrailingWhitespace' | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function Measure-AvoidNewObjectRule { | ||
[CmdletBinding()] | ||
[OutputType([Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord[]])] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.Management.Automation.Language.ScriptBlockAst] | ||
$ScriptBlockAst | ||
) | ||
|
||
# Initialize an empty array to collect diagnostic records | ||
$diagnostics = @() | ||
|
||
try { | ||
# Traverse the AST to find all instances of New-Object cmdlet | ||
$ScriptBlockAst.FindAll({ | ||
param($Ast) | ||
$Ast -is [System.Management.Automation.Language.CommandAst] -and | ||
$Ast.CommandElements[0].Extent.Text -eq 'New-Object' | ||
}, $true) | ForEach-Object { | ||
$diagnostics += [PSCustomObject]@{ | ||
Message = "Avoid using 'New-Object' and use '::new()' instead." | ||
Extent = $_.Extent | ||
RuleName = 'AvoidNewObjectRule' | ||
Severity = 'Warning' | ||
ScriptName = $FileName | ||
} | ||
} | ||
|
||
# Return the diagnostic records | ||
return $diagnostics | ||
} | ||
catch { | ||
$PSCmdlet.ThrowTerminatingError($PSItem) | ||
} | ||
} | ||
|
||
Export-ModuleMember -Function Measure-AvoidNewObjectRule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.