This file contains hidden or 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
| @{ | |
| ModuleVersion = '0.0.1' | |
| GUID = 'e97ebdb4-5356-4d0d-9a6d-c851e91bf456' | |
| NestedModules = @('Nested.psm1') | |
| FunctionsToExport = 'publicFunc' | |
| CmdletsToExport = '*' | |
| VariablesToExport = '*' | |
| AliasesToExport = '*' | |
| } |
This file contains hidden or 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
| function Write-PesterHostMessage { | |
| param( | |
| [Parameter(Position = 0, ValueFromPipeline = $true)] | |
| [Alias('Message', 'Msg')] | |
| $Object, | |
| [System.ConsoleColor] | |
| $ForegroundColor, | |
| [System.ConsoleColor] |
This file contains hidden or 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
| # Will show entries in Code Security Alerts and as PR-comments | |
| name: PSScriptAnalyzer Scan | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: |
This file contains hidden or 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
| # Install the SARIF Scan extension in Azure DevOps org. Will look for sarif-file in CodeAnalysisLogs artifact and show in Scans-tab | |
| # https://marketplace.visualstudio.com/items?itemName=sariftools.scans | |
| trigger: | |
| branches: | |
| include: | |
| - main | |
| paths: | |
| exclude: | |
| - .vscode/* | |
This file contains hidden or 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
| let reg = /(?:\$\{(?<specialName>.*?)(?<!`)\})|(?:\$(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nd}|[_?])+:(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nd}|[_?])+)|(?:\$(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nd}|[_?])+)/giu | |
| let str = " $pesterRuntimeInvocationContext = $PSCmdlet.SessionState.PSVariable.GetValue" | |
| reg.exec(str) | |
| // Changing the scoped group to \w, [a-zA-Z] etc. works fine), ex. | |
| // let reg = /(?:\$\{(?<specialName>.*?)(?<!`)\})|(?:\$[a-zA-Z]+:(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nd}|[_?])+)|(?:\$(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nd}|[_?])+)/giu |
This file contains hidden or 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
| Describe 'Module-scoped mocks' { | |
| BeforeAll { | |
| $module = "demoModule" | |
| $m = New-Module -Name $module -ScriptBlock { | |
| function Invoke-SomeAction { | |
| [CmdletBinding()] | |
| param ( | |
| ) |