📖 [Docs]: Reference + proof for valid #Requires -Modules version syntax#23
Open
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Open
📖 [Docs]: Reference + proof for valid #Requires -Modules version syntax#23Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an authoritative reference for valid
#Requires -Modulesversion specifications, so contributors — and PR-review bots — can see exactly which forms are valid, and prove it. This is prompted by a Copilot review that incorrectly flaggedMaximumVersion = '6.*'as invalid; the reference settles it with a runnable test.New:
#Requires -Modulesversion-syntax referenceCoding-Standards/PowerShell/Requires-Modules.mddocuments each version-specification form — any / minimum / major-lock / ceiling-only / exact / +GUID — as a table with when to use each, and explains whyMaximumVersionaccepts theN.*wildcard (it is astringonModuleSpecification, unlike the[System.Version]floor/exact keys), so no6.999.999sentinel is needed.New: executable proof
tests/Requires-Modules.Tests.ps1proves every row against the installed Pester (independent of the exact6.x): the major lock resolves, the wildcard ceiling genuinely excludes a higher major, exact-but-missing does not resolve, and a wrong GUID blocks an otherwise-matching module while omitting the GUID still resolves. Validated locally — 8/8 pass on Pester 6.0.0.Technical Details
src/docs/Coding-Standards/PowerShell/Requires-Modules.md; registered in the PowerShellindex.md.tests/Requires-Modules.Tests.ps1(self-contained; writes one-line#Requiresscripts and runs them in a child PowerShell to observe real resolution).