René's URL Explorer Experiment


Title: Settings file creation and validation by liamjpeters · Pull Request #2176 · PowerShell/PSScriptAnalyzer · GitHub

Open Graph Title: Settings file creation and validation by liamjpeters · Pull Request #2176 · PowerShell/PSScriptAnalyzer

X Title: Settings file creation and validation by liamjpeters · Pull Request #2176 · PowerShell/PSScriptAnalyzer

Description: PR Summary Extracted and built upon the settings discoverability of my PR #2134 (omitting all of the JSON file format bits and settings refactoring). Adds cmdlet New-ScriptAnalyzerSettingsFile, which generates complete settings files with everything set to it's default value. Adds cmdlet Test-ScriptAnalyzerSettingsFile, which validates a settings file (All rule names are valid, all settings valid etc). Updates cmdlet Get-ScriptAnalyzerRule to include an Options proprety for configurable rules, including default value. Fixes ProcessCustomRulePaths Engine Helper to ignore an empty array of CustomRulePaths. Motivation It's not easy or convenient to find out what all the rules and rule settings available are. Your options are really to look at this repo, copy a preset/existing settings file, or look through all of the rules pages on MSLearn. Many people do not even know about settings files. As a module developer, I want a way to discover what the available rules are and what options they have. I want an effortless way to add a settings file to my project that I can configure to my liking. New-ScriptAnalyzerSettingsFile By default this creates a ScriptAnalyzer settings file populated with all rule names and rule configuration (set to default values). The file has some comment help for each field. The file is always named PSScriptAnalyzerSettings.psd1 so that automatic settings discovery in Invoke-ScriptAnalyzer picks it up without any -Settings parameter needed. Any rule configuration that is an enum - we attempt to list the possible values as a comment after the default value. Example output of running New-ScriptAnalyzerSettingsFile in this gist You can optionally base the rule file on a preset. It takes the settings defined in the preset and normalises it all with the comments and all settings fields. Example output of running New-ScriptAnalyzerSettingsFile -BaseOnPreset CmdletDesign in this gist. Note: I'm sure some clever person could eventually plumb this into the VSCode extension, as a code action to create a new settings file perhaps. Test-ScriptAnalyzerSettingsFile This validates a settings file and tells you exactly what's wrong and where. It checks for: Parse errors Unknown rule names in IncludeRules, ExcludeRules, and Rules Rules in Rules that aren't configurable Unrecognised option names Option values that don't match the expected type (bool, int, string, arrays) Enum string values (e.g. Kind = 'banana' when the valid values are space and tab) Invalid severity values Each problem comes back as a DiagnosticRecord, unless -Quiet mode used - then just a boolean $true`$false` indicating whether the file is valid or not is returned. I debated for a while whether this should have just been a rule and after some chicken-or-egg thinking, decided it should be a separate cmdlet. Get-ScriptAnalyzerRule Added an Options property to the RuleInfo. I have not updated the format file, so it's not shown by default. I didn't know the implications of updating the format file. Running Get-ScriptAnalyzerRule -Name PSUseConsistentIndentation | select -expand Options gets you: Name OptionType DefaultValue PossibleValues ---- ---------- ------------ -------------- Enable System.Boolean False IndentationSize System.Int32 4 Kind System.String space {Space, Tab} PipelineIndentation System.String IncreaseIndentationForFirstPipeline {IncreaseIndentationForFirstPipeline, ... Successful test run in my fork. PR Checklist PR has a meaningful title Use the present tense and imperative mood when describing your changes Summarized changes Change is not breaking Make sure all .cs, .ps1 and .psm1 files have the correct copyright header Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation This PR is ready to merge and is not Work in Progress. If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.

Open Graph Description: PR Summary Extracted and built upon the settings discoverability of my PR #2134 (omitting all of the JSON file format bits and settings refactoring). Adds cmdlet New-ScriptAnalyzerSettingsFile, wh...

X Description: PR Summary Extracted and built upon the settings discoverability of my PR #2134 (omitting all of the JSON file format bits and settings refactoring). Adds cmdlet New-ScriptAnalyzerSettingsFile, wh...

Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/pull/2176

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4b289756-7e70-0294-1df6-2f409a08f9f1
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDFB2:37676C:14197D:1AD6C0:6AFD0F3E
html-safe-nonce258c4ea2695519d532d10e4d7cadcf1f042a0778d7009a66ed0e8a9076693ec2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkIyOjM3Njc2QzoxNDE5N0Q6MUFENkMwOjZBRkQwRjNFIiwidmlzaXRvcl9pZCI6IjExNjk1NDc1OTk2ODI1MzkzMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4aea9fc050453194171548897b54780ee9b27b9301c7e9b117ad3db2d2eff4b7
hovercard-subject-tagpull_request:3562615174
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
twitter:imagehttps://avatars.githubusercontent.com/u/6566675?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/6566675?s=400&v=4
og:image:altPR Summary Extracted and built upon the settings discoverability of my PR #2134 (omitting all of the JSON file format bits and settings refactoring). Adds cmdlet New-ScriptAnalyzerSettingsFile, wh...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb29de2abb97b6307b16270785efeb58b51a117d5a9b659acf00b77aa00e7043b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id33149177
octolytics-dimension-repository_nwoPowerShell/PSScriptAnalyzer
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id33149177
octolytics-dimension-repository_network_root_nwoPowerShell/PSScriptAnalyzer
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c9e619def6d670dc18a45d3b02cea938c1c7e47
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fpull%2F2176%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fpull%2F2176%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=PowerShell%2FPSScriptAnalyzer
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
PowerShellhttps://github.com/PowerShell
PSScriptAnalyzerhttps://github.com/PowerShell/PSScriptAnalyzer
Codehttps://github.com/PowerShell/PSScriptAnalyzer
Issues407 (407)https://github.com/PowerShell/PSScriptAnalyzer/issues
Pull requests34 (34)https://github.com/PowerShell/PSScriptAnalyzer/pulls
Discussionshttps://github.com/PowerShell/PSScriptAnalyzer/discussions
Actionshttps://github.com/PowerShell/PSScriptAnalyzer/actions
Projectshttps://github.com/PowerShell/PSScriptAnalyzer/projects
Wikihttps://github.com/PowerShell/PSScriptAnalyzer/wiki
Security and qualityhttps://github.com/PowerShell/PSScriptAnalyzer/security
Insightshttps://github.com/PowerShell/PSScriptAnalyzer/insights
Sign up for GitHub https://github.com/signup?return_to=%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2Fnew%2Fchoose
Andy Jordan (andyleejordan)https://github.com/andyleejordan
PowerShell:mainhttps://github.com/PowerShell/PSScriptAnalyzer/tree/main
liamjpeters:new-test-settings-file-cmdletshttps://github.com/liamjpeters/PSScriptAnalyzer/tree/new-test-settings-file-cmdlets
Conversation 12 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176
Commits 6 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits
Checks 4 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/checks
Files changed https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Settings file creation and validation https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#top
Show all changes 6 commits https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
239b039 Add RuleOptionInfo class and update RuleInfo to include options for c… liamjpeters Apr 17, 2026 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits/239b03982202df87bd8d0e3e8d941c9313d22f0e
a09c6de Add Test and New Cmdlets for PSScriptAnalyzer Settings Management liamjpeters Apr 20, 2026 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits/a09c6de00822ec27b03578244b5aacbaf46517d3
ab9baf5 Enhance ScriptAnalyzer settings file validation and documentation liamjpeters Apr 21, 2026 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits/ab9baf53ca84a5c272b07b5cbc5e5d5cc5b407b3
be0980b Merge branch 'main' into new-test-settings-file-cmdlets liamjpeters May 5, 2026 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits/be0980b7f2deef4e00beb9a5e4247b35d92732c7
269207f Apply docs suggestions from Sean's review liamjpeters May 5, 2026 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits/269207f04d16e44c6a0060fa70f4a19b113c9fc2
06164d0 Add Copilot review suggestions liamjpeters May 5, 2026 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/commits/06164d0f6f7713ad864abd2b68ace7e38d3bd11c
Clear filters https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
GetScriptAnalyzerRuleCommand.cs https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-dc90af740b04df714108af9179c47d97d45aecdd55c6dcfb2c71439cb4ad25a6
NewScriptAnalyzerSettingsFileCommand.cs https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-d01ac7616a723917c9624b58ca703479d31b31f5b836b056735e9853db6feb19
TestScriptAnalyzerSettingsFileCommand.cs https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-e1cc2e2ed152ab7dd70f39734d033005a1663f89d0279a2b701483f8ecfed23c
RuleInfo.cs https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-471598b8c6985e8a8113d8f741d5541646fadbac421f9f6a0c928440b584fbf0
RuleOptionInfo.cs https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-197f378b6253a40e61eabbe605ae33811076a7956b0ca6c9a5badb99b4834e5c
Helper.cs https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-427edd792ddc5404af08d95e98ffdd68d3d282caa731e104ee2c1a1998c506b9
PSScriptAnalyzer.psd1 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-fcf97ca2b0aec9d9564cafdb5f9d45eef93e1824aa697e7f7cbc2b041fc9257f
PSScriptAnalyzer.psm1 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-d83e68dff095221252728c2df9758bfdb5d04af7af2ef8f28a4392b5102ce895
Strings.resx https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-5ebe9c663a63162f460a9f3b7560cd498ed06ece2b6a47534fa5cb39164ab5e3
GetScriptAnalyzerRule.tests.ps1 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-2999e95c336a14ae8a92b0c336e6709d25ccba6062c55462f0b9cc6d2f87ed68
NewScriptAnalyzerSettingsFile.tests.ps1 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-8d60fb253d681fd72f475a07728e02fe832d9afd0e82faa519ebfb0ded044128
TestScriptAnalyzerSettingsFile.tests.ps1 https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-e4dc81289f07837ce15a4c1b1e3b2e8d4fc135bbe50c75abad1c5f73747c35f8
New-ScriptAnalyzerSettingsFile.md https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-fd5062a317a1f47f71d0bfb1294b6b11fc1ca1c4d530a106ed1a574f189042f5
Test-ScriptAnalyzerSettingsFile.md https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-ef23800c7a7bc4db5e72954de5ef910da2624c9724b9e51cb684d7093f7f1a24
https://github.com/PowerShell/PSScriptAnalyzer/blob/main/.github/CODEOWNERS#L2
Engine/Commands/GetScriptAnalyzerRuleCommand.cshttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-dc90af740b04df714108af9179c47d97d45aecdd55c6dcfb2c71439cb4ad25a6
View file https://github.com/liamjpeters/PSScriptAnalyzer/blob/06164d0f6f7713ad864abd2b68ace7e38d3bd11c/Engine/Commands/GetScriptAnalyzerRuleCommand.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/{{ revealButtonHref }}
https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-dc90af740b04df714108af9179c47d97d45aecdd55c6dcfb2c71439cb4ad25a6
https://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-dc90af740b04df714108af9179c47d97d45aecdd55c6dcfb2c71439cb4ad25a6
https://github.com/PowerShell/PSScriptAnalyzer/blob/main/.github/CODEOWNERS#L2
Engine/Commands/NewScriptAnalyzerSettingsFileCommand.cshttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files#diff-d01ac7616a723917c9624b58ca703479d31b31f5b836b056735e9853db6feb19
View file https://github.com/liamjpeters/PSScriptAnalyzer/blob/06164d0f6f7713ad864abd2b68ace7e38d3bd11c/Engine/Commands/NewScriptAnalyzerSettingsFileCommand.cs
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/pull/2176/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.