Title: preferences file does not support $env: variables · Issue #2126 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: preferences file does not support $env: variables · Issue #2126 · PowerShell/PSScriptAnalyzer
X Title: preferences file does not support $env: variables · Issue #2126 · PowerShell/PSScriptAnalyzer
Description: Expected behavior # # PSScriptAnalyzerSettings.psd1 # @{ # CustomRulePath = "rules.psm1" # } Invoke-ScriptAnalyzer -Path .\test.ps1 -Settings ./PSScriptAnalyzerSettings.psd1 outputs: (correct) RuleName Severity ScriptName Line Message --...
Open Graph Description: Expected behavior # # PSScriptAnalyzerSettings.psd1 # @{ # CustomRulePath = "rules.psm1" # } Invoke-ScriptAnalyzer -Path .\test.ps1 -Settings ./PSScriptAnalyzerSettings.psd1 outputs: (correct) Rule...
X Description: Expected behavior # # PSScriptAnalyzerSettings.psd1 # @{ # CustomRulePath = "rules.psm1" # } Invoke-ScriptAnalyzer -Path .\test.ps1 -Settings ./PSScriptAnalyzerSettings.psd1 outputs: (cor...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/2126
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"preferences file does not support $env: variables","articleBody":"Expected behavior\n-----------------\n\n```PowerShell\n# # PSScriptAnalyzerSettings.psd1\n# @{\n# CustomRulePath = \"rules.psm1\"\n# }\nInvoke-ScriptAnalyzer -Path .\\test.ps1 -Settings ./PSScriptAnalyzerSettings.psd1\n```\noutputs: (correct)\n```none\nRuleName Severity ScriptName Line Message\n-------- -------- ---------- ---- -------\nPSAvoidInvokeSomething Warning test.ps1 1 The command 'Invoke-Something' should not be used. Please\n use 'Invoke-SomethingElse' instead\n```\n\n\nActual behavior\n---------------\n```powershell\n# # PSScriptAnalyzerSettings.psd1\n# @{\n# CustomRulePath = \"$PSScriptRoot/rules.psm1\"\n# }\nInvoke-ScriptAnalyzer -Path .\\test.ps1 -Settings ./PSScriptAnalyzerSettings.psd1\n```\n\nOutputs:\n```none\nInvoke-ScriptAnalyzer: Value in the settings hashtable should be a string or an array of strings: line 2 column 22 in file [...]\\Powershell\\PSScriptAnalyzerSettings.psd1\n```\n\nReasoning\n----------------\naccording to this [article](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.5\u0026viewFallbackFrom=powershell-6#restricted-language-restrictedlanguage), \n\n\u003eModule manifests are loaded in RestrictedLanguage mode and may use these additional variables:\n\u003e $PSScriptRoot\n\u003e $PSEdition\n\u003e $EnabledExperimentalFeatures\n\u003e Any environment variable, like $env:TEMP\n\nrelative file paths CustomRulePath for my environment\nwere resolving relative to the cwd instead of relative to the settings.file in neovim. the \n./rules.psm1 and rules.psm1 were not resolving correctly.\n\n`~/.../Powershell/PSScriptAnalyzerSettings.psd1`\nwhere '~' expands to HOMEDIR does work\n\nEnvironment data\n----------------\n\n\u003c!-- Provide the output of the following 2 commands --\u003e\n\n```PowerShell\n\u003e $PSVersionTable\nName Value\n---- -----\nPSVersion 7.5.2\nPSEdition Core\nGitCommitId 7.5.2\nOS Microsoft Windows 10.0.26100\nPlatform Win32NT\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n\u003e (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\n1.24.0\n```\n","author":{"url":"https://github.com/eissar","@type":"Person","name":"eissar"},"datePublished":"2025-08-23T23:19:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2126/PSScriptAnalyzer/issues/2126"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a6061350-db27-0163-e4fc-f74ca6963e35 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 888A:3BE27E:21A7CA1:2E249A5:6964CDCF |
| html-safe-nonce | 0a76c7fe6804a341ea07025c31b524b848b31003e4e332372638841365338495 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODhBOjNCRTI3RToyMUE3Q0ExOjJFMjQ5QTU6Njk2NENEQ0YiLCJ2aXNpdG9yX2lkIjoiMTMwNjYzMDA3OTQzMjE1MDQ3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7e6e78c8112ed967577af24b7fee14d8194add6ea009103cebefef8b52264284 |
| hovercard-subject-tag | issue:3348918509 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PSScriptAnalyzer/2126/issue_layout |
| twitter:image | https://opengraph.githubassets.com/01194146d5371ebe69f65961eb36378162365d09982620a244c8d964cc148af0/PowerShell/PSScriptAnalyzer/issues/2126 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/01194146d5371ebe69f65961eb36378162365d09982620a244c8d964cc148af0/PowerShell/PSScriptAnalyzer/issues/2126 |
| og:image:alt | Expected behavior # # PSScriptAnalyzerSettings.psd1 # @{ # CustomRulePath = "rules.psm1" # } Invoke-ScriptAnalyzer -Path .\test.ps1 -Settings ./PSScriptAnalyzerSettings.psd1 outputs: (correct) Rule... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eissar |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5838582163a1256e5ebd5086b7e1dc5cea93d82086c9c8b1395fb50f6ddab28d |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 33149177 |
| octolytics-dimension-repository_nwo | PowerShell/PSScriptAnalyzer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33149177 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PSScriptAnalyzer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8f997e7f84bd1db9537ba403fa68be0da3423594 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width