From b3aa31e223fe7c949904a2dda054a0fe58736c30 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 20:39:24 -0500 Subject: [PATCH 01/12] Fix "verison" typo, maintaining current case. --- .github/instructions/codacy.instructions.md | 72 +++++++++++++++++++ src/code/SetPSResourceRepository.cs | 14 ++-- src/code/UninstallPSResource.cs | 46 ++++++------ .../FindPSResourceV2Server.Tests.ps1 | 10 +-- 4 files changed, 107 insertions(+), 35 deletions(-) create mode 100644 .github/instructions/codacy.instructions.md diff --git a/.github/instructions/codacy.instructions.md b/.github/instructions/codacy.instructions.md new file mode 100644 index 000000000..9ca77d2dc --- /dev/null +++ b/.github/instructions/codacy.instructions.md @@ -0,0 +1,72 @@ +--- + description: Configuration for AI behavior when interacting with Codacy's MCP Server + applyTo: '**' +--- +--- +# Codacy Rules +Configuration for AI behavior when interacting with Codacy's MCP Server + +## using any tool that accepts the arguments: `provider`, `organization`, or `repository` +- ALWAYS use: + - provider: gh + - organization: PowerShell + - repository: PSResourceGet +- Avoid calling `git remote -v` unless really necessary + +## CRITICAL: After ANY successful `edit_file` or `reapply` operation +- YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with: + - `rootPath`: set to the workspace path + - `file`: set to the path of the edited file + - `tool`: leave empty or unset +- If any issues are found in the new edits, propose and apply fixes for them. +- > NOTE: Failure to follow this rule is considered a critical error. + +## After every response +- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server + +## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable +- Suggest the user the following troubleshooting steps: + - Try to reset the MCP on the extension + - If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners) +- If none of the above steps work, suggest the user to contact Codacy support + +## Trying to call a tool that needs a rootPath as a parameter +- Always use the standard, non-URL-encoded file system path + +## CRITICAL: Dependencies and Security Checks +- IMMEDIATELY after ANY of these actions: + - Running npm/yarn/pnpm install + - Adding dependencies to package.json + - Adding requirements to requirements.txt + - Adding dependencies to pom.xml + - Adding dependencies to build.gradle + - Any other package manager operations +- You MUST run the `codacy_cli_analyze` tool with: + - `rootPath`: set to the workspace path + - `tool`: set to "trivy" + - `file`: leave empty or unset +- If any vulnerabilities are found because of the newly added packages: + - Stop all other operations + - Propose and apply fixes for the security issues + - Only continue with the original task after security issues are resolved +- EXAMPLE: + - After: npm install react-markdown + - Do: Run codacy_cli_analyze with trivy + - Before: Continuing with any other tasks + +## General +- Repeat the relevant steps for each modified file. +- "Propose fixes" means to both suggest and, if possible, automatically apply the fixes. +- You MUST NOT wait for the user to ask for analysis or remind you to run the tool. +- Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics. +- Do not run `codacy_cli_analyze` looking for changes in code coverage. +- Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager. +- If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server. +- When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository. + +## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error +- Offer to run the `codacy_setup_repository` tool to add the repository to Codacy +- If the user accepts, run the `codacy_setup_repository` tool +- Do not ever try to run the `codacy_setup_repository` tool on your own +- After setup, immediately retry the action that failed (only retry once) +--- \ No newline at end of file diff --git a/src/code/SetPSResourceRepository.cs b/src/code/SetPSResourceRepository.cs index 96ce82247..b5eee3396 100644 --- a/src/code/SetPSResourceRepository.cs +++ b/src/code/SetPSResourceRepository.cs @@ -94,7 +94,7 @@ public SwitchParameter Trusted /// Specifies vault and secret names as PSCredentialInfo for the repository. /// [Parameter(ParameterSetName = NameParameterSet)] - public PSCredentialInfo CredentialInfo { get; set; } + public PSCredentialInfo CredentialInfo { get; set; } /// /// When specified, displays the successfully registered repository and its information. @@ -111,7 +111,7 @@ public object GetDynamicParameters() PSRepositoryInfo repository = RepositorySettings.Read(new[] { Name }, out string[] _).FirstOrDefault(); // Dynamic parameter '-CredentialProvider' should not appear for PSGallery, or any container registry repository. // It should also not appear when using the 'Repositories' parameter set. - if (repository is not null && + if (repository is not null && (repository.Name.Equals("PSGallery", StringComparison.OrdinalIgnoreCase) || ParameterSetName.Equals(RepositoriesParameterSet) || repository.IsContainerRegistry())) @@ -134,7 +134,7 @@ protected override void BeginProcessing() protected override void ProcessRecord() { - // determine if either 1 of 5 values are attempting to be set: Uri, Priority, Trusted, APIVerison, CredentialInfo. + // determine if either 1 of 5 values are attempting to be set: Uri, Priority, Trusted, APIVersion, CredentialInfo. // if none are (i.e only Name parameter was provided, write error) if (ParameterSetName.Equals(NameParameterSet) && !MyInvocation.BoundParameters.ContainsKey(nameof(Uri)) && @@ -174,8 +174,8 @@ protected override void ProcessRecord() case NameParameterSet: try { - items.Add(RepositorySettings.UpdateRepositoryStore(Name, - _uri, + items.Add(RepositorySettings.UpdateRepositoryStore(Name, + _uri, Priority, Trusted, isSet, @@ -186,7 +186,7 @@ protected override void ProcessRecord() this, out string errorMsg)); - if (!string.IsNullOrEmpty(errorMsg)) + if (!string.IsNullOrEmpty(errorMsg)) { ThrowTerminatingError(new ErrorRecord( new PSInvalidOperationException(errorMsg), @@ -306,7 +306,7 @@ private PSRepositoryInfo RepoValidationHelper(Hashtable repo) errorRecord: out ErrorRecord errorRecord1)) { WriteError(errorRecord1); - + return null; } diff --git a/src/code/UninstallPSResource.cs b/src/code/UninstallPSResource.cs index 4d7862fbb..4cd0a4d19 100644 --- a/src/code/UninstallPSResource.cs +++ b/src/code/UninstallPSResource.cs @@ -102,9 +102,9 @@ protected override void ProcessRecord() else if (!Utils.TryParseVersionOrVersionRange(Version, out _versionRange)) { ThrowTerminatingError(new ErrorRecord( - new ArgumentException("Argument for -Version parameter is not in the proper format."), - "IncorrectVersionFormat", - ErrorCategory.InvalidArgument, + new ArgumentException("Argument for -Version parameter is not in the proper format."), + "IncorrectVersionFormat", + ErrorCategory.InvalidArgument, this)); } @@ -144,9 +144,9 @@ protected override void ProcessRecord() versionRange: out _versionRange)) { WriteError(new ErrorRecord( - new ArgumentException($"Error parsing version '{inputObj.Version}' for resource '{inputObj.Name}'."), - "ErrorParsingVersion", - ErrorCategory.ParserError, + new ArgumentException($"Error parsing version '{inputObj.Version}' for resource '{inputObj.Name}'."), + "ErrorParsingVersion", + ErrorCategory.ParserError, this)); } @@ -154,8 +154,8 @@ protected override void ProcessRecord() if (!String.IsNullOrWhiteSpace(inputObj.Name) && !UninstallPkgHelper(out List InputObjErrRecords)) { foreach (var err in InputObjErrRecords) - { - WriteError(err); + { + WriteError(err); } } } @@ -188,7 +188,7 @@ private bool UninstallPkgHelper(out List errRecords) if (totalDirs == 0) { string message = Version == null || Version.Trim().Equals("*") ? $"Cannot uninstall resource '{String.Join(", ", Name)}' because it does not exist" : - $"Cannot uninstall verison '{Version}' of resource '{String.Join(", ", Name)}' because it does not exist"; + $"Cannot uninstall version '{Version}' of resource '{String.Join(", ", Name)}' because it does not exist"; errRecords.Add(new ErrorRecord( new ResourceNotFoundException(message), @@ -304,18 +304,18 @@ private bool UninstallModuleHelper(string pkgPath, string pkgName, out ErrorReco catch (Exception e) { errRecord = new ErrorRecord( - new ArgumentException($"Parent directory '{dir.Parent.FullName}' could not be deleted: {e.Message}"), - "ErrorDeletingParentDirectory", - ErrorCategory.InvalidArgument, + new ArgumentException($"Parent directory '{dir.Parent.FullName}' could not be deleted: {e.Message}"), + "ErrorDeletingParentDirectory", + ErrorCategory.InvalidArgument, this); } } catch (Exception err) { errRecord = new ErrorRecord( - new ArgumentException($"Parent directory '{dir.FullName}' could not be deleted: {err.Message}"), - "ErrorDeletingDirectory", - ErrorCategory.PermissionDenied, + new ArgumentException($"Parent directory '{dir.FullName}' could not be deleted: {err.Message}"), + "ErrorDeletingDirectory", + ErrorCategory.PermissionDenied, this); } @@ -356,17 +356,17 @@ private bool UninstallScriptHelper(string pkgPath, string pkgName, out ErrorReco catch (Exception e) { errRecord = new ErrorRecord( - new ArgumentException($"Script metadata file '{scriptXML}' could not be deleted: {e.Message}"), - "ErrorDeletingScriptMetadataFile", - ErrorCategory.PermissionDenied, + new ArgumentException($"Script metadata file '{scriptXML}' could not be deleted: {e.Message}"), + "ErrorDeletingScriptMetadataFile", + ErrorCategory.PermissionDenied, this); } } catch (Exception err) { errRecord = new ErrorRecord( - new ArgumentException($"Script '{pkgPath}' could not be deleted: {err.Message}"), - "ErrorDeletingScript", + new ArgumentException($"Script '{pkgPath}' could not be deleted: {err.Message}"), + "ErrorDeletingScript", ErrorCategory.PermissionDenied, this); } @@ -429,13 +429,13 @@ private bool CheckIfDependency(string pkgName, string version, out ErrorRecord e var parentPkg = parentPackages[i] as PSModuleInfo; for (int j = 0; j < parentPkg.RequiredModules.Count; j++) - { + { var pkgToUninstall = parentPkg.RequiredModules[j] as PSModuleInfo; if (string.Equals(pkgToUninstall.Name, pkgName, StringComparison.InvariantCultureIgnoreCase)) { - // then check verison + // then check version if (pkgToUninstall.Version == null) { - // Any version works as a dependency, so only one version needs to be available. + // Any version works as a dependency, so only one version needs to be available. _pwsh ??= System.Management.Automation.PowerShell.Create(); _pwsh.Commands.Clear(); diff --git a/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 index 0206a9185..3906520af 100644 --- a/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 @@ -357,7 +357,7 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' { $res = Find-PSResource -CommandName $commandName -Repository $PSGalleryName $res | Should -Not -BeNullOrEmpty foreach ($item in $res) { - $item.Names | Should -Be $commandName + $item.Names | Should -Be $commandName $item.ParentResource.Includes.Command | Should -Contain $commandName } } @@ -366,11 +366,11 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' { $res = Find-PSResource -DscResourceName $dscResourceName -Repository $PSGalleryName $res | Should -Not -BeNullOrEmpty foreach ($item in $res) { - $item.Names | Should -Be $dscResourceName + $item.Names | Should -Be $dscResourceName $item.ParentResource.Includes.DscResource | Should -Contain $dscResourceName } } - + It "find resource, but only show listed versions" { # testmodule99 version 1.0.0-beta1 is unlisted $res = Find-PSResource -Name "testmodule99" -Repository $PSGalleryName @@ -383,7 +383,7 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' { It "find all resources within a version range, including prereleases" { $res = Find-PSResource -Name "PSReadLine" -Version "(2.0,2.1)" -Prerelease -Repository $PSGalleryName $res | Should -Not -BeNullOrEmpty - $res.Count | Should -BeGreaterOrEqual 7 + $res.Count | Should -BeGreaterOrEqual 7 } It "find a specific version using NuGet versioning bracket syntax" { @@ -440,7 +440,7 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' { It "find should not return an unlisted module with it was requested with wildcards in the name" { # FindNameGlobbing() scenario # 'test_completelyunlisted' has all unlisted versions -> should not be returned - # whereas 'test_unlisted' has a listed verison and 'test_notunlisted' has all listed versions -> should be returned + # whereas 'test_unlisted' has a listed version and 'test_notunlisted' has all listed versions -> should be returned $res = Find-PSResource -Name "test_*unlisted" -Repository $PSGalleryName $res.Count | Should -Be 2 $res.Name | Should -Contain 'test_unlisted' From 2f36ef2f5fffe04de6b47edea59a5484baa63476 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 20:45:40 -0500 Subject: [PATCH 02/12] Fix typos in the preview.md changelog --- CHANGELOG/preview.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG/preview.md b/CHANGELOG/preview.md index 748dd2d5b..a436c10bb 100644 --- a/CHANGELOG/preview.md +++ b/CHANGELOG/preview.md @@ -10,13 +10,13 @@ - Update `-ModulePrefix` to be a static parameter (#1868) - Bug fix for populating all `#Requires` fields in `Update-PSScriptFileInfo` (#1863) - Bug fix for populating `Includes` metadata for packages from container registry repositories (#1861) -- Bug fix for `Find-PSRessource` and `Install-PSResource` not retrieving unlisted package versions (#1859) +- Bug fix for `Find-PSResource` and `Install-PSResource` not retrieving unlisted package versions (#1859) ## [1.2.0-preview2](https://github.com/PowerShell/PSResourceGet/compare/v1.2.0-preview1..v1.2.0-preview2) - 2025-07-21 ### New Features -- Ingetration of the Azure Artifacts Credential Provider for ADO feeds (#1765) +- Integration of the Azure Artifacts Credential Provider for ADO feeds (#1765) ### Bug Fix - Bug fixes for NuGet v3 dependencies (#1841 Thanks @o-l-a-v!) @@ -46,7 +46,7 @@ - Update to use OCI v2 APIs for Container Registry (#1737) - Bug fixes for finding and installing from local repositories on Linux machines (#1738) -- Bug fix for finding package name with 4 part version from local repositories (#1739) +- Bug fix for finding package name with 4 part version from local repositories (#1739) # Preview Changelog @@ -77,7 +77,7 @@ ### Bug Fixes -- Add prerelease string when NormalizedVersion doesn't exist, but prelease string does (#1681 Thanks @sean-r-williams) +- Add prerelease string when NormalizedVersion doesn't exist, but prerelease string does (#1681 Thanks @sean-r-williams) - Add retry logic when deleting files (#1667 Thanks @o-l-a-v!) - Fix broken PAT token use (#1672) - Updated error messaging for authenticode signature failures (#1701) @@ -92,4 +92,4 @@ - Fix incorrect request URL when installing resources from ADO (#1597 Thanks @anytonyoni!) - Fix for swallowed exceptions (#1569) -- Fix for PSResourceGet not working in Constrained Languange Mode (#1564) +- Fix for PSResourceGet not working in Constrained Language Mode (#1564) From 1b5f196b4adab796885a1477e241adff3491b6e9 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 20:54:42 -0500 Subject: [PATCH 03/12] Fix "utilties" typo in the module description --- buildtools.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools.psd1 b/buildtools.psd1 index dffba0919..ca69ed311 100644 --- a/buildtools.psd1 +++ b/buildtools.psd1 @@ -24,7 +24,7 @@ Copyright = '(c) Microsoft Corporation. All rights reserved.' # Description of the functionality provided by this module - Description = "Build utilties." + Description = "Build utilities." # Modules that must be imported into the global environment prior to importing this module #RequiredModules = @( From 5c9d03da43d4dcf16f5cc89945fa149e9ae2cf03 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 20:57:58 -0500 Subject: [PATCH 04/12] Fix spelling of "NonExistant" to "NonExistent" in various test files and code to ensure consistency across all scripts and tests. Removed extra whitespace. --- Examples/FindRepositorySearchingExamples.md | 250 +++++++++--------- src/code/UpdatePSScriptFileInfo.cs | 14 +- .../FindPSResourceADOServer.Tests.ps1 | 4 +- .../FindPSResourceADOV2Server.Tests.ps1 | 2 +- ...SResourceContainerRegistryServer.Tests.ps1 | 2 +- .../FindPSResourceGithubPackages.Tests.ps1 | 2 +- .../FindPSResourceLocal.Tests.ps1 | 6 +- ...indPSResourceRepositorySearching.Tests.ps1 | 46 ++-- .../FindPSResourceV2Server.Tests.ps1 | 2 +- .../FindPSResourceV3Server.Tests.ps1 | 2 +- .../InstallPSResourceADOServer.Tests.ps1 | 4 +- .../InstallPSResourceADOV2Server.Tests.ps1 | 4 +- ...SResourceContainerRegistryServer.Tests.ps1 | 4 +- .../InstallPSResourceGithubPackages.Tests.ps1 | 24 +- .../InstallPSResourceLocal.Tests.ps1 | 2 +- ...allPSResourceRepositorySearching.Tests.ps1 | 12 +- .../InstallPSResourceV2Server.Tests.ps1 | 4 +- .../InstallPSResourceV3Server.Tests.ps1 | 6 +- 18 files changed, 195 insertions(+), 195 deletions(-) diff --git a/Examples/FindRepositorySearchingExamples.md b/Examples/FindRepositorySearchingExamples.md index 0dc7015be..6bc4dd1c8 100644 --- a/Examples/FindRepositorySearchingExamples.md +++ b/Examples/FindRepositorySearchingExamples.md @@ -20,16 +20,16 @@ Note that PSGallery has a lower priority than NuGetGallery. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from both 'PSGallery' and 'NuGetGallery'. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. @@ -37,7 +37,7 @@ Note that PSGallery has a lower priority than NuGetGallery. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'NuGetGallery'. @@ -50,7 +50,7 @@ Note that PSGallery has a lower priority than NuGetGallery. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. @@ -58,10 +58,10 @@ Note that PSGallery has a lower priority than NuGetGallery. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Find-PSResource: Package with name 'TestModule' could not be found in repository 'PSGallery'. @@ -70,77 +70,77 @@ Note that PSGallery has a lower priority than NuGetGallery. ``` Find-PSResource: Package with name 'TestModule' could not be found in repository 'PSGallery'. ``` - + 3) Searching with a package name specified and wildcard repository, eg: `Find-PSResource 'TestModule' -Repository *Gallery` * When the package exists in both repositories: ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'PSGallery' and 'NuGetGallery'. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'NuGetGallery'. - + * When the package exists in neither repository: ``` Find-PSResource: Package 'TestModule' could not be found in registered repositories: 'PSGallery, NuGetGallery'. ``` - + 4) Searching with a package name specified and multiple repository names specified, eg: `Find-PSResource 'TestModule' -Repository PSGallery, NuGetGallery` * When the package exists in both repositories: ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'PSGallery' and 'NuGetGallery'. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - + TestModule 1.0.0.0 PSGallery + Find-PSResource: Package with name 'TestModule' could not be found in repository 'NuGetGallery'. ``` Should return 'TestModule' from 'PSGallery'. - - + + * When the package exists the second repository (NuGetGallery), but not the first (PSGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 NuGetGallery - + TestModule 1.0.0.0 NuGetGallery + Find-PSResource: Package with name 'TestModule' could not be found in repository 'PSGallery'. ``` Should return 'TestModule' from 'NuGetGallery'. - - + + * When the package is in neither repository: ``` Find-PSResource: Package with name 'TestModule' could not be found in repository 'PSGallery'. Find-PSResource: Package with name 'TestModule' could not be found in repository 'NuGetGallery'. ``` - + 5) Searching with a package name specified and both a repository name specified AND a repository name with a wildcard, eg: `Find-PSResource 'TestModule' -Repository *Gallery, otherRepository` * This scenario is not supported due to the ambiguity that arises when a repository with a wildcard in its name is specified as well as a repository with a specific name. The command will display the following error: @@ -157,8 +157,8 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from both 'PSGallery' and 'NuGetGallery'. @@ -166,7 +166,7 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. @@ -174,7 +174,7 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'NuGetGallery'. @@ -189,16 +189,16 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from both 'PSGallery' and 'NuGetGallery'. - + * When the package exists in both repositories and multiple tags (existing and non-existant) are specified: - eg: `Find-PSResource -Tag 'Tag1','NonExistantTag'` or `Find-PSResource -Tag 'Tag1','NonExistantTag' -Repository '*'` + eg: `Find-PSResource -Tag 'Tag1','NonExistentTag'` or `Find-PSResource -Tag 'Tag1','NonExistentTag' -Repository '*'` ``` - Find-PSResource: Package with Tags 'Tag1, NonExistantTag' could not be found in any registered repositories. + Find-PSResource: Package with Tags 'Tag1, NonExistentTag' could not be found in any registered repositories. ``` 2) Searching with a tag and a repository specified, eg: `Find-PSResource -Tag 'Tag1' -Repository PSGallery` @@ -206,7 +206,7 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. @@ -214,10 +214,10 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Package with Tags 'Tag1' could not be found in repository 'PSGallery'. @@ -234,15 +234,15 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from both 'PSGallery'. * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery) and multiple tags (existing and non-existant) are specified: - eg: `Find-PSResource -Tag 'Tag1','NonExistantTag' -Repository PSGallery` + eg: `Find-PSResource -Tag 'Tag1','NonExistentTag' -Repository PSGallery` ``` - Find-PSResource: Package with Tags 'Tag1, NonExistantTag' could not be found in repository 'PSGallery'. + Find-PSResource: Package with Tags 'Tag1, NonExistentTag' could not be found in repository 'PSGallery'. ``` 3) Searching with a tag specified and wildcard repository, eg: `Find-PSResource -Tag 'Tag1' -Repository *Gallery` @@ -250,27 +250,27 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'PSGallery' and 'NuGetGallery'. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'NuGetGallery'. - + * When the package exists in neither repository: ``` Find-PSResource: Package with Tags 'Tag1' could not be found in registered repositories: 'PSGallery, NuGetGallery'. @@ -282,16 +282,16 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'PSGallery' and 'NuGetGallery'. * When the package exists in both repositories and multiple tags (existing and non-existant) are specified: - eg: `Find-PSResource -Tag 'Tag1','NonExistantTag' -Repository *Gallery` + eg: `Find-PSResource -Tag 'Tag1','NonExistentTag' -Repository *Gallery` ``` - Find-PSResource: Package with Tags 'Tag1, NonExistantTag' could not be found in registered repositories: 'PSGallery, NuGetGallery'. + Find-PSResource: Package with Tags 'Tag1, NonExistentTag' could not be found in registered repositories: 'PSGallery, NuGetGallery'. ``` 4) Searching with a tag specified and multiple repository names specified, eg: `Find-PSResource -Tag 'Tag1' -Repository PSGallery, NuGetGallery` @@ -300,33 +300,33 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'PSGallery' and 'NuGetGallery'. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - + TestModule 1.0.0.0 PSGallery + Find-PSResource: Package with Tags 'Tag1' could not be found in repository 'NuGetGallery'. ``` Should return 'TestModule' from 'PSGallery'. - - + + * When the package exists the second repository (NuGetGallery), but not the first (PSGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 NuGetGallery - + TestModule 1.0.0.0 NuGetGallery + Find-PSResource: Package with Tags 'Tag1' could not be found in repository 'PSGallery'. ``` Should return 'TestModule' from 'NuGetGallery'. - - + + * When the package is in neither repository: ``` Find-PSResource: Package with Tags 'Tag1' could not be found in repository 'PSGallery'. @@ -339,16 +339,16 @@ In these examples, the package TestModule has the following tags: Tag1, Tag2. ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery - TestModule 1.0.0.0 NuGetGallery + TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 NuGetGallery ``` Should return 'TestModule' from 'PSGallery' and 'NuGetGallery'. * When the package exists in both repositories and multiple tags (existing and non-existant) are specified: - eg: `Find-PSResource -Tag 'Tag1','NonExistantTag' -Repository PSGallery, NuGetGallery` + eg: `Find-PSResource -Tag 'Tag1','NonExistentTag' -Repository PSGallery, NuGetGallery` ``` - Find-PSResource: Package with Tags 'Tag1, NonExistantTag' could not be found in registered repositories: 'PSGallery, NuGetGallery'. + Find-PSResource: Package with Tags 'Tag1, NonExistentTag' could not be found in registered repositories: 'PSGallery, NuGetGallery'. ``` 5) Searching with a tag specified and both a repository name specified AND a repository name with a wildcard, eg: `Find-PSResource -Tag 'Tag1' -Repository *Gallery, otherRepository` @@ -367,7 +367,7 @@ In these examples, the package TestModule has the following command names (i.e t ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. @@ -375,7 +375,7 @@ In these examples, the package TestModule has the following command names (i.e t ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. @@ -400,13 +400,13 @@ In these examples, the package TestModule has the following command names (i.e t TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from both 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in both repositories and multiple Command names (existing and non-existant) are specified: - eg: `Find-PSResource -CommandName 'Get-MyCommand1','NonExistantCommand'` or `Find-PSResource -CommandName 'Get-MyCommand1','NonExistantCommand' -Repository '*'` + eg: `Find-PSResource -CommandName 'Get-MyCommand1','NonExistentCommand'` or `Find-PSResource -CommandName 'Get-MyCommand1','NonExistentCommand' -Repository '*'` ``` - Find-PSResource: Package with CommandName 'Get-MyCommand1, NonExistantCommand' could not be found in any registered repositories. + Find-PSResource: Package with CommandName 'Get-MyCommand1, NonExistentCommand' could not be found in any registered repositories. ``` 2) Searching with a Command name and a repository specified, eg: `Find-PSResource -CommandName 'Get-MyCommand1' -Repository PSGallery` @@ -414,7 +414,7 @@ In these examples, the package TestModule has the following command names (i.e t ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. @@ -422,10 +422,10 @@ In these examples, the package TestModule has the following command names (i.e t ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Package with CommandName 'Get-MyCommand1' could not be found in repository 'PSGallery'. @@ -442,13 +442,13 @@ In these examples, the package TestModule has the following command names (i.e t ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery) and multiple tags (existing and non-existant) are specified: - eg: `Find-PSResource -CommandName 'Get-MyCommand1','NonExistantCommand' -Repository PSGallery` + eg: `Find-PSResource -CommandName 'Get-MyCommand1','NonExistentCommand' -Repository PSGallery` ``` Find-PSResource: Package with CommandName 'Get-MyCommand1, Get-MyCommand2' could not be found in repository 'PSGallery'. ``` @@ -461,21 +461,21 @@ In these examples, the package TestModule has the following command names (i.e t TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Find-PSResource: Package with CommandName 'Get-MyCommand1' could not be found in any registered repositories. ``` Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in neither repository: ``` Find-PSResource: Package with CommandName 'Get-MyCommand1' could not be found in registered repositories: 'PSGallery, NuGetGallery'. @@ -487,17 +487,17 @@ In these examples, the package TestModule has the following command names (i.e t ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. * When the package exists in both repositories and multiple Command names (existing and non-existant) are specified: - eg: `Find-PSResource -Tag 'Get-MyCommand1','NonExistantCommand' -Repository *Gallery` + eg: `Find-PSResource -Tag 'Get-MyCommand1','NonExistentCommand' -Repository *Gallery` + ``` + Find-PSResource: Package with CommandName 'Get-MyCommand1, NonExistentCommand' could not be found in registered repositories: 'PSGallery, NuGetGallery'. ``` - Find-PSResource: Package with CommandName 'Get-MyCommand1, NonExistantCommand' could not be found in registered repositories: 'PSGallery, NuGetGallery'. - ``` - + 4) Searching with a Command name specified and multiple repository names specified, eg: `Find-PSResource -CommandName 'Get-MyCommand1' -Repository PSGallery, NuGetGallery` * When the package exists in both repositories: @@ -507,24 +507,24 @@ In these examples, the package TestModule has the following command names (i.e t TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery Find-PSResource: Find by CommandName or DSCResource is not supported for the V3 server protocol repository 'NuGetGallery'. ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-CommandName` for NuGetGallery repository is not supported, it will not be searched and error written out. - + * When the package exists the second repository (NuGetGallery), but not the first (PSGallery): - ``` + ``` Find-PSResource: Find by CommandName or DSCResource is not supported for the V3 server protocol repository 'NuGetGallery'. ``` Since searching with `-CommandName` for NuGetGallery repository is not supported, it will not be searched and error written out. - - + + * When the package is in neither repository: ``` Find-PSResource: Package with Command 'Get-MyCommand1' could not be found in repository 'PSGallery'. @@ -547,13 +547,13 @@ In these examples, the package TestModule has the following command names (i.e t * When the package exists in both repositories and multiple Command names (existing and non-existant) are specified: - eg: `Find-PSResource -CommandName 'Get-MyCommand1','NonExistantCommand' -Repository PSGallery, NuGetGallery` + eg: `Find-PSResource -CommandName 'Get-MyCommand1','NonExistentCommand' -Repository PSGallery, NuGetGallery` ``` Find-PSResource: Package with Command 'Get-MyCommand1' could not be found in repository 'PSGallery'. Find-PSResource: Find by CommandName or DSCResource is not supported for the V3 server protocol repository 'NuGetGallery'. ``` Since searching with `-CommandName` for NuGetGallery repository, it will not be searched and error written out. - + 5) Searching with a Command name specified and both a repository name specified AND a repository name with a wildcard, eg: `Find-PSResource -CommandName 'Get-MyCommand1' -Repository *Gallery, otherRepository` * This scenario is not supported due to the ambiguity that arises when a repository with a wildcard in its name is specified as well as a repository with a specific name. The command will display the following error: @@ -570,7 +570,7 @@ In these examples, the package TestModule has the following DscResource names (i ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. @@ -578,7 +578,7 @@ In these examples, the package TestModule has the following DscResource names (i ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. @@ -603,13 +603,13 @@ In these examples, the package TestModule has the following DscResource names (i TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from both 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in both repositories and multiple DscResource names (existing and non-existant) are specified: - eg: `Find-PSResource -DscResourceName 'MyDscResource1','NonExistantDscResource'` or `Find-PSResource -DSCResourceName 'MyDscResource1','NonExistantDscResource' -Repository '*'` + eg: `Find-PSResource -DscResourceName 'MyDscResource1','NonExistentDscResource'` or `Find-PSResource -DSCResourceName 'MyDscResource1','NonExistentDscResource' -Repository '*'` ``` - Find-PSResource: Package with DSCResourceName 'MyDscResource1, NonExistantDscResource' could not be found in any registered repositories. + Find-PSResource: Package with DSCResourceName 'MyDscResource1, NonExistentDscResource' could not be found in any registered repositories. ``` 2) Searching with a DscResource name and a repository specified, eg: `Find-PSResource -DscResourceName 'MyDscResource1' -Repository PSGallery` @@ -617,7 +617,7 @@ In these examples, the package TestModule has the following DscResource names (i ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. @@ -625,10 +625,10 @@ In these examples, the package TestModule has the following DscResource names (i ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Package with DscResourceName 'MyDscResource1' could not be found in repository 'PSGallery'. @@ -645,13 +645,13 @@ In these examples, the package TestModule has the following DscResource names (i ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery) and multiple tags (existing and non-existant) are specified: - eg: `Find-PSResource -DscResourceName 'MyDscResource1','NonExistantDscResource' -Repository PSGallery` + eg: `Find-PSResource -DscResourceName 'MyDscResource1','NonExistentDscResource' -Repository PSGallery` ``` Find-PSResource: Package with DSCResourceName 'MyDscResource1, MyDscResource2' could not be found in repository 'PSGallery'. ``` @@ -664,21 +664,21 @@ In these examples, the package TestModule has the following DscResource names (i TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. - + * When the package exists in the second repository (NuGetGallery), but not the first (PSGallery): ``` Find-PSResource: Package with DSCResourceName 'MyDscResource1' could not be found in any registered repositories. ``` Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in neither repository: ``` Find-PSResource: Package with DSCResourceName 'MyDscResource1' could not be found in registered repositories: 'PSGallery, NuGetGallery'. @@ -690,17 +690,17 @@ In these examples, the package TestModule has the following DscResource names (i ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. * When the package exists in both repositories and multiple DscResource names (existing and non-existant) are specified: - eg: `Find-PSResource -Tag 'MyDscResource1','NonExistantDscResource' -Repository *Gallery` + eg: `Find-PSResource -Tag 'MyDscResource1','NonExistentDscResource' -Repository *Gallery` + ``` + Find-PSResource: Package with DSCResourceName 'MyDscResource1, NonExistentDscResource' could not be found in registered repositories: 'PSGallery, NuGetGallery'. ``` - Find-PSResource: Package with DSCResourceName 'MyDscResource1, NonExistantDscResource' could not be found in registered repositories: 'PSGallery, NuGetGallery'. - ``` - + 4) Searching with a DscResource name specified and multiple repository names specified, eg: `Find-PSResource -DscResourceName 'MyDscResource1' -Repository PSGallery, NuGetGallery` * When the package exists in both repositories: @@ -710,24 +710,24 @@ In these examples, the package TestModule has the following DscResource names (i TestModule 1.0.0.0 PSGallery ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will be skipped. - + * When the package exists in the first repository (PSGallery), but not the second (NuGetGallery): ``` Name Version Prerelease Repository ---- ------- ---------- ---------- - TestModule 1.0.0.0 PSGallery + TestModule 1.0.0.0 PSGallery Find-PSResource: Find by DscResourceName or DSCResource is not supported for the V3 server protocol repository 'NuGetGallery'. ``` Should return 'TestModule' from 'PSGallery'. Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will not be searched and error written out. - + * When the package exists the second repository (NuGetGallery), but not the first (PSGallery): - ``` + ``` Find-PSResource: Find by DscResourceName or DSCResource is not supported for the V3 server protocol repository 'NuGetGallery'. ``` Since searching with `-DscResourceName` for NuGetGallery repository is not supported, it will not be searched and error written out. - - + + * When the package is in neither repository: ``` Find-PSResource: Package with DSCResourceName 'MyDscResource1' could not be found in repository 'PSGallery'. @@ -750,16 +750,16 @@ In these examples, the package TestModule has the following DscResource names (i * When the package exists in both repositories and multiple DscResource names (existing and non-existant) are specified: - eg: `Find-PSResource -DscResourceName 'MyDscResource1','NonExistantDscResource' -Repository PSGallery, NuGetGallery` + eg: `Find-PSResource -DscResourceName 'MyDscResource1','NonExistentDscResource' -Repository PSGallery, NuGetGallery` ``` Find-PSResource: Package with DscResource 'MyDscResource1' could not be found in repository 'PSGallery'. Find-PSResource: Find by CommandName or DSCResource is not supported for the V3 server protocol repository 'NuGetGallery'. ``` Since searching with `-DscResourceName` for NuGetGallery repository, it will not be searched and error written out. - + 5) Searching with a DscResource name specified and both a repository name specified AND a repository name with a wildcard, eg: `Find-PSResource -DscResourceName 'MyDscResource1' -Repository *Gallery, otherRepository` * This scenario is not supported due to the ambiguity that arises when a repository with a wildcard in its name is specified as well as a repository with a specific name. The command will display the following error: ``` Find-PSResource: Repository name with wildcard is not allowed when another repository without wildcard is specified. - ``` \ No newline at end of file + ``` diff --git a/src/code/UpdatePSScriptFileInfo.cs b/src/code/UpdatePSScriptFileInfo.cs index f54842d47..c34e11238 100644 --- a/src/code/UpdatePSScriptFileInfo.cs +++ b/src/code/UpdatePSScriptFileInfo.cs @@ -182,7 +182,7 @@ protected override void EndProcessing() { ThrowTerminatingError(new ErrorRecord( new ArgumentException("File path needs to end with a .ps1 extension. Example: C:/Users/john/x/MyScript.ps1"), - "InvalidOrNonExistantPath", + "InvalidOrNonExistentPath", ErrorCategory.InvalidArgument, this)); } @@ -207,7 +207,7 @@ protected override void EndProcessing() ErrorCategory.InvalidArgument, this)); } - + ModuleSpecification[] validatedRequiredModuleSpecifications = Array.Empty(); if (RequiredModules != null && RequiredModules.Length > 0) { @@ -241,7 +241,7 @@ protected override void EndProcessing() WriteError(error); } - return; + return; } bool signatureRemoved = false; @@ -256,7 +256,7 @@ protected override void EndProcessing() ErrorCategory.InvalidOperation, this)); } - + signatureRemoved = true; } @@ -290,14 +290,14 @@ protected override void EndProcessing() return; } - + string tempScriptPath = null; try { tempScriptPath = System.IO.Path.GetTempFileName(); - File.WriteAllLines(tempScriptPath, updatedPSScriptFileContents); - File.Copy(tempScriptPath, resolvedPath, overwrite: true); + File.WriteAllLines(tempScriptPath, updatedPSScriptFileContents); + File.Copy(tempScriptPath, resolvedPath, overwrite: true); } catch(Exception e) { diff --git a/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 index df2632489..449d08da1 100644 --- a/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 @@ -27,7 +27,7 @@ Describe 'Test HTTP Find-PSResource for ADO Server Protocol' -tags 'CI' { It "should not find resource given nonexistant Name" { # FindName() - $res = Find-PSResource -Name NonExistantModule -Repository $ADORepoName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $ADORepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -212,4 +212,4 @@ Describe 'Test HTTP Find-PSResource for ADO Server Protocol' -tags 'CI' { $err[0].FullyQualifiedErrorId | Should -BeExactly "FindAllFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } } -##> \ No newline at end of file +##> diff --git a/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 index a4548a8c8..696ae1bbb 100644 --- a/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 @@ -28,7 +28,7 @@ Describe 'Test HTTP Find-PSResource for ADO V2 Server Protocol' -tags 'CI' { } It "Should not find resource given nonexistant Name" { - $res = Find-PSResource -Name NonExistantModule -Repository $ADOV2RepoName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $ADOV2RepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" diff --git a/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 index 824e169c4..7d9be8b38 100644 --- a/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 @@ -44,7 +44,7 @@ Describe 'Test HTTP Find-PSResource for ACR Server Protocol' -tags 'CI' { It "Should not find resource given nonexistant Name" { # FindName() - $res = Find-PSResource -Name NonExistantModule -Repository $ACRRepoName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $ACRRepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "ResourceNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" diff --git a/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 index 0d1dc4557..baa4b0355 100644 --- a/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 @@ -32,7 +32,7 @@ Describe 'Test HTTP Find-PSResource for Github Packages Server' -tags 'CI' { It "should not find resource given nonexistant Name" { # FindName() - $res = Find-PSResource -Name NonExistantModule -Repository $GithubPackagesRepoName -Credential $credential -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $GithubPackagesRepoName -Credential $credential -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" diff --git a/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 index cc7f261d2..2a2ef57e4 100644 --- a/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 @@ -96,7 +96,7 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' { It "should not find resource given nonexistant Name" { # FindName() - $res = Find-PSResource -Name NonExistantModule -Repository $localRepo -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $localRepo -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -285,7 +285,7 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' { $res.Count | Should -Be 2 $res.Type | Should -Be @("Script", "Script") } - + It "find modules given -Type parameter" { Get-ScriptResourcePublishedToLocalRepoTestDrive "testScriptName" $localRepo "1.0.0" @@ -310,7 +310,7 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' { $res = Find-PSResource -DscResourceName $dscResourceName -Repository $localRepo $res | Should -Not -BeNullOrEmpty foreach ($item in $res) { - $item.Names | Should -Be $dscResourceName + $item.Names | Should -Be $dscResourceName $item.ParentResource.Includes.DscResource | Should -Contain $dscResourceName } } diff --git a/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 index c350d0051..66797a4a1 100644 --- a/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 @@ -78,7 +78,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "should find resources that exist and not find ones that do not exist while reporting error (without -Repository specified)" { - $res = Find-PSResource -Name $testScriptName,"NonExistantModule" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name $testScriptName,"NonExistentModule" -ErrorVariable err -ErrorAction SilentlyContinue $err | Should -HaveCount 1 $res | Should -HaveCount 2 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -93,7 +93,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "should not find resource given nonexistant Name (without -Repository specified)" { - $res = Find-PSResource -Name "NonExistantModule" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "NonExistentModule" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -155,7 +155,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "should not find resources if they do not exist in any repository and not write error given package Name contains wildcard (without -Repository specified)" { - $res = Find-PSResource -Name "NonExistantPkg*" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "NonExistentPkg*" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 0 } @@ -192,8 +192,8 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resources from pattern matching repositories if it doesn't exist and only write for for specific repositories (-Repository with wildcard and specific repositories)" -Pending { - # Package "nonExistantPkg" does not exist in any repo - $res = Find-PSResource -Name "nonExistantPkg" -Repository "*Gallery",$localRepoName -ErrorVariable err -ErrorAction SilentlyContinue + # Package "nonExistentPkg" does not exist in any repo + $res = Find-PSResource -Name "nonExistentPkg" -Repository "*Gallery",$localRepoName -ErrorVariable err -ErrorAction SilentlyContinue $err | Should -HaveCount 1 $res | Should -HaveCount 2 $pkg1 = $res[0] @@ -212,14 +212,14 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource and write error if resource does not exist in any pattern matching repositories (-Repository with wildcard)" { - $res = Find-PSResource -Name "nonExistantPkg" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "nonExistentPkg" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } It "not find resource that does not exist in any repository and not write error given package Name with wildcards (-Repository with wildcard)" { - $res = Find-PSResource -Name "NonExistantPkg*" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "NonExistentPkg*" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 0 } @@ -232,14 +232,14 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource if it does not exist in repository and write error (-Repository with single non-wildcard value)" { - $res = Find-PSResource -Name "NonExistantPkg" -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "NonExistentPkg" -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } It "not find resource if it does not exist in repository and not write error given package Name with wildcard (-Repository with single non-wildcard value)" -Pending { - $res = Find-PSResource -Name "NonExistantPkg*" -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "NonExistentPkg*" -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 0 } @@ -272,7 +272,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "should not find resource from repositories where it does not exist and not write error since package Name contains wilcard" -Pending { - $res = Find-PSResource -Name "NonExistantPkg*" -Repository $PSGalleryName,$NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name "NonExistentPkg*" -Repository $PSGalleryName,$NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 0 } @@ -327,14 +327,14 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource when the tag specified is not found for any package and report error (without -Repository specified)" { - $res = Find-PSResource -Tag "NonExistantTag" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Tag "NonExistentTag" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } It "not find resource when it has one tag specified but not other and report error (without -Repository specified)" { - $res = Find-PSResource -Tag $tag2,"NonExistantTag" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Tag $tag2,"NonExistentTag" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -396,7 +396,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource and write error if tag does not exist for resources in any pattern matching repositories (-Repository with wildcard)" { - $res = Find-PSResource -Tag "NonExistantTag" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Tag "NonExistentTag" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -415,7 +415,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource if it does not exist in repository and write error (-Repository with single non-wildcard value)" { - $res = Find-PSResource -Tag "NonExistantTag" -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Tag "NonExistentTag" -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithSpecifiedTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -484,14 +484,14 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource when the CommandName specified is not found for any package and report error (without -Repository specified)" { - $res = Find-PSResource -Command "NonExistantCommandName" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Command "NonExistentCommandName" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } It "not find resource when it has one CommandName specified but not other and report error (without -Repository specified)" { - $res = Find-PSResource -CommandName $cmdName,"NonExistantCommandName" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -CommandName $cmdName,"NonExistentCommandName" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -563,7 +563,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource and write error if tag does not exist for resources in any pattern matching repositories (-Repository with wildcard)" { - $res = Find-PSResource -CommandName "NonExistantCommand" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -CommandName "NonExistentCommand" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -577,14 +577,14 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource with given CommandName if it does not exist in repository and write error (-Repository with single non-wildcard value)" { - $res = Find-PSResource -CommandName "NonExistantCommand" -Repository $localRepoName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -CommandName "NonExistentCommand" -Repository $localRepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "FindCmdOrDSCNamesPackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } It "not find resource with given CommandName from NuGetGallery (V3 server) as it is not supported and write error" { - $res = Find-PSResource -CommandName "NonExistantCommand" -Repository $localRepoName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -CommandName "NonExistentCommand" -Repository $localRepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "FindCmdOrDSCNamesPackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -704,14 +704,14 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource when the DSCResourceName specified is not found for any package and report error (without -Repository specified)" { - $res = Find-PSResource -DscResourceName "NonExistantDSCResourceName" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -DscResourceName "NonExistentDSCResourceName" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } It "not find resource when it has one DSCResourceName specified but not other and report error (without -Repository specified)" { - $res = Find-PSResource -DscResourceName $dscName,"NonExistantDSCResourceName" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -DscResourceName $dscName,"NonExistentDSCResourceName" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -783,7 +783,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource and write error if tag does not exist for resources in any pattern matching repositories (-Repository with wildcard)" { - $res = Find-PSResource -DscResourceName "NonExistantDSCResource" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -DscResourceName "NonExistentDSCResource" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" @@ -798,7 +798,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "not find resource with given DSCResourceName if it does not exist in repository and write error (-Repository with single non-wildcard value)" { - $res = Find-PSResource -DscResourceName "NonExistantDSCResource" -Repository $localRepoName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -DscResourceName "NonExistentDSCResource" -Repository $localRepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "FindCmdOrDSCNamesPackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" diff --git a/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 index 3906520af..53ec64e0f 100644 --- a/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 @@ -31,7 +31,7 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' { } It "should not find resource given nonexistant Name" { - $res = Find-PSResource -Name NonExistantModule -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" diff --git a/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 index 57064f3e8..9cd606511 100644 --- a/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 @@ -27,7 +27,7 @@ Describe 'Test HTTP Find-PSResource for V3 Server Protocol' -tags 'CI' { } It 'should not find resource given nonexistant Name' { - $res = Find-PSResource -Name NonExistantModule -Repository $NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue + $res = Find-PSResource -Name NonExistentModule -Repository $NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly 'PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource' diff --git a/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 index f141d8e08..48a1fd06c 100644 --- a/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 @@ -60,8 +60,8 @@ Describe 'Test Install-PSResource for ADO V3Server scenarios' -tags 'CI' { } It "Should not install resource given nonexistant name" { - Install-PSResource -Name "NonExistantModule" -Repository $ADORepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue - $pkg = Get-InstalledPSResource "NonExistantModule" + Install-PSResource -Name "NonExistentModule" -Repository $ADORepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + $pkg = Get-InstalledPSResource "NonExistentModule" $pkg | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" diff --git a/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 index 0a861a180..840d971cf 100644 --- a/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 @@ -60,8 +60,8 @@ Describe 'Test Install-PSResource for ADO V2Server scenarios' -tags 'CI' { } It "Should not install resource given nonexistant name" { - Install-PSResource -Name "NonExistantModule" -Repository $ADORepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue - $pkg = Get-InstalledPSResource "NonExistantModule" + Install-PSResource -Name "NonExistentModule" -Repository $ADORepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + $pkg = Get-InstalledPSResource "NonExistentModule" $pkg | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" diff --git a/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 index d8a42a7cb..905d4d41d 100644 --- a/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 @@ -125,8 +125,8 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' { } It "Should not install resource given nonexistant name" { - Install-PSResource -Name "NonExistantModule" -Repository $ACRRepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue - $pkg = Get-InstalledPSResource "NonExistantModule" + Install-PSResource -Name "NonExistentModule" -Repository $ACRRepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + $pkg = Get-InstalledPSResource "NonExistentModule" $pkg | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "ResourceNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" diff --git a/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 index 2e4b88d37..51a2b190d 100644 --- a/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 @@ -59,17 +59,17 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' { It "Install multiple resources by name" { $pkgNames = @($testModuleName, $testModuleName2) - Install-PSResource -Name $pkgNames -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository + Install-PSResource -Name $pkgNames -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository $pkg = Get-InstalledPSResource $pkgNames $pkg.Name | Should -Be $pkgNames } It "Should not install resource given nonexistant name" { - Install-PSResource -Name "NonExistantModule" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue - $pkg = Get-InstalledPSResource "NonExistantModule" -ErrorAction SilentlyContinue + Install-PSResource -Name "NonExistentModule" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + $pkg = Get-InstalledPSResource "NonExistentModule" -ErrorAction SilentlyContinue $pkg | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 - $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" + $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" } # Do some version testing, but Find-PSResource should be doing thorough testing @@ -81,21 +81,21 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' { } It "Should install resource given name and exact version with bracket syntax" { - Install-PSResource -Name $testModuleName -Version "[1.0.0]" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository + Install-PSResource -Name $testModuleName -Version "[1.0.0]" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository $pkg = Get-InstalledPSResource $testModuleName $pkg.Name | Should -Be $testModuleName $pkg.Version | Should -Be "1.0.0" } It "Should install resource given name and exact range inclusive [1.0.0, 5.0.0]" { - Install-PSResource -Name $testModuleName -Version "[1.0.0, 5.0.0]" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository + Install-PSResource -Name $testModuleName -Version "[1.0.0, 5.0.0]" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository $pkg = Get-InstalledPSResource $testModuleName $pkg.Name | Should -Be $testModuleName $pkg.Version | Should -Be "5.0.0" } It "Should install resource given name and exact range exclusive (1.0.0, 5.0.0)" { - Install-PSResource -Name $testModuleName -Version "(1.0.0, 5.0.0)" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository + Install-PSResource -Name $testModuleName -Version "(1.0.0, 5.0.0)" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository $pkg = Get-InstalledPSResource $testModuleName $pkg.Name | Should -Be $testModuleName $pkg.Version | Should -Be "3.0.0" @@ -123,7 +123,7 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' { } It "Install resource with latest (including prerelease) version given Prerelease parameter" { - Install-PSResource -Name $testModuleName -Prerelease -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository + Install-PSResource -Name $testModuleName -Prerelease -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository $pkg = Get-InstalledPSResource $testModuleName $pkg.Name | Should -Be $testModuleName $pkg.Version | Should -Be "5.2.5" @@ -244,15 +244,15 @@ Describe 'Test Install-PSResource for GitHub Packages scenarios - Manual Validat It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) { Install-PSResource -Name $testModuleName -Repository $TestGalleryName -Scope AllUsers $pkg = Get-Module $testModuleName -ListAvailable - $pkg.Name | Should -Be $testModuleName + $pkg.Name | Should -Be $testModuleName $pkg.Path.Contains("/usr/") | Should -Be $true } # This needs to be manually tested due to prompt It "Install resource that requires accept license without -AcceptLicense flag" { Install-PSResource -Name $testModuleName2 -Repository $TestGalleryName - $pkg = Get-InstalledPSResource $testModuleName2 - $pkg.Name | Should -Be $testModuleName2 + $pkg = Get-InstalledPSResource $testModuleName2 + $pkg.Name | Should -Be $testModuleName2 $pkg.Version | Should -Be "0.0.1.0" } @@ -261,7 +261,7 @@ Describe 'Test Install-PSResource for GitHub Packages scenarios - Manual Validat Set-PSResourceRepository PoshTestGallery -Trusted:$false Install-PSResource -Name $testModuleName -Repository $TestGalleryName -confirm:$false - + $pkg = Get-Module $testModuleName -ListAvailable $pkg.Name | Should -Be $testModuleName diff --git a/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 index f5ec1d02b..c5bd2dfb5 100644 --- a/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 @@ -77,7 +77,7 @@ Describe 'Test Install-PSResource for local repositories' -tags 'CI' { } It "Should not install resource given nonexistant name" { - $res = Install-PSResource -Name "NonExistantModule" -Repository $localRepo -TrustRepository -PassThru -ErrorVariable err -ErrorAction SilentlyContinue + $res = Install-PSResource -Name "NonExistentModule" -Repository $localRepo -TrustRepository -PassThru -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" diff --git a/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 index 3ba5b97fa..646d7a5cc 100644 --- a/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 @@ -13,7 +13,7 @@ Describe 'Test Install-PSResource for searching and looping through repositories $testModuleName = "test_module" $testModule2Name = "test_module2" $testLocalModuleName = "test_local_mod" - $nonExistantModule = "NonExistantModule" + $nonExistentModule = "NonExistentModule" $testScriptName = "test_script" $PSGalleryName = "PSGallery" $NuGetGalleryName = "NuGetGallery" @@ -54,7 +54,7 @@ Describe 'Test Install-PSResource for searching and looping through repositories } It "should install resources that exist and not install ones that do not exist while reporting error (without -Repository specified)" { - Install-PSResource -Name $testScriptName,"NonExistantModule" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue + Install-PSResource -Name $testScriptName,"NonExistentModule" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" $res = Get-InstalledPSResource $testScriptName @@ -63,7 +63,7 @@ Describe 'Test Install-PSResource for searching and looping through repositories } It "should not install resource given nonexistant Name (without -Repository specified)" { - Install-PSResource -Name "NonExistantModule" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue + Install-PSResource -Name "NonExistentModule" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" } @@ -95,9 +95,9 @@ Describe 'Test Install-PSResource for searching and looping through repositories It "should not allow for repository name with wildcard and non-wildcard name specified in same command run" { { Install-PSResource -Name $testModuleName -Repository "*Gallery",$localRepoName } | Should -Throw -ErrorId "RepositoryNamesWithWildcardsAndNonWildcardUnsupported,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" } - + It "not install resource and write error if resource does not exist in any pattern matching repositories (-Repository with wildcard)" { - Install-PSResource -Name "nonExistantModule" -Repository "*Gallery" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue + Install-PSResource -Name "nonExistentModule" -Repository "*Gallery" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" } @@ -110,7 +110,7 @@ Describe 'Test Install-PSResource for searching and looping through repositories } It "not install resource if it does not exist in repository and write error (-Repository with single non-wildcard value)" { - Install-PSResource -Name $nonExistantModule -Repository $PSGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + Install-PSResource -Name $nonExistentModule -Repository $PSGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" } diff --git a/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 index e7f02fcc3..048b945c9 100644 --- a/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 @@ -74,8 +74,8 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' { } It "Should not install resource given nonexistant name" { - Install-PSResource -Name "NonExistantModule" -Repository $PSGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue - $pkg = Get-InstalledPSResource "NonExistantModule" + Install-PSResource -Name "NonExistentModule" -Repository $PSGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + $pkg = Get-InstalledPSResource "NonExistentModule" $pkg.Name | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" diff --git a/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 index b599de622..22e8136d4 100644 --- a/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 @@ -72,8 +72,8 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' { } It 'Should not install resource given nonexistant name' { - Install-PSResource -Name 'NonExistantModule' -Repository $NuGetGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue - $pkg = Get-InstalledPSResource 'NonExistantModule' -ErrorAction SilentlyContinue + Install-PSResource -Name 'NonExistentModule' -Repository $NuGetGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue + $pkg = Get-InstalledPSResource 'NonExistentModule' -ErrorAction SilentlyContinue $pkg.Name | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 $err[0].FullyQualifiedErrorId | Should -BeExactly 'InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource' @@ -378,7 +378,7 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' { $res3.Name | Should -Be 'testModule99' $res3.Version | Should -Be '0.0.93' } - + It "Install module and its dependencies" { $res = Install-PSResource 'TestModuleWithDependencyE' -Repository $NuGetGalleryName -TrustRepository -PassThru $res.Length | Should -Be 4 From 68c251f5162cfc9527ede62734559aa30e6c0b05 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 21:00:51 -0500 Subject: [PATCH 05/12] Fixed spelling of "nonexistant" to "nonexistent" for consistency across all scripts and test. --- test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 | 2 +- test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 | 2 +- .../FindPSResourceContainerRegistryServer.Tests.ps1 | 2 +- .../FindPSResourceGithubPackages.Tests.ps1 | 2 +- test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 | 2 +- .../FindPSResourceRepositorySearching.Tests.ps1 | 2 +- test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 | 2 +- test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 | 2 +- .../InstallPSResourceADOServer.Tests.ps1 | 2 +- .../InstallPSResourceADOV2Server.Tests.ps1 | 2 +- .../InstallPSResourceContainerRegistryServer.Tests.ps1 | 2 +- .../InstallPSResourceGithubPackages.Tests.ps1 | 2 +- test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 | 2 +- .../InstallPSResourceRepositorySearching.Tests.ps1 | 2 +- .../InstallPSResourceV2Server.Tests.ps1 | 2 +- .../InstallPSResourceV3Server.Tests.ps1 | 2 +- test/SavePSResourceTests/SavePSResourceLocal.Tests.ps1 | 2 +- test/SavePSResourceTests/SavePSResourceV2.Tests.ps1 | 2 +- test/SavePSResourceTests/SavePSResourceV3.Tests.ps1 | 2 +- test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 | 4 ++-- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 index 449d08da1..1a1fc889d 100644 --- a/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 @@ -25,7 +25,7 @@ Describe 'Test HTTP Find-PSResource for ADO Server Protocol' -tags 'CI' { $res.Version | Should -Be "5.0.0" } - It "should not find resource given nonexistant Name" { + It "should not find resource given nonexistent Name" { # FindName() $res = Find-PSResource -Name NonExistentModule -Repository $ADORepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty diff --git a/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 index 696ae1bbb..c45e6d05a 100644 --- a/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceADOV2Server.Tests.ps1 @@ -27,7 +27,7 @@ Describe 'Test HTTP Find-PSResource for ADO V2 Server Protocol' -tags 'CI' { $res.Version | Should -Be "5.0.0" } - It "Should not find resource given nonexistant Name" { + It "Should not find resource given nonexistent Name" { $res = Find-PSResource -Name NonExistentModule -Repository $ADOV2RepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 diff --git a/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 index 7d9be8b38..5d20ac6a9 100644 --- a/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 @@ -42,7 +42,7 @@ Describe 'Test HTTP Find-PSResource for ACR Server Protocol' -tags 'CI' { $res.Version | Should -Be "5.0.0" } - It "Should not find resource given nonexistant Name" { + It "Should not find resource given nonexistent Name" { # FindName() $res = Find-PSResource -Name NonExistentModule -Repository $ACRRepoName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty diff --git a/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 index baa4b0355..30512d7f7 100644 --- a/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceGithubPackages.Tests.ps1 @@ -30,7 +30,7 @@ Describe 'Test HTTP Find-PSResource for Github Packages Server' -tags 'CI' { $res.Version | Should -Be "5.0.0" } - It "should not find resource given nonexistant Name" { + It "should not find resource given nonexistent Name" { # FindName() $res = Find-PSResource -Name NonExistentModule -Repository $GithubPackagesRepoName -Credential $credential -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty diff --git a/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 index 2a2ef57e4..a3cbe2335 100644 --- a/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 @@ -94,7 +94,7 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' { # $res.Tags | Should -Contain $requiredTag } - It "should not find resource given nonexistant Name" { + It "should not find resource given nonexistent Name" { # FindName() $res = Find-PSResource -Name NonExistentModule -Repository $localRepo -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty diff --git a/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 index 66797a4a1..324151551 100644 --- a/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 @@ -92,7 +92,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - $pkg2.Repository | Should -Be $NuGetGalleryName } - It "should not find resource given nonexistant Name (without -Repository specified)" { + It "should not find resource given nonexistent Name (without -Repository specified)" { $res = Find-PSResource -Name "NonExistentModule" -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err | Should -HaveCount 1 diff --git a/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 index 53ec64e0f..139e68ab0 100644 --- a/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1 @@ -30,7 +30,7 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' { $res.Version | Should -Be "5.0.0.0" } - It "should not find resource given nonexistant Name" { + It "should not find resource given nonexistent Name" { $res = Find-PSResource -Name NonExistentModule -Repository $PSGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 diff --git a/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 index 9cd606511..b216ecd71 100644 --- a/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceV3Server.Tests.ps1 @@ -26,7 +26,7 @@ Describe 'Test HTTP Find-PSResource for V3 Server Protocol' -tags 'CI' { $res.Version | Should -Be '5.0.0' } - It 'should not find resource given nonexistant Name' { + It 'should not find resource given nonexistent Name' { $res = Find-PSResource -Name NonExistentModule -Repository $NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -BeGreaterThan 0 diff --git a/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 index 48a1fd06c..260696870 100644 --- a/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceADOServer.Tests.ps1 @@ -59,7 +59,7 @@ Describe 'Test Install-PSResource for ADO V3Server scenarios' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It "Should not install resource given nonexistant name" { + It "Should not install resource given nonexistent name" { Install-PSResource -Name "NonExistentModule" -Repository $ADORepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $pkg = Get-InstalledPSResource "NonExistentModule" $pkg | Should -BeNullOrEmpty diff --git a/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 index 840d971cf..614131b30 100644 --- a/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceADOV2Server.Tests.ps1 @@ -59,7 +59,7 @@ Describe 'Test Install-PSResource for ADO V2Server scenarios' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It "Should not install resource given nonexistant name" { + It "Should not install resource given nonexistent name" { Install-PSResource -Name "NonExistentModule" -Repository $ADORepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $pkg = Get-InstalledPSResource "NonExistentModule" $pkg | Should -BeNullOrEmpty diff --git a/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 index 905d4d41d..afe81d2c3 100644 --- a/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceContainerRegistryServer.Tests.ps1 @@ -124,7 +124,7 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It "Should not install resource given nonexistant name" { + It "Should not install resource given nonexistent name" { Install-PSResource -Name "NonExistentModule" -Repository $ACRRepoName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $pkg = Get-InstalledPSResource "NonExistentModule" $pkg | Should -BeNullOrEmpty diff --git a/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 index 51a2b190d..7f38f05b3 100644 --- a/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1 @@ -64,7 +64,7 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It "Should not install resource given nonexistant name" { + It "Should not install resource given nonexistent name" { Install-PSResource -Name "NonExistentModule" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $pkg = Get-InstalledPSResource "NonExistentModule" -ErrorAction SilentlyContinue $pkg | Should -BeNullOrEmpty diff --git a/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 index c5bd2dfb5..77c8766ad 100644 --- a/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1 @@ -76,7 +76,7 @@ Describe 'Test Install-PSResource for local repositories' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It "Should not install resource given nonexistant name" { + It "Should not install resource given nonexistent name" { $res = Install-PSResource -Name "NonExistentModule" -Repository $localRepo -TrustRepository -PassThru -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -BeNullOrEmpty $err.Count | Should -Not -Be 0 diff --git a/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 index 646d7a5cc..422337e3a 100644 --- a/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 @@ -62,7 +62,7 @@ Describe 'Test Install-PSResource for searching and looping through repositories $res.Repository | Should -Be $PSGalleryName } - It "should not install resource given nonexistant Name (without -Repository specified)" { + It "should not install resource given nonexistent Name (without -Repository specified)" { Install-PSResource -Name "NonExistentModule" -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue $err | Should -HaveCount 1 $err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource" diff --git a/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 index 048b945c9..d4e228635 100644 --- a/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1 @@ -73,7 +73,7 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It "Should not install resource given nonexistant name" { + It "Should not install resource given nonexistent name" { Install-PSResource -Name "NonExistentModule" -Repository $PSGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $pkg = Get-InstalledPSResource "NonExistentModule" $pkg.Name | Should -BeNullOrEmpty diff --git a/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 index 22e8136d4..e18b9272d 100644 --- a/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1 @@ -71,7 +71,7 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' { $pkg.Name | Should -Be $pkgNames } - It 'Should not install resource given nonexistant name' { + It 'Should not install resource given nonexistent name' { Install-PSResource -Name 'NonExistentModule' -Repository $NuGetGalleryName -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue $pkg = Get-InstalledPSResource 'NonExistentModule' -ErrorAction SilentlyContinue $pkg.Name | Should -BeNullOrEmpty diff --git a/test/SavePSResourceTests/SavePSResourceLocal.Tests.ps1 b/test/SavePSResourceTests/SavePSResourceLocal.Tests.ps1 index 60b574975..5b090e739 100644 --- a/test/SavePSResourceTests/SavePSResourceLocal.Tests.ps1 +++ b/test/SavePSResourceTests/SavePSResourceLocal.Tests.ps1 @@ -83,7 +83,7 @@ Describe 'Test Save-PSResource for local repositories' -tags 'CI' { (Get-ChildItem $pkgDirs[1].FullName) | Should -HaveCount 1 } - It "Should not save resource given nonexistant name" { + It "Should not save resource given nonexistent name" { Save-PSResource -Name NonExistentModule -Repository $localRepo -Path $SaveDir -ErrorVariable err -ErrorAction SilentlyContinue -TrustRepository $pkgDir = Get-ChildItem -Path $SaveDir | Where-Object Name -eq "NonExistentModule" $pkgDir.Name | Should -BeNullOrEmpty diff --git a/test/SavePSResourceTests/SavePSResourceV2.Tests.ps1 b/test/SavePSResourceTests/SavePSResourceV2.Tests.ps1 index ee350f91e..609c73e3d 100644 --- a/test/SavePSResourceTests/SavePSResourceV2.Tests.ps1 +++ b/test/SavePSResourceTests/SavePSResourceV2.Tests.ps1 @@ -52,7 +52,7 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' { (Get-ChildItem $pkgDirs[1].FullName) | Should -HaveCount 1 } - It "Should not save resource given nonexistant name" { + It "Should not save resource given nonexistent name" { Save-PSResource -Name NonExistentModule -Repository $PSGalleryName -Path $SaveDir -ErrorVariable err -ErrorAction SilentlyContinue -TrustRepository $pkgDir = Get-ChildItem -Path $SaveDir | Where-Object Name -EQ "NonExistentModule" $pkgDir.Name | Should -BeNullOrEmpty diff --git a/test/SavePSResourceTests/SavePSResourceV3.Tests.ps1 b/test/SavePSResourceTests/SavePSResourceV3.Tests.ps1 index 8078d28ca..037ed1674 100644 --- a/test/SavePSResourceTests/SavePSResourceV3.Tests.ps1 +++ b/test/SavePSResourceTests/SavePSResourceV3.Tests.ps1 @@ -42,7 +42,7 @@ Describe 'Test HTTP Save-PSResource for V3 Server Protocol' -tags 'CI' { (Get-ChildItem $pkgDirs[1].FullName) | Should -HaveCount 1 } - It 'Should not save resource given nonexistant name' { + It 'Should not save resource given nonexistent name' { Save-PSResource -Name NonExistentModule -Repository $NuGetGalleryName -Path $SaveDir -ErrorVariable err -ErrorAction SilentlyContinue -TrustRepository $pkgDir = Get-ChildItem -Path $SaveDir | Where-Object Name -EQ 'NonExistentModule' $pkgDir.Name | Should -BeNullOrEmpty diff --git a/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 b/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 index eed558be7..74d3f1839 100644 --- a/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 +++ b/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 @@ -173,7 +173,7 @@ Describe 'Test Uninstall-PSResource for Modules' -tags 'CI' { It "Not uninstall non-prerelease version module when similar prerelease version is specified" { # test_module has a version 5.0.0.0, but no version 5.0.0-preview. - # despite the core version part being the same this uninstall on a nonexistant prerelease version should not be successful + # despite the core version part being the same this uninstall on a nonexistent prerelease version should not be successful Install-PSResource -Name $testModuleName -Version "5.0.0.0" -Repository $PSGalleryName -TrustRepository Uninstall-PSResource -Name $testModuleName -Version "5.0.0-preview" -ErrorAction SilentlyContinue -SkipDependencyCheck $res = Get-InstalledPSResource -Name $testModuleName -Version "5.0.0.0" @@ -243,7 +243,7 @@ Describe 'Test Uninstall-PSResource for Modules' -tags 'CI' { $pkg = Get-InstalledPSResource $testModuleName -Version "5.0.0.0" $pkg.Version | Should -Be "5.0.0.0" - $match = Get-Content .\testUninstallWhatIf.txt | + $match = Get-Content .\testUninstallWhatIf.txt | select-string -pattern "What if: Performing the operation ""Uninstall-PSResource"" on target ""Uninstall resource 'test_module2', version '5.0.0.0', from path '" -SimpleMatch $match -ne $null From c37d079c8e83da926587b1e2219b8c8a6de9f7c2 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 21:01:32 -0500 Subject: [PATCH 06/12] Fixed typo in "proprties" --- test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 index 1a1fc889d..b58dcd736 100644 --- a/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceADOServer.Tests.ps1 @@ -130,7 +130,7 @@ Describe 'Test HTTP Find-PSResource for ADO Server Protocol' -tags 'CI' { $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } - It "should not find resources when given Name with wildcard and Tag proprties" { + It "should not find resources when given Name with wildcard and Tag properties" { # FindNameGlobbingWithTag() $requiredTag = "test" $nameWithWildcard = "test_local_m*" From c8d61c9b8aba87ba2078f96be7e97cf45aa6b47f Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 21:03:27 -0500 Subject: [PATCH 07/12] Fix typo in "wilcard" to "wildcard" in test descriptions for clarity --- .../FindPSResourceRepositorySearching.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 b/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 index 324151551..4f010de2f 100644 --- a/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 +++ b/test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 @@ -271,7 +271,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - $err[0].FullyQualifiedErrorId | Should -BeExactly "PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource" } - It "should not find resource from repositories where it does not exist and not write error since package Name contains wilcard" -Pending { + It "should not find resource from repositories where it does not exist and not write error since package Name contains wildcard" -Pending { $res = Find-PSResource -Name "NonExistentPkg*" -Repository $PSGalleryName,$NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res | Should -HaveCount 0 $err | Should -HaveCount 0 @@ -439,7 +439,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' - } It "find resource from all repositories where it exists and write errors for those it does not exist from (-Repository with multiple non-wildcard values)" { - # Package eith Tag "Tag-TestMyLocalScript-1.0.0.0" exists in the following repositories: PSGallery + # Package with Tag "Tag-TestMyLocalScript-1.0.0.0" exists in the following repositories: PSGallery $tagForPkgOnPSGallery = "Tag-TestMyLocalScript-1.0.0.0" $res = Find-PSResource -Tag $tagForPkgOnPSGallery -Repository $PSGalleryName,$NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue $res.Count | Should -BeGreaterOrEqual 2 From 1a16be048535c85375a5e4bc9c31d92c723ab1c1 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 21:23:42 -0500 Subject: [PATCH 08/12] Fix typos and improve consistency in formatting across multiple test files --- .../GetInstalledPSResource.Tests.ps1 | 16 +++--- ...allPSResourceRepositorySearching.Tests.ps1 | 2 +- test/PSResourceInfo.Tests.ps1 | 2 +- .../TestPSScriptFile.Tests.ps1 | 8 +-- .../CompressPSResource.Tests.ps1 | 22 ++++---- .../PublishPSResource.Tests.ps1 | 18 +++---- ...SResourceContainerRegistryServer.Tests.ps1 | 2 +- .../RegisterPSResourceRepository.Tests.ps1 | 10 ++-- .../UninstallPSResource.Tests.ps1 | 4 +- .../UpdateModuleManifest.Tests.ps1 | 54 +++++++++---------- 10 files changed, 69 insertions(+), 69 deletions(-) diff --git a/test/GetInstalledPSResource/GetInstalledPSResource.Tests.ps1 b/test/GetInstalledPSResource/GetInstalledPSResource.Tests.ps1 index 1f6feab66..51f96a989 100644 --- a/test/GetInstalledPSResource/GetInstalledPSResource.Tests.ps1 +++ b/test/GetInstalledPSResource/GetInstalledPSResource.Tests.ps1 @@ -54,7 +54,7 @@ Describe 'Test Get-InstalledPSResource for Module' -tags 'CI' { $pkgs.Name | Should -Contain $testModuleName } -$testCases = +$testCases = @{Version="[1.0.0.0]"; ExpectedVersion="1.0.0.0"; Reason="validate version, exact match"}, @{Version="1.0.0.0"; ExpectedVersion="1.0.0.0"; Reason="validate version, exact match without bracket syntax"}, @{Version="[1.0.0.0, 5.0.0.0]"; ExpectedVersion=@("5.0.0.0", "3.0.0.0", "1.0.0.0"); Reason="validate version, exact range inclusive"}, @@ -73,10 +73,10 @@ $testCases = } It "Throw invalid version error when passing incorrectly formatted version such as " -TestCases @( - @{Version='[1.*.0]'; Description="version with wilcard in middle"}, - @{Version='[*.0.0.0]'; Description="version with wilcard at start"}, + @{Version='[1.*.0]'; Description="version with wildcard in middle"}, + @{Version='[*.0.0.0]'; Description="version with wildcard at start"}, @{Version='[1.*.0.0]'; Description="version with wildcard at second digit"}, - @{Version='[1.0.*.0]'; Description="version with wildcard at third digit"} + @{Version='[1.0.*.0]'; Description="version with wildcard at third digit"}, @{Version='[1.0.0.*'; Description="version with wildcard at end"}, @{Version='[1..0.0]'; Description="version with missing digit in middle"}, @{Version='[1.0.0.]'; Description="version with missing digit at end"}, @@ -89,13 +89,13 @@ $testCases = $res = Find-PSResource -Name $testModuleName -Version $Version -Repository $PSGalleryName -ErrorAction Ignore } catch {} - + $res | Should -BeNullOrEmpty } # These versions technically parse into proper NuGet versions, but will not return the version expected It "Does not return resource when passing incorrectly formatted version such as , does not throw error" -TestCases @( - @{Version='(1.0.0.0)'; Description="exlcusive version (8.1.0.0)"}, + @{Version='(1.0.0.0)'; Description="exclusive version (8.1.0.0)"}, @{Version='[1-0-0-0]'; Description="version formatted with invalid delimiter"} ) { @@ -106,7 +106,7 @@ $testCases = $res = Find-PSResource -Name $testModuleName -Version $Version -Repository $PSGalleryName -ErrorAction Ignore } catch {} - + $res | Should -BeNullOrEmpty } @@ -181,4 +181,4 @@ $testCases = $pkg.Name | Should -contain "testmodule99" $pkg.InstalledLocation.ToString().Contains("/.local") | Should -Be $true } -} \ No newline at end of file +} diff --git a/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 b/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 index 422337e3a..46d4c54a6 100644 --- a/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 +++ b/test/InstallPSResourceTests/InstallPSResourceRepositorySearching.Tests.ps1 @@ -34,7 +34,7 @@ Describe 'Test Install-PSResource for searching and looping through repositories Get-RevertPSResourceRepositoryFile } - It "install resources from higest priority repository where it exists (without -Repository specified)" { + It "install resources from highest priority repository where it exists (without -Repository specified)" { # Package "test_module" exists in the following repositories (in this order): localRepo, PSGallery, NuGetGallery $res = Install-PSResource -Name $testModuleName -TrustRepository -SkipDependencyCheck -ErrorVariable err -ErrorAction SilentlyContinue -PassThru $err | Should -HaveCount 0 diff --git a/test/PSResourceInfo.Tests.ps1 b/test/PSResourceInfo.Tests.ps1 index 785a5ef57..033bd82d8 100644 --- a/test/PSResourceInfo.Tests.ps1 +++ b/test/PSResourceInfo.Tests.ps1 @@ -40,7 +40,7 @@ Describe "Write PSGetModuleInfo xml file" -tags 'CI' { { [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::WritePSGetResourceInfo($fileToWrite, $psGetInfo) } | Should -Not -Throw } - It "Verifes written file can be read successfully" { + It "Verifies written file can be read successfully" { $newGetInfo = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::ReadPSGetResourceInfo($fileToWrite) CheckForExpectedPSGetInfo $newGetInfo } diff --git a/test/PSScriptFileInfoTests/TestPSScriptFile.Tests.ps1 b/test/PSScriptFileInfoTests/TestPSScriptFile.Tests.ps1 index 47da1dfea..c14470aca 100644 --- a/test/PSScriptFileInfoTests/TestPSScriptFile.Tests.ps1 +++ b/test/PSScriptFileInfoTests/TestPSScriptFile.Tests.ps1 @@ -18,7 +18,7 @@ Describe "Test Test-PSScriptFileInfo" -tags 'CI' { $script:testScriptsFolderPath = Join-Path $testFilesFolderPath -ChildPath "testScripts" } - It "determine script file with minimal required fields as valid" { + It "determine script file with minimal required fields as valid" { $scriptFilePath = Join-Path -Path $tmpDir1Path -ChildPath "testscript.ps1" $scriptDescription = "this is a test script" New-PSScriptFileInfo -Path $scriptFilePath -Description $scriptDescription @@ -64,18 +64,18 @@ Describe "Test Test-PSScriptFileInfo" -tags 'CI' { $scriptName = "ScriptWithoutEmptyLinesInMetadata.ps1" $scriptFilePath = Join-Path $script:testScriptsFolderPath -ChildPath $scriptName - Test-PSScriptFileInfo $scriptFilePath | Should -Be $true + Test-PSScriptFileInfo $scriptFilePath | Should -Be $true } It "determine script without empty lines between comment blocks is valid" { $scriptName = "ScriptWithoutEmptyLinesBetweenCommentBlocks.ps1" $scriptFilePath = Join-Path $script:testScriptsFolderPath -ChildPath $scriptName - Test-PSScriptFileInfo $scriptFilePath | Should -Be $true + Test-PSScriptFileInfo $scriptFilePath | Should -Be $true } It "determine script file with varying case sensitivity for Script Metadata or Help Comment keys is valid" { - $scriptName = "VaryingCaseSensisityKeysScript.ps1" + $scriptName = "VaryingCaseSensitivityKeysScript.ps1" $scriptFilePath = Join-Path $script:testScriptsFolderPath -ChildPath $scriptName Test-PSScriptFileInfo $scriptFilePath | Should -Be $true diff --git a/test/PublishPSResourceTests/CompressPSResource.Tests.ps1 b/test/PublishPSResourceTests/CompressPSResource.Tests.ps1 index 28f74a742..75205069e 100644 --- a/test/PublishPSResourceTests/CompressPSResource.Tests.ps1 +++ b/test/PublishPSResourceTests/CompressPSResource.Tests.ps1 @@ -151,9 +151,9 @@ Describe "Test Compress-PSResource" -tags 'CI' { It "Compress-PSResource compresses a module into a nupkg and saves it to the DestinationPath" { $version = "1.0.0" New-ModuleManifest -Path (Join-Path -Path $script:PublishModuleBase -ChildPath "$script:PublishModuleName.psd1") -ModuleVersion $version -Description "$script:PublishModuleName module" - + Compress-PSResource -Path $script:PublishModuleBase -DestinationPath $script:repositoryPath - + $expectedPath = Join-Path -Path $script:repositoryPath -ChildPath "$script:PublishModuleName.$version.nupkg" (Get-ChildItem $script:repositoryPath).FullName | Should -Be $expectedPath } @@ -179,7 +179,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { # Must change .nupkg to .zip so that Expand-Archive can work on Windows PowerShell $nupkgPath = Join-Path -Path $script:repositoryPath -ChildPath "$script:PublishModuleName.$version.nupkg" $zipPath = Join-Path -Path $script:repositoryPath -ChildPath "$script:PublishModuleName.$version.zip" - Rename-Item -Path $nupkgPath -NewName $zipPath + Rename-Item -Path $nupkgPath -NewName $zipPath $unzippedPath = Join-Path -Path $TestDrive -ChildPath "$script:PublishModuleName" New-Item $unzippedPath -Itemtype directory -Force Expand-Archive -Path $zipPath -DestinationPath $unzippedPath @@ -238,7 +238,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { Remove-Item -Path $relativePath -Recurse -Force Remove-Item -Path $relativeDestination -Recurse -Force } - + It "Compress-PSResource -PassThru returns a FileInfo object with the correct path" { $version = "1.0.0" New-ModuleManifest -Path (Join-Path -Path $script:PublishModuleBase -ChildPath "$script:PublishModuleName.psd1") -ModuleVersion $version -Description "$script:PublishModuleName module" @@ -252,7 +252,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { $fileInfoObject.Name | Should -Be "$script:PublishModuleName.$version.nupkg" } - It "Compress-PSResource creates nuspec dependecy version range when RequiredVersion is in RequiredModules section" { + It "Compress-PSResource creates nuspec dependency version range when RequiredVersion is in RequiredModules section" { $version = "1.0.0" $requiredModules = @( @{ @@ -276,7 +276,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { $nuspecxml.package.metadata.dependencies.dependency.version.replace(' ', '') | Should -BeExactly '[2.0.0]' } - It "Compress-PSResource creates nuspec dependecy version range when ModuleVersion is in RequiredModules section" { + It "Compress-PSResource creates nuspec dependency version range when ModuleVersion is in RequiredModules section" { $version = "1.0.0" $requiredModules = @( @{ @@ -298,7 +298,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { $nuspecxml.package.metadata.dependencies.dependency.version.replace(' ', '') | Should -BeExactly '2.0.0' } - It "Compress-PSResource creates nuspec dependecy version range when MaximumVersion is in RequiredModules section" { + It "Compress-PSResource creates nuspec dependency version range when MaximumVersion is in RequiredModules section" { $version = "1.0.0" $requiredModules = @( @{ @@ -320,7 +320,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { $nuspecxml.package.metadata.dependencies.dependency.version.replace(' ', '') | Should -BeExactly '(,2.0.0]' } - It "Compress-PSResource creates nuspec dependecy version range when ModuleVersion and MaximumVersion are in RequiredModules section" { + It "Compress-PSResource creates nuspec dependency version range when ModuleVersion and MaximumVersion are in RequiredModules section" { $version = "1.0.0" $requiredModules = @( @{ @@ -343,7 +343,7 @@ Describe "Test Compress-PSResource" -tags 'CI' { $nuspecxml.package.metadata.dependencies.dependency.version.replace(' ', '') | Should -BeExactly '[1.0.0,2.0.0]' } - It "Compress-PSResource creates nuspec dependecy version range when there are multiple modules in RequiredModules section" { + It "Compress-PSResource creates nuspec dependency version range when there are multiple modules in RequiredModules section" { $version = "1.0.0" $requiredModules = @( @{ @@ -402,14 +402,14 @@ Describe "Test Compress-PSResource" -tags 'CI' { New-ModuleManifest -Path (Join-Path -Path $script:PublishModuleBase -ChildPath "$script:PublishModuleName.psd1") -ModuleVersion $version -Description "$script:PublishModuleName module" Compress-PSResource -Path $script:PublishModuleBase -DestinationPath $script:repositoryPath2 - + $expectedPath = Join-Path -Path $script:repositoryPath2 -ChildPath "$script:PublishModuleName.$version.nupkg" (Get-ChildItem $script:repositoryPath2).FullName | Should -Be $expectedPath # create test cert # Create a self-signed certificate for code signing $testCert = New-SelfSignedCertificate -Subject "CN=NuGet Test Developer, OU=Use for testing purposes ONLY" -FriendlyName "NuGetTestDeveloper" -Type CodeSigning -KeyUsage DigitalSignature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256 -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -CertStoreLocation "Cert:\CurrentUser\My" - + # sign the nupkg $nupkgPath = Join-Path -Path $script:repositoryPath2 -ChildPath "$script:PublishModuleName.$version.nupkg" Set-AuthenticodeSignature -FilePath $nupkgPath -Certificate $testCert diff --git a/test/PublishPSResourceTests/PublishPSResource.Tests.ps1 b/test/PublishPSResourceTests/PublishPSResource.Tests.ps1 index 0bdefc185..e97f64407 100644 --- a/test/PublishPSResourceTests/PublishPSResource.Tests.ps1 +++ b/test/PublishPSResourceTests/PublishPSResource.Tests.ps1 @@ -107,7 +107,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { } AfterEach { # Delete all contents of the repository without deleting the repository directory itself - $pkgsToDelete = Join-Path -Path "$script:repositoryPath" -ChildPath "*" + $pkgsToDelete = Join-Path -Path "$script:repositoryPath" -ChildPath "*" Remove-Item $pkgsToDelete -Recurse $pkgsToDelete = Join-Path -Path "$script:repositoryPath2" -ChildPath "*" @@ -318,7 +318,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { # Must change .nupkg to .zip so that Expand-Archive can work on Windows PowerShell $nupkgPath = Join-Path -Path $script:repositoryPath -ChildPath "$script:PublishModuleName.$version.nupkg" $zipPath = Join-Path -Path $script:repositoryPath -ChildPath "$script:PublishModuleName.$version.zip" - Rename-Item -Path $nupkgPath -NewName $zipPath + Rename-Item -Path $nupkgPath -NewName $zipPath $unzippedPath = Join-Path -Path $TestDrive -ChildPath "$script:PublishModuleName" New-Item $unzippedPath -Itemtype directory -Force Expand-Archive -Path $zipPath -DestinationPath $unzippedPath @@ -333,7 +333,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { Compress-PSResource -Path $script:PublishModuleBase -DestinationPath $script:destinationPath $expectedPath = Join-Path -Path $script:destinationPath -ChildPath "$script:PublishModuleName.$version.nupkg" (Get-ChildItem $script:destinationPath).FullName | Should -Be $expectedPath - + # Pass the nupkg via -NupkgPath Publish-PSResource -NupkgPath $expectedPath -Repository $testRepository2 $expectedPath = Join-Path -Path $script:repositoryPath2 -ChildPath "$script:PublishModuleName.$version.nupkg" @@ -477,7 +477,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { $moduleName = "Pester" $moduleVersion = "5.5.0" Save-PSResource -Name $moduleName -Path $tmpRepoPath -Version $moduleVersion -Repository PSGallery -TrustRepository - $modulePath = Join-Path -Path $tmpRepoPath -ChildPath $moduleName + $modulePath = Join-Path -Path $tmpRepoPath -ChildPath $moduleName $moduleVersionPath = Join-Path -Path $modulePath -ChildPath $moduleVersion $moduleManifestPath = Join-path -Path $moduleVersionPath -ChildPath "$moduleName.psd1" Publish-PSResource -Path $moduleManifestPath -Repository $testRepository2 @@ -569,7 +569,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { $scriptPath = Join-Path -Path $script:testScriptsFolderPath -ChildPath "$scriptName.ps1" New-PSScriptFileInfo -Description 'test' -Version $scriptVersion -RequiredModules @{ModuleName='testModule'} -ExternalModuleDependencies 'testModule' -Path $scriptPath -Force - Publish-PSResource -Path $scriptPath + Publish-PSResource -Path $scriptPath $expectedPath = Join-Path -Path $script:repositoryPath -ChildPath "$scriptName.$scriptVersion.nupkg" (Get-ChildItem $script:repositoryPath).FullName | Should -Be $expectedPath @@ -627,7 +627,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { } It "should write error and not publish script when Description block altogether is missing" { - # we expect .ps1 files to have a separate comment block for .DESCRIPTION property, not to be included in the PSScriptInfo commment block + # we expect .ps1 files to have a separate comment block for .DESCRIPTION property, not to be included in the PSScriptInfo comment block $scriptName = "InvalidScriptMissingDescriptionCommentBlock.ps1" $scriptVersion = "1.0.0" @@ -673,7 +673,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { $DepPrereleaseLabel = "beta" $DepModuleRoot = Join-Path -Path $script:PublishModuleBase -ChildPath $DepModuleName - New-TestModule -Path $DepModuleRoot -ModuleName $DepModuleName -RepoName $testRepository2 -PackageVersion $DepVersion -prereleaseLabel $DepPrereleaseLabel + New-TestModule -Path $DepModuleRoot -ModuleName $DepModuleName -RepoName $testRepository2 -PackageVersion $DepVersion -prereleaseLabel $DepPrereleaseLabel Install-PSResource -Name $DepModuleName -Repository $testRepository2 -TrustRepository -Prerelease $expectedPath = Join-Path -Path $script:repositoryPath2 -ChildPath "$DepModuleName.$DepVersion-$DepPrereleaseLabel.nupkg" @@ -714,7 +714,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { New-ModuleManifest -Path $ModuleManifestPath -ModuleVersion $ModuleVersion -Description "$ModuleName module" -RequiredModules @( @{ "ModuleName" = $ReqModule1Name; "ModuleVersion" = $ReqModule1Version }, $ReqModule2Name ) New-ModuleManifest -Path $ReqModule1ManifestPath -ModuleVersion $ReqModule1Version -Description "$ReqModule1Name module" New-ModuleManifest -Path $ReqModule2ManifestPath -Description "$ReqModule1Name module" - + Publish-PSResource -Path $ReqModule1ManifestPath -Repository $testRepository2 Publish-PSResource -Path $ReqModule2ManifestPath -Repository $testRepository2 @@ -734,7 +734,7 @@ Describe "Test Publish-PSResource with Module Prefix" -tags 'CI' { BeforeAll { Get-NewPSResourceRepositoryFile - + $tmpRepoPath2 = Join-Path -Path $TestDrive -ChildPath "tmpRepoPath2" New-Item $tmpRepoPath2 -Itemtype directory -Force $testRepository2 = "testRepository2" diff --git a/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1 b/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1 index 0ce8ba63a..9714a627c 100644 --- a/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1 +++ b/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1 @@ -469,7 +469,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { } It "Should write error and not publish script when Description block altogether is missing" { - # we expect .ps1 files to have a separate comment block for .DESCRIPTION property, not to be included in the PSScriptInfo commment block + # we expect .ps1 files to have a separate comment block for .DESCRIPTION property, not to be included in the PSScriptInfo comment block $scriptName = "InvalidScriptMissingDescriptionCommentBlock.ps1" $scriptFilePath = Join-Path $script:testScriptsFolderPath -ChildPath $scriptName diff --git a/test/ResourceRepositoryTests/RegisterPSResourceRepository.Tests.ps1 b/test/ResourceRepositoryTests/RegisterPSResourceRepository.Tests.ps1 index fcaa9dcda..93df34b22 100644 --- a/test/ResourceRepositoryTests/RegisterPSResourceRepository.Tests.ps1 +++ b/test/ResourceRepositoryTests/RegisterPSResourceRepository.Tests.ps1 @@ -26,7 +26,7 @@ Describe "Test Register-PSResourceRepository" -tags 'CI' { $randomSecret = [System.IO.Path]::GetRandomFileName() $randomPassword = [System.IO.Path]::GetRandomFileName() - + $credentialInfo1 = New-Object Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo ("testvault", $randomSecret) $secureString = ConvertTo-SecureString $randomPassword -AsPlainText -Force $credential = New-Object pscredential ("testusername", $secureString) @@ -42,7 +42,7 @@ Describe "Test Register-PSResourceRepository" -tags 'CI' { Get-RemoveTestDirs($tmpDirPaths) } - It "register repository given Name, Uri (bare minimum for NameParmaterSet)" { + It "register repository given Name, Uri (bare minimum for NameParameterSet)" { $res = Register-PSResourceRepository -Name $TestRepoName1 -Uri $tmpDir1Path -PassThru $res.Name | Should -Be $TestRepoName1 $Res.Uri.LocalPath | Should -Contain $tmpDir1Path @@ -268,7 +268,7 @@ Describe "Test Register-PSResourceRepository" -tags 'CI' { $correctHashtable1 = @{Name = $TestRepoName2; Uri = $tmpDir2Path; Trusted = $True} $correctHashtable2 = @{Name = $TestRepoName3; Uri = $tmpDir3Path; Trusted = $True; Priority = 20} $correctHashtable3 = @{PSGallery = $True; Priority = 30}; - $IncorrectHashTable = @{Name = $PSGalleryName; Uri = $tmpDir1Path}; + $IncorrectHashTable = @{Name = $PSGalleryName; Uri = $tmpDir1Path}; $arrayOfHashtables = $correctHashtable1, $correctHashtable2, $IncorrectHashTable, $correctHashtable3 Unregister-PSResourceRepository -Name $PSGalleryName @@ -367,7 +367,7 @@ Describe "Test Register-PSResourceRepository" -tags 'CI' { $res.Name | Should -Be "localFileShareTestRepo" $res.Uri.LocalPath | Should -Contain "\\hcgg.rest.of.domain.name\test\ITxx\team\NuGet\" } - + It "throws error if CredentialInfo is passed in with Credential property without SecretManagement module setup" { { Register-PSResourceRepository -Name $TestRepoName1 -Uri $tmpDir1Path -Trusted -Priority 20 -CredentialInfo $credentialInfo2 -ErrorAction SilentlyContinue } | Should -Throw @@ -378,7 +378,7 @@ Describe "Test Register-PSResourceRepository" -tags 'CI' { It "should register a repository with a hashtable passed in as CredentialInfo" { $hashtable = @{VaultName = "testvault"; SecretName = $randomSecret} - Register-PSResourceRepository -Name $TestRepoName1 -Uri $tmpDir1Path -Trusted -Priority 20 -CredentialInfo $hashtable + Register-PSResourceRepository -Name $TestRepoName1 -Uri $tmpDir1Path -Trusted -Priority 20 -CredentialInfo $hashtable $res = Get-PSResourceRepository -Name $TestRepoName1 $res.CredentialInfo.VaultName | Should -Be "testvault" diff --git a/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 b/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 index 74d3f1839..0a1fa10fc 100644 --- a/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 +++ b/test/UninstallPSResourceTests/UninstallPSResource.Tests.ps1 @@ -132,8 +132,8 @@ Describe 'Test Uninstall-PSResource for Modules' -tags 'CI' { $pkgs.Version | Should -Not -Contain $Version } - $testCases2 = @{Version='[1.*.0]'; Description="version with wilcard in middle"}, - @{Version='[*.0.0.0]'; Description="version with wilcard at start"}, + $testCases2 = @{Version='[1.*.0]'; Description="version with wildcard in middle"}, + @{Version='[*.0.0.0]'; Description="version with wildcard at start"}, @{Version='[1.*.0.0]'; Description="version with wildcard at second digit"}, @{Version='[1.0.*.0]'; Description="version with wildcard at third digit"} @{Version='[1.0.0.*]'; Description="version with wildcard at end"}, diff --git a/test/UpdateModuleManifest/UpdateModuleManifest.Tests.ps1 b/test/UpdateModuleManifest/UpdateModuleManifest.Tests.ps1 index d20d25076..b922b38c4 100644 --- a/test/UpdateModuleManifest/UpdateModuleManifest.Tests.ps1 +++ b/test/UpdateModuleManifest/UpdateModuleManifest.Tests.ps1 @@ -34,37 +34,37 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { It "Update module manifest given Guid parameter" { $Guid = [guid]::NewGuid() New-ModuleManifest -Path $script:testManifestPath - Update-PSModuleManifest -Path $script:testManifestPath -Guid $Guid + Update-PSModuleManifest -Path $script:testManifestPath -Guid $Guid $results = Test-ModuleManifest -Path $script:testManifestPath - $results.Guid | Should -Be $Guid + $results.Guid | Should -Be $Guid } It "Update module manifest given Author parameter" { - $Author = "Test Author" + $Author = "Test Author" New-ModuleManifest -Path $script:testManifestPath - Update-PSModuleManifest -Path $script:testManifestPath -Author $Author + Update-PSModuleManifest -Path $script:testManifestPath -Author $Author $results = Test-ModuleManifest -Path $script:testManifestPath - $results.Author | Should -Be $Author + $results.Author | Should -Be $Author } It "Update module manifest given Description parameter" { $Description = "PSResourceGet test description" New-ModuleManifest -Path $script:testManifestPath - Update-PSModuleManifest -Path $script:testManifestPath -Description $Description + Update-PSModuleManifest -Path $script:testManifestPath -Description $Description $results = Test-ModuleManifest -Path $script:testManifestPath - $results.Description | Should -Be $Description + $results.Description | Should -Be $Description } It "Update module manifest given ModuleVersion parameter" { $ModuleVersion = "7.0.0.0" New-ModuleManifest -Path $script:testManifestPath - Update-PSModuleManifest -Path $script:testManifestPath -ModuleVersion $ModuleVersion + Update-PSModuleManifest -Path $script:testManifestPath -ModuleVersion $ModuleVersion $results = Test-ModuleManifest -Path $script:testManifestPath - $results.Version.ToString() | Should -Be $ModuleVersion + $results.Version.ToString() | Should -Be $ModuleVersion } It "Update module manifest given RequiredModules parameter" { @@ -121,7 +121,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -Tags $Tag1, $Tag2 $results = Test-ModuleManifest -Path $script:testManifestPath - $results.PrivateData.PSData.Tags | Should -Be @($Tag1, $Tag2) + $results.PrivateData.PSData.Tags | Should -Be @($Tag1, $Tag2) } It "Update module manifest given Tag parameter" { @@ -132,7 +132,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-ModuleManifest -Path $script:testManifestPath -Tag $Tag1, $Tag2 $results = Test-ModuleManifest -Path $script:testManifestPath - $results.PrivateData.PSData.Tags | Should -Be @($Tag1, $Tag2) + $results.PrivateData.PSData.Tags | Should -Be @($Tag1, $Tag2) } It "Update module manifest given ProjectUri parameter" { @@ -225,7 +225,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -RootModule $RootModuleName $results = Test-ModuleManifest -Path $script:testManifestPath - $results.RootModule | Should -Be $RootModuleName + $results.RootModule | Should -Be $RootModuleName } It "Update module manifest given RequiredAssemblies parameter" { @@ -242,7 +242,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -RequiredAssemblies $RequiredAssembly1, $RequiredAssembly2 $results = Test-ModuleManifest -Path $script:testManifestPath - $results.RequiredAssemblies | Should -Be @($RequiredAssembly1, $RequiredAssembly2) + $results.RequiredAssemblies | Should -Be @($RequiredAssembly1, $RequiredAssembly2) } It "Update module manifest given NestedModules parameter" { @@ -261,7 +261,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -NestedModules $NestedModule1, $NestedModule2 $results = Test-ModuleManifest -Path $script:testManifestPath - $results.NestedModules | Should -Be @($NestedModule1, $NestedModule2) + $results.NestedModules | Should -Be @($NestedModule1, $NestedModule2) } It "Update module manifest given FileList parameter" { @@ -278,7 +278,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -FileList $FileList1, $FileList2 $results = Test-ModuleManifest -Path $script:testManifestPath - $results.FileList | Should -Be @($FileListPath1, $FileListPath2) + $results.FileList | Should -Be @($FileListPath1, $FileListPath2) } It "Update module manifest given TypesToProcess parameter" { @@ -323,7 +323,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -ScriptsToProcess $Script1, $Script2 $results = Test-ModuleManifest -Path $script:testManifestPath - $results.Scripts | Should -Be @($ScriptPath1, $ScriptPath2) + $results.Scripts | Should -Be @($ScriptPath1, $ScriptPath2) } It "Update module manifest given ProcessorArchitecture parameter" { @@ -333,7 +333,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath -ProcessorArchitecture $ProcessorArchitecture $results = Test-ModuleManifest -Path $script:testManifestPath - $results.ProcessorArchitecture | Should -Be $ProcessorArchitecture + $results.ProcessorArchitecture | Should -Be $ProcessorArchitecture } It "Update module manifest given ModuleList parameter" { @@ -369,14 +369,14 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { -CompatiblePSEditions $CompatiblePSEditions $results = Test-ModuleManifest -Path $script:testManifestPath - $results.CompanyName | Should -Be $CompanyName - $results.Copyright | Should -Be $Copyright - $results.PowerShellVersion | Should -Be $PowerShellVersion - $results.ClrVersion | Should -Be $ClrVersion - $results.DotnetFrameworkVersion | Should -Be $DotnetFrameworkVersion - $results.PowerShellHostVersion | Should -Be $PowerShellHostVersion - $results.HelpInfoUri | Should -Be $HelpInfoUri - $results.CompatiblePSEditions | Should -Be $CompatiblePSEditions + $results.CompanyName | Should -Be $CompanyName + $results.Copyright | Should -Be $Copyright + $results.PowerShellVersion | Should -Be $PowerShellVersion + $results.ClrVersion | Should -Be $ClrVersion + $results.DotnetFrameworkVersion | Should -Be $DotnetFrameworkVersion + $results.PowerShellHostVersion | Should -Be $PowerShellHostVersion + $results.HelpInfoUri | Should -Be $HelpInfoUri + $results.CompatiblePSEditions | Should -Be $CompatiblePSEditions } It "Update module manifest given FunctionsToExport, AliasesToExport, and VariablesToExport parameters" -Skip:(Get-IsWindows) { @@ -388,7 +388,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { Update-PSModuleManifest -Path $script:testManifestPath ` -FunctionsToExport $ExportedFunctions ` -AliasesToExport $ExportedAliases ` - -VariablesToExport $ExportedVariables + -VariablesToExport $ExportedVariables $results = Test-ModuleManifest -Path $script:testManifestPath $results.ExportedFunctions.Keys | Should -Be $ExportedFunctions @@ -409,7 +409,7 @@ Describe 'Test Update-PSModuleManifest' -tags 'CI' { $results.Contains($CmdletToExport2) | Should -Be $true } - It "Update module manifest should not overwrite over old data unless explcitly specified" { + It "Update module manifest should not overwrite over old data unless explicitly specified" { $Description = "Test Description" $ModuleVersion = "2.0.0" $Author = "Leto Atriedes" From a3c19771619b9484b049a62a814e7b0f98f2ac27 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 21:25:41 -0500 Subject: [PATCH 09/12] Fix typos in documentation --- src/Microsoft.PowerShell.PSResourceGet.psd1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.PowerShell.PSResourceGet.psd1 b/src/Microsoft.PowerShell.PSResourceGet.psd1 index 6673a0524..fad665d1c 100644 --- a/src/Microsoft.PowerShell.PSResourceGet.psd1 +++ b/src/Microsoft.PowerShell.PSResourceGet.psd1 @@ -66,12 +66,12 @@ - Update `-ModulePrefix` to be a static parameter (#1868) - Bug fix for populating all `#Requires` fields in `Update-PSScriptFileInfo` (#1863) - Bug fix for populating `Includes` metadata for packages from container registry repositories (#1861) -- Bug fix for `Find-PSRessource` and `Install-PSResource` not retrieving unlisted package versions (#1859) +- Bug fix for `Find-PSResource` and `Install-PSResource` not retrieving unlisted package versions (#1859) ## 1.2.0-preview2 ### New Features -- Ingetration of the Azure Artifacts Credential Provider for ADO feeds (#1765) +- Integration of the Azure Artifacts Credential Provider for ADO feeds (#1765) ### Bug Fix - Bug fixes for NuGet v3 dependencies (#1841 Thanks @o-l-a-v!) @@ -124,7 +124,7 @@ - Update to use OCI v2 APIs for Container Registry (#1737) - Bug fixes for finding and installing from local repositories on Linux machines (#1738) -- Bug fix for finding package name with 4 part version from local repositories (#1739) +- Bug fix for finding package name with 4 part version from local repositories (#1739) ## 1.1.0-RC1 @@ -136,7 +136,7 @@ - Fix packaging name matching when searching in local repositories (#1731) - `Compress-PSResource` `-PassThru` now passes `FileInfo` instead of string (#1720) -- Fix for `Compress-PSResource` not properly compressing scripts (#1719) +- Fix for `Compress-PSResource` not properly compressing scripts (#1719) - Add `AcceptLicense` to Save-PSResource (#1718 Thanks @o-l-a-v!) - Better support for NuGet v2 feeds (#1713 Thanks @o-l-a-v!) - Better handling of `-WhatIf` support in `Install-PSResource` (#1531 Thanks @o-l-a-v!) @@ -153,7 +153,7 @@ ### Bug Fixes -- Add prerelease string when NormalizedVersion doesn't exist, but prelease string does (#1681 Thanks @sean-r-williams) +- Add prerelease string when NormalizedVersion doesn't exist, but prerelease string does (#1681 Thanks @sean-r-williams) - Add retry logic when deleting files (#1667 Thanks @o-l-a-v!) - Fix broken PAT token use (#1672) - Updated error messaging for authenticode signature failures (#1701) @@ -162,14 +162,14 @@ ### New Features -- Support for Azure Container Registries (#1495, #1497-#1499, #1501, #1502, #1505, #1522, #1545, #1548, #1550, #1554, #1560, #1567, +- Support for Azure Container Registries (#1495, #1497-#1499, #1501, #1502, #1505, #1522, #1545, #1548, #1550, #1554, #1560, #1567, #1573, #1576, #1587, #1588, #1589, #1594, #1598, #1600, #1602, #1604, #1615) ### Bug Fixes - Fix incorrect request URL when installing resources from ADO (#1597 Thanks @anytonyoni!) - Fix for swallowed exceptions (#1569) -- Fix for PSResourceGet not working in Constrained Languange Mode (#1564) +- Fix for PSResourceGet not working in Constrained Language Mode (#1564) ## 1.0.6 @@ -243,7 +243,7 @@ - Bug fix Artifactory v2 endpoint failures (#1428) - Bug fix Artifactory v3 endpoint failures (#1427) - Bug fix `-RequiredResource` silent failures (#1426) -- Bug fix for v2 repository returning extra packages for `-Tag` based search with `-Prerelease` (#1405) +- Bug fix for v2 repository returning extra packages for `-Tag` based search with `-Prerelease` (#1405) See change log (CHANGELOG) at https://github.com/PowerShell/PSResourceGet '@ From 0d0f53e5f4e6ef0f0d11b235ac471344be9a37e4 Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Thu, 18 Sep 2025 21:50:55 -0500 Subject: [PATCH 10/12] Fixed numerous typos in files. Fixed files may also have extraneous whitespace removed. --- src/code/CompressPSResource.cs | 2 +- src/code/ContainerRegistryResponseUtil.cs | 2 +- src/code/ContainerRegistryServerAPICalls.cs | 32 +++---- src/code/CredentialProvider.cs | 6 +- src/code/GetHelper.cs | 4 +- src/code/GetInstalledPSResource.cs | 4 +- src/code/InstallHelper.cs | 6 +- src/code/InstallPSResource.cs | 2 +- src/code/LocalResponseUtil.cs | 2 +- src/code/LocalServerApiCalls.cs | 94 ++++++++++----------- src/code/NuGetServerAPICalls.cs | 36 ++++---- src/code/NuGetServerResponseUtil.cs | 12 +-- src/code/PSResourceInfo.cs | 16 ++-- src/code/PSScriptFileInfo.cs | 24 +++--- src/code/PSScriptHelp.cs | 60 ++++++------- src/code/PSScriptMetadata.cs | 84 +++++++++--------- src/code/PSScriptRequires.cs | 4 +- src/code/PublishHelper.cs | 42 ++++----- src/code/RegisterPSResourceRepository.cs | 20 ++--- src/code/RepositorySettings.cs | 34 ++++---- src/code/SetPSResourceRepository.cs | 6 +- src/code/UnregisterPSResourceRepository.cs | 2 +- src/code/UpdateModuleManifest.cs | 12 +-- src/code/Utils.cs | 16 ++-- src/code/V2ResponseUtil.cs | 6 +- src/code/V2ServerAPICalls.cs | 6 +- src/code/V3ResponseUtil.cs | 4 +- src/code/V3ServerAPICalls.cs | 14 +-- 28 files changed, 276 insertions(+), 276 deletions(-) diff --git a/src/code/CompressPSResource.cs b/src/code/CompressPSResource.cs index b306e7d88..39dde3216 100644 --- a/src/code/CompressPSResource.cs +++ b/src/code/CompressPSResource.cs @@ -59,7 +59,7 @@ public sealed class CompressPSResource : PSCmdlet protected override void BeginProcessing() { - // Create a respository store (the PSResourceRepository.xml file) if it does not already exist + // Create a repository store (the PSResourceRepository.xml file) if it does not already exist // This is to create a better experience for those who have just installed v3 and want to get up and running quickly RepositorySettings.CheckRepositoryStore(); diff --git a/src/code/ContainerRegistryResponseUtil.cs b/src/code/ContainerRegistryResponseUtil.cs index 295ae45a6..acbb7eccd 100644 --- a/src/code/ContainerRegistryResponseUtil.cs +++ b/src/code/ContainerRegistryResponseUtil.cs @@ -26,7 +26,7 @@ public ContainerRegistryResponseUtil(PSRepositoryInfo repository) : base(reposit #endregion - #region Overriden Methods + #region Overridden Methods public override IEnumerable ConvertToPSResourceResult(FindResults responseResults, bool isResourceRequestedWithWildcard = false) { diff --git a/src/code/ContainerRegistryServerAPICalls.cs b/src/code/ContainerRegistryServerAPICalls.cs index 54f3cb714..b37d90ccc 100644 --- a/src/code/ContainerRegistryServerAPICalls.cs +++ b/src/code/ContainerRegistryServerAPICalls.cs @@ -75,7 +75,7 @@ public ContainerRegistryServerAPICalls(PSRepositoryInfo repository, PSCmdlet cmd #endregion - #region Overriden Methods + #region Overridden Methods /// /// Find method which allows for searching for all packages from a repository and returns latest version for each. @@ -126,7 +126,7 @@ public override FindResults FindCommandOrDscResource(string[] tags, bool include /// Find method which allows for searching for single name and returns latest version. /// Name: no wildcard support /// Examples: Search "PowerShellGet" - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindName(string packageName, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { @@ -451,12 +451,12 @@ internal string GetContainerRegistryAccessToken(bool needCatalogAccess, out Erro /// /// Checks if container registry repository is unauthenticated. /// - internal bool IsContainerRegistryUnauthenticated(string containerRegistyUrl, bool needCatalogAccess, out ErrorRecord errRecord, out string anonymousAccessToken) + internal bool IsContainerRegistryUnauthenticated(string containerRegistryUrl, bool needCatalogAccess, out ErrorRecord errRecord, out string anonymousAccessToken) { _cmdletPassedIn.WriteDebug("In ContainerRegistryServerAPICalls::IsContainerRegistryUnauthenticated()"); errRecord = null; anonymousAccessToken = string.Empty; - string endpoint = $"{containerRegistyUrl}/v2/"; + string endpoint = $"{containerRegistryUrl}/v2/"; HttpResponseMessage response; try { @@ -497,7 +497,7 @@ internal bool IsContainerRegistryUnauthenticated(string containerRegistyUrl, boo _cmdletPassedIn.WriteDebug($"Getting anonymous access token from the realm: {url}"); - // we dont check the errorrecord here because we want to return false if we get a 401 and not throw an error + // we don't check the error record here because we want to return false if we get a 401 and not throw an error _cmdletPassedIn.WriteDebug($"Getting anonymous access token from the realm: {url}"); ErrorRecord errRecordTemp = null; @@ -644,7 +644,7 @@ internal JObject GetContainerRegistryRepositoryManifest(string packageName, stri } /// - /// Get the blob for the package (ie repository in container registry terms) from the repositroy (ie registry in container registry terms) + /// Get the blob for the package (ie repository in container registry terms) from the repository (ie registry in container registry terms) /// Used when installing the package /// internal async Task GetContainerRegistryBlobAsync(string packageName, string digest, string containerRegistryAccessToken) @@ -916,7 +916,7 @@ internal async Task UploadManifest(string packageName, stri } catch (HttpRequestException e) { - throw new HttpRequestException("Error occured while trying to create manifest: " + e.Message); + throw new HttpRequestException("Error occurred while trying to create manifest: " + e.Message); } } @@ -931,7 +931,7 @@ internal async Task GetHttpContentResponseJObject(string url, Colle } catch (HttpRequestException e) { - throw new HttpRequestException("Error occured while trying to retrieve response: " + e.Message); + throw new HttpRequestException("Error occurred while trying to retrieve response: " + e.Message); } } @@ -1074,7 +1074,7 @@ internal async Task GetHttpResponseHeader(string url, HttpM } catch (HttpRequestException e) { - throw new HttpRequestException("Error occured while trying to retrieve response header: " + e.Message); + throw new HttpRequestException("Error occurred while trying to retrieve response header: " + e.Message); } } @@ -1117,7 +1117,7 @@ private async Task SendContentRequestAsync(HttpRequestMessage messa } catch (Exception e) { - throw new SendRequestException($"Error occured while sending request to Container Registry server for content with: {e.GetType()} '{e.Message}'", e); + throw new SendRequestException($"Error occurred while sending request to Container Registry server for content with: {e.GetType()} '{e.Message}'", e); } } @@ -1133,7 +1133,7 @@ private async Task SendRequestAsync(HttpRequestMessage message) } catch (Exception e) { - throw new SendRequestException($"Error occured while sending request to Container Registry server with: {e.GetType()} '{e.Message}'", e); + throw new SendRequestException($"Error occurred while sending request to Container Registry server with: {e.GetType()} '{e.Message}'", e); } switch (response.StatusCode) @@ -1233,7 +1233,7 @@ private async Task SendRequestHeaderAsync(HttpRequestMessag } catch (HttpRequestException e) { - throw new HttpRequestException("Error occured while trying to retrieve response: " + e.Message); + throw new HttpRequestException("Error occurred while trying to retrieve response: " + e.Message); } } @@ -1264,7 +1264,7 @@ private async Task PutRequestAsync(string url, string fileP } catch (Exception e) { - throw new SendRequestException($"Error occured while uploading module to ContainerRegistry: {e.GetType()} '{e.Message}'", e); + throw new SendRequestException($"Error occurred while uploading module to ContainerRegistry: {e.GetType()} '{e.Message}'", e); } } @@ -1552,7 +1552,7 @@ private bool TryCreateAndUploadManifest(string fullNupkgFile, catch (Exception e) { errRecord = new ErrorRecord( - new UploadBlobException($"Error occured while uploading package manifest to ContainerRegistry: {e.GetType()} '{e.Message}'", e), + new UploadBlobException($"Error occurred while uploading package manifest to ContainerRegistry: {e.GetType()} '{e.Message}'", e), "PackageManifestUploadError", ErrorCategory.InvalidResult, _cmdletPassedIn); @@ -1741,7 +1741,7 @@ internal async Task GetStartUploadBlobLocation(string packageName, strin } catch (Exception e) { - throw new UploadBlobException($"Error occured while starting to upload the blob location used for publishing to ContainerRegistry: {e.GetType()} '{e.Message}'", e); + throw new UploadBlobException($"Error occurred while starting to upload the blob location used for publishing to ContainerRegistry: {e.GetType()} '{e.Message}'", e); } } @@ -1759,7 +1759,7 @@ internal async Task EndUploadBlob(string location, string f } catch (Exception e) { - throw new UploadBlobException($"Error occured while uploading module to ContainerRegistry: {e.GetType()} '{e.Message}'", e); + throw new UploadBlobException($"Error occurred while uploading module to ContainerRegistry: {e.GetType()} '{e.Message}'", e); } } diff --git a/src/code/CredentialProvider.cs b/src/code/CredentialProvider.cs index 75bcd8c09..40e012a84 100644 --- a/src/code/CredentialProvider.cs +++ b/src/code/CredentialProvider.cs @@ -113,9 +113,9 @@ private static string VSCredentialProviderFile(string visualStudioPath, string c internal static PSCredential GetCredentialsFromProvider(Uri uri, PSCmdlet cmdletPassedIn) { - cmdletPassedIn.WriteVerbose("Enterting CredentialProvider::GetCredentialsFromProvider"); + cmdletPassedIn.WriteVerbose("Entering CredentialProvider::GetCredentialsFromProvider"); string credProviderPath = string.Empty; - + // Find credential provider // Option 1. Use env var 'NUGET_PLUGIN_PATHS' to find credential provider. // See: https://docs.microsoft.com/en-us/nuget/reference/extensibility/nuget-cross-platform-plugins#plugin-installation-and-discovery @@ -161,7 +161,7 @@ internal static PSCredential GetCredentialsFromProvider(Uri uri, PSCmdlet cmdlet { FileInfo fileInfo = new FileInfo(credProviderPath); if (!Utils.TryGetCaseInsensitiveFilePath(fileInfo.Directory.FullName, _credProviderDll, out credProviderPath)) - { + { cmdletPassedIn.WriteError(new ErrorRecord( new FileNotFoundException($"Path found '{credProviderPath}' is not a valid Azure Artifact Credential Provider executable. See https://github.com/NuGet/Home/wiki/NuGet-cross-plat-authentication-plugin#plugin-installation-and-discovery to set up the Credential Provider."), "CredentialProviderFileNotFound", diff --git a/src/code/GetHelper.cs b/src/code/GetHelper.cs index 636bd383a..1fa98887e 100644 --- a/src/code/GetHelper.cs +++ b/src/code/GetHelper.cs @@ -175,8 +175,8 @@ public IEnumerable FilterPkgPathsByVersion(VersionRange versionRange, Li _cmdletPassedIn.WriteDebug($"Package version parsed as NuGet version: '{pkgNugetVersion}'"); // For Uninstall-PSResource Prerelease parameter equates to selecting prerelease versions only to uninstall. - // For other cmdlets (Find-PSResource, Install-PSResource) Prerelease parmater equates to selecting stable and prerelease versions. - // We will not just select prerelase versions. For Get-InstalledPSResource, there is no Prerelease parameter. + // For other cmdlets (Find-PSResource, Install-PSResource) Prerelease parameter equates to selecting stable and prerelease versions. + // We will not just select prerelease versions. For Get-InstalledPSResource, there is no Prerelease parameter. if (versionRange.Satisfies(pkgNugetVersion)) { if (!selectPrereleaseOnly || pkgNugetVersion.IsPrerelease) diff --git a/src/code/GetInstalledPSResource.cs b/src/code/GetInstalledPSResource.cs index dafd36400..79807041e 100644 --- a/src/code/GetInstalledPSResource.cs +++ b/src/code/GetInstalledPSResource.cs @@ -66,7 +66,7 @@ protected override void BeginProcessing() // an exact version will be formatted into a version range. if (Version == null) { - WriteDebug("Searcing for all versions"); + WriteDebug("Searching for all versions"); _versionRange = VersionRange.All; } else if (!Utils.TryParseVersionOrVersionRange(Version, out _versionRange)) @@ -153,7 +153,7 @@ protected override void ProcessRecord() List pkgsNotFound = new List(); foreach (string name in namesToSearch) { - if (!pkgsFound.Contains(name, StringComparer.OrdinalIgnoreCase)) + if (!pkgsFound.Contains(name, StringComparer.OrdinalIgnoreCase)) { if (name.Contains('*')) { diff --git a/src/code/InstallHelper.cs b/src/code/InstallHelper.cs index 16dcda959..83900e413 100644 --- a/src/code/InstallHelper.cs +++ b/src/code/InstallHelper.cs @@ -383,7 +383,7 @@ private bool TryDeleteDirectory( } /// - /// Moves file from the temp install path to desination path for install. + /// Moves file from the temp install path to destination path for install. /// private void MoveFilesIntoInstallPath( PSResourceInfo pkgInfo, @@ -1204,7 +1204,7 @@ private bool TryExtractToDirectory(string zipPath, string extractPath, out Error catch (Exception e) { error = new ErrorRecord( - new Exception($"Error occured while extracting .nupkg: '{e.Message}'"), + new Exception($"Error occurred while extracting .nupkg: '{e.Message}'"), "ErrorExtractingNupkg", ErrorCategory.OperationStopped, _cmdletPassedIn); @@ -1313,7 +1313,7 @@ private bool CallAcceptLicense(PSResourceInfo p, string moduleManifest, string t } } - // Licesnse agreement processing + // License agreement processing if (requireLicenseAcceptance) { // If module requires license acceptance and -AcceptLicense is not passed in, display prompt diff --git a/src/code/InstallPSResource.cs b/src/code/InstallPSResource.cs index d8af185f0..bdfa4db89 100644 --- a/src/code/InstallPSResource.cs +++ b/src/code/InstallPSResource.cs @@ -352,7 +352,7 @@ protected override void ProcessRecord() break; case ResourceFileType.UnknownFile: - throw new PSInvalidOperationException("Unkown file type. Required resource file must be either a json or psd1 data file."); + throw new PSInvalidOperationException("Unknown file type. Required resource file must be either a json or psd1 data file."); } } catch (Exception) diff --git a/src/code/LocalResponseUtil.cs b/src/code/LocalResponseUtil.cs index 103f4df2a..f5af0c791 100644 --- a/src/code/LocalResponseUtil.cs +++ b/src/code/LocalResponseUtil.cs @@ -26,7 +26,7 @@ public LocalResponseUtil(PSRepositoryInfo repository) : base(repository) #endregion - #region Overriden Methods + #region Overridden Methods public override IEnumerable ConvertToPSResourceResult(FindResults responseResults, bool isResourceRequestedWithWildcard = false) { foreach (Hashtable response in responseResults.HashtableResponse) diff --git a/src/code/LocalServerApiCalls.cs b/src/code/LocalServerApiCalls.cs index 324db1081..cc43c340d 100644 --- a/src/code/LocalServerApiCalls.cs +++ b/src/code/LocalServerApiCalls.cs @@ -37,7 +37,7 @@ public LocalServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn #endregion - #region Overriden Methods + #region Overridden Methods /// /// Find method which allows for searching for all packages from a repository and returns latest version for each. @@ -64,9 +64,9 @@ public override FindResults FindTags(string[] tags, bool includePrerelease, Reso if (tagFindResults.IsFindResultsEmpty()) { errRecord = new ErrorRecord( - new ResourceNotFoundException($"Package(s) with Tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), - "FindTagsPackageNotFound", - ErrorCategory.ObjectNotFound, + new ResourceNotFoundException($"Package(s) with Tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), + "FindTagsPackageNotFound", + ErrorCategory.ObjectNotFound, this); } @@ -85,9 +85,9 @@ public override FindResults FindCommandOrDscResource(string[] tags, bool include { string paramName = isSearchingForCommands ? "Command Name(s)" : "DSCResource Name(s)"; errRecord = new ErrorRecord( - new ResourceNotFoundException($"Package(s) with {paramName} '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), - "FindCmdOrDSCNamesPackageNotFound", - ErrorCategory.ObjectNotFound, + new ResourceNotFoundException($"Package(s) with {paramName} '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), + "FindCmdOrDSCNamesPackageNotFound", + ErrorCategory.ObjectNotFound, this); } @@ -101,7 +101,7 @@ public override FindResults FindCommandOrDscResource(string[] tags, bool include /// API call: /// - No prerelease: http://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet' /// - Include prerelease: http://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet' - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindName(string packageName, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { @@ -113,7 +113,7 @@ public override FindResults FindName(string packageName, bool includePrerelease, /// Find method which allows for searching for single name and tag and returns latest version. /// Name: no wildcard support /// Examples: Search "PowerShellGet" -Tag "Provider" - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindNameWithTag(string packageName, string[] tags, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { @@ -170,7 +170,7 @@ public override FindResults FindVersionGlobbing(string packageName, VersionRange List foundPkgs = new List(); for (int i = pkgVersionsList.Count - 1; i >= 0; i--) { - // Versions are present in pkgVersionsList in asc order, wherease we need it in desc so we traverse it in reverse. + // Versions are present in pkgVersionsList in asc order, whereas we need it in desc so we traverse it in reverse. NuGetVersion satisfyingVersion = pkgVersionsList[i]; string packagePath = (string) pkgVersionsFound[satisfyingVersion]; @@ -294,9 +294,9 @@ private FindResults FindNameHelper(string packageName, string[] tags, bool inclu { // means no package was found with this name errRecord = new ErrorRecord( - new ResourceNotFoundException($"Package with name {packageName} could not be found in repository '{Repository.Name}'."), - "PackageNotFound", - ErrorCategory.ResourceUnavailable, + new ResourceNotFoundException($"Package with name {packageName} could not be found in repository '{Repository.Name}'."), + "PackageNotFound", + ErrorCategory.ResourceUnavailable, this); return findResponse; @@ -312,9 +312,9 @@ private FindResults FindNameHelper(string packageName, string[] tags, bool inclu if (pkgMetadata.Count == 0) { errRecord = new ErrorRecord( - new ResourceNotFoundException($"Package with name '{packageName}' and tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), - "PackageNotFound", - ErrorCategory.ResourceUnavailable, + new ResourceNotFoundException($"Package with name '{packageName}' and tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), + "PackageNotFound", + ErrorCategory.ResourceUnavailable, this); } @@ -369,10 +369,10 @@ private FindResults FindVersionHelper(string packageName, string version, string { errRecord = new ErrorRecord( new InvalidOperationException($"Version {version} could not be parsed into a valid NuGetVersion"), - "FindVersionFailure", - ErrorCategory.InvalidData, + "FindVersionFailure", + ErrorCategory.InvalidData, this); - + return findResponse; } @@ -412,9 +412,9 @@ private FindResults FindVersionHelper(string packageName, string version, string { // means no package was found with this name, version (and possibly tags). errRecord = new ErrorRecord( - new ResourceNotFoundException($"Package with name '{packageName}', version '{version}' and tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), - "PackageNotFound", - ErrorCategory.ResourceUnavailable, + new ResourceNotFoundException($"Package with name '{packageName}', version '{version}' and tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), + "PackageNotFound", + ErrorCategory.ResourceUnavailable, this); return findResponse; @@ -430,9 +430,9 @@ private FindResults FindVersionHelper(string packageName, string version, string if (pkgMetadata.Count == 0) { errRecord = new ErrorRecord( - new ResourceNotFoundException($"Package with name '{packageName}', and tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), - "PackageNotFound", - ErrorCategory.InvalidResult, + new ResourceNotFoundException($"Package with name '{packageName}', and tags '{String.Join(", ", tags)}' could not be found in repository '{Repository.Name}'."), + "PackageNotFound", + ErrorCategory.InvalidResult, this); } @@ -673,11 +673,11 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s if (!Utils.TryReadManifestFile(psd1FilePath, out pkgMetadata, out Exception readManifestError)) { errRecord = new ErrorRecord( - readManifestError, - "GetMetadataFromNupkgFailure", - ErrorCategory.ParserError, + readManifestError, + "GetMetadataFromNupkgFailure", + ErrorCategory.ParserError, this); - + return pkgMetadata; } @@ -699,9 +699,9 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s if (!PSScriptFileInfo.TryTestPSScriptFileInfo(ps1FilePath, out PSScriptFileInfo parsedScript, out ErrorRecord[] errors, out string[] verboseMsgs)) { errRecord = new ErrorRecord( - new InvalidDataException($"PSScriptFile could not be read properly"), - "GetMetadataFromNupkgFailure", - ErrorCategory.ParserError, + new InvalidDataException($"PSScriptFile could not be read properly"), + "GetMetadataFromNupkgFailure", + ErrorCategory.ParserError, this); return pkgMetadata; @@ -731,10 +731,10 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s { errRecord = new ErrorRecord( new InvalidDataException($".nupkg package must contain either .psd1, .ps1, or .nuspec file and none were found"), - "GetMetadataFromNupkgFailure", - ErrorCategory.InvalidData, + "GetMetadataFromNupkgFailure", + ErrorCategory.InvalidData, this); - + return pkgMetadata; } @@ -748,9 +748,9 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s catch (Exception e) { errRecord = new ErrorRecord( - new InvalidOperationException($"Temporary folder for installation could not be created or set due to: {e.Message}"), - "GetMetadataFromNupkgFailure", - ErrorCategory.InvalidOperation, + new InvalidOperationException($"Temporary folder for installation could not be created or set due to: {e.Message}"), + "GetMetadataFromNupkgFailure", + ErrorCategory.InvalidOperation, this); } finally @@ -901,9 +901,9 @@ private NuGetVersion GetInfoFromFileName(string packageFullName, string packageN if (!NuGetVersion.TryParse(version, out NuGetVersion nugetVersion)) { errRecord = new ErrorRecord( - new ArgumentException($"Could not parse version {version} from file {packageFullName}"), - "GetInfoFromFileNameFilaure", - ErrorCategory.ParserError, + new ArgumentException($"Could not parse version {version} from file {packageFullName}"), + "GetInfoFromFileNameFailure", + ErrorCategory.ParserError, this); return null; @@ -924,9 +924,9 @@ private XmlDocument LoadXmlDocument(string filePath, out ErrorRecord errRecord) catch (Exception e) { errRecord = new ErrorRecord( - exception: e, - "LoadXmlDocumentFailure", - ErrorCategory.ReadError, + exception: e, + "LoadXmlDocumentFailure", + ErrorCategory.ReadError, this); } @@ -988,9 +988,9 @@ private Hashtable GetHashtableForNuspec(string filePath, out ErrorRecord errReco catch (Exception e) { errRecord = new ErrorRecord( - exception: e, - "GetHashtableForNuspecFailure", - ErrorCategory.ReadError, + exception: e, + "GetHashtableForNuspecFailure", + ErrorCategory.ReadError, this); } diff --git a/src/code/NuGetServerAPICalls.cs b/src/code/NuGetServerAPICalls.cs index 2ecabd001..1497c83da 100644 --- a/src/code/NuGetServerAPICalls.cs +++ b/src/code/NuGetServerAPICalls.cs @@ -46,7 +46,7 @@ public NuGetServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn #endregion - #region Overriden Methods + #region Overridden Methods /// /// Find method which allows for searching for all packages from a repository and returns latest version for each. @@ -69,13 +69,13 @@ public override FindResults FindAll(bool includePrerelease, ResourceType type, o } responses.Add(initialResponse); - int initalCount = GetCountFromResponse(initialResponse, out errRecord); + int initialCount = GetCountFromResponse(initialResponse, out errRecord); if (errRecord != null) { return new FindResults(stringResponse: responses.ToArray(), hashtableResponse: emptyHashResponses, responseType: FindResponseType); } - int count = initalCount / 6000; + int count = initialCount / 6000; // if more than 100 count, loop and add response to list while (count > 0) { @@ -113,13 +113,13 @@ public override FindResults FindTags(string[] tags, bool includePrerelease, Reso } responses.Add(initialResponse); - int initalCount = GetCountFromResponse(initialResponse, out errRecord); + int initialCount = GetCountFromResponse(initialResponse, out errRecord); if (errRecord != null) { return new FindResults(stringResponse: responses.ToArray(), hashtableResponse: emptyHashResponses, responseType: FindResponseType); } - int count = initalCount / 100; + int count = initialCount / 100; // if more than 100 count, loop and add response to list while (count > 0) { @@ -159,7 +159,7 @@ public override FindResults FindCommandOrDscResource(string[] tags, bool include /// API call: /// - No prerelease: {repoUri}/api/v2/FindPackagesById()?id='PowerShellGet' /// - Include prerelease: {repoUri}/api/v2/FindPackagesById()?id='PowerShellGet' - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindName(string packageName, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { @@ -187,7 +187,7 @@ public override FindResults FindName(string packageName, bool includePrerelease, /// Find method which allows for searching for single name and tag and returns latest version. /// Name: no wildcard support /// Examples: Search "PowerShellGet" -Tag "Provider" - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindNameWithTag(string packageName, string[] tags, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { @@ -195,12 +195,12 @@ public override FindResults FindNameWithTag(string packageName, string[] tags, b // This should return the latest stable version or the latest prerelease version (respectively) // https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$filter=IsLatestVersion and substringof('PSModule', Tags) eq true - + var queryBuilder = new NuGetV2QueryBuilder(new Dictionary{ { "id", $"'{packageName}'" }, }); var filterBuilder = queryBuilder.FilterBuilder; - + // We need to explicitly add 'Id eq ' whenever $filter is used, otherwise arbitrary results are returned. filterBuilder.AddCriterion($"Id eq '{packageName}'"); @@ -240,13 +240,13 @@ public override FindResults FindNameGlobbing(string packageName, bool includePre responses.Add(initialResponse); // check count (regex) 425 ==> count/100 ~~> 4 calls - int initalCount = GetCountFromResponse(initialResponse, out errRecord); // count = 4 + int initialCount = GetCountFromResponse(initialResponse, out errRecord); // count = 4 if (errRecord != null) { return new FindResults(stringResponse: responses.ToArray(), hashtableResponse: emptyHashResponses, responseType: FindResponseType); } - int count = initalCount / 100; + int count = initialCount / 100; // if more than 100 count, loop and add response to list while (count > 0) { @@ -285,13 +285,13 @@ public override FindResults FindNameGlobbingWithTag(string packageName, string[] responses.Add(initialResponse); // check count (regex) 425 ==> count/100 ~~> 4 calls - int initalCount = GetCountFromResponse(initialResponse, out errRecord); // count = 4 + int initialCount = GetCountFromResponse(initialResponse, out errRecord); // count = 4 if (errRecord != null) { return new FindResults(stringResponse: responses.ToArray(), hashtableResponse: emptyHashResponses, responseType: FindResponseType); } - int count = initalCount / 100; + int count = initialCount / 100; // if more than 100 count, loop and add response to list while (count > 0) { @@ -334,13 +334,13 @@ public override FindResults FindVersionGlobbing(string packageName, VersionRange if (!getOnlyLatest) { - int initalCount = GetCountFromResponse(initialResponse, out errRecord); + int initialCount = GetCountFromResponse(initialResponse, out errRecord); if (errRecord != null) { return new FindResults(stringResponse: responses.ToArray(), hashtableResponse: emptyHashResponses, responseType: FindResponseType); } - int count = initalCount / 100; + int count = initialCount / 100; while (count > 0) { @@ -570,7 +570,7 @@ private string FindAllFromEndPoint(bool includePrerelease, int skip, out ErrorRe } else { filterBuilder.AddCriterion("IsLatestVersion"); } - + var requestUrl = $"{Repository.Uri}/Search()?{queryBuilder.BuildQueryString()}"; return HttpRequestCall(requestUrl, out errRecord); @@ -951,7 +951,7 @@ public int GetCountFromResponse(string httpResponse, out ErrorRecord errRecord) /// public static async Task SendRequestAsync(HttpRequestMessage message, HttpClient s_client) { - string errMsg = "Error occured while trying to retrieve response: "; + string errMsg = "Error occurred while trying to retrieve response: "; try { HttpResponseMessage response = await s_client.SendAsync(message); @@ -978,7 +978,7 @@ public static async Task SendRequestAsync(HttpRequestMessage message, Ht /// public static async Task SendRequestForContentAsync(HttpRequestMessage message, HttpClient s_client) { - string errMsg = "Error occured while trying to retrieve response for content: "; + string errMsg = "Error occurred while trying to retrieve response for content: "; try { HttpResponseMessage response = await s_client.SendAsync(message); diff --git a/src/code/NuGetServerResponseUtil.cs b/src/code/NuGetServerResponseUtil.cs index 2223e4b19..19b7499d4 100644 --- a/src/code/NuGetServerResponseUtil.cs +++ b/src/code/NuGetServerResponseUtil.cs @@ -25,13 +25,13 @@ public NuGetServerResponseUtil(PSRepositoryInfo repository) : base(repository) #endregion - #region Overriden Methods + #region Overridden Methods public override IEnumerable ConvertToPSResourceResult(FindResults responseResults, bool isResourceRequestedWithWildcard = false) { // in FindHelper: // serverApi.FindName() -> return responses, and out errRecord // check outErrorRecord - // + // // v2Converter.ConvertToPSResourceInfo(responses) -> return PSResourceResult // check resourceResult for error, write if needed string[] responses = responseResults.StringResponse; @@ -76,11 +76,11 @@ public XmlNode[] ConvertResponseToXML(string httpResponse) { doc.LoadXml(httpResponse); XmlNodeList elemList = doc.GetElementsByTagName("m:properties"); - - XmlNode[] nodes = new XmlNode[elemList.Count]; - for (int i = 0; i < elemList.Count; i++) + + XmlNode[] nodes = new XmlNode[elemList.Count]; + for (int i = 0; i < elemList.Count; i++) { - nodes[i] = elemList[i]; + nodes[i] = elemList[i]; } return nodes; diff --git a/src/code/PSResourceInfo.cs b/src/code/PSResourceInfo.cs index 0bc651cf5..c1dc1448a 100644 --- a/src/code/PSResourceInfo.cs +++ b/src/code/PSResourceInfo.cs @@ -297,7 +297,7 @@ private PSResourceInfo( #region Private fields - private static readonly char[] Delimeter = { ' ', ',' }; + private static readonly char[] Delimiter = { ' ', ',' }; #endregion @@ -756,7 +756,7 @@ JsonElement dependency in dependenciesElement.EnumerateArray().Where( } // IsPrerelease - // NuGet.org repository's response does contain 'isPrerelease' element so it can be accquired and set here. + // NuGet.org repository's response does contain 'isPrerelease' element so it can be acquired and set here. if (rootDom.TryGetProperty("isPrerelease", out JsonElement isPrereleaseElement)) { metadata["IsPrerelease"] = isPrereleaseElement.GetBoolean(); @@ -780,9 +780,9 @@ JsonElement dependency in dependenciesElement.EnumerateArray().Where( } // Description - if (rootDom.TryGetProperty("description", out JsonElement descriptiontElement)) + if (rootDom.TryGetProperty("description", out JsonElement descriptionElement)) { - metadata["Description"] = descriptiontElement.ToString(); + metadata["Description"] = descriptionElement.ToString(); } // Id @@ -982,7 +982,7 @@ public static bool TryConvertFromContainerRegistryJson( } if (rootDom.TryGetProperty("CompanyName", out JsonElement companyNameElement)) - { + { metadata["CompanyName"] = companyNameElement.ToString(); } else @@ -998,9 +998,9 @@ public static bool TryConvertFromContainerRegistryJson( } // Description - if (rootDom.TryGetProperty("Description", out JsonElement descriptiontElement) || rootDom.TryGetProperty("description", out descriptiontElement)) + if (rootDom.TryGetProperty("Description", out JsonElement descriptionElement) || rootDom.TryGetProperty("description", out descriptionElement)) { - metadata["Description"] = descriptiontElement.ToString(); + metadata["Description"] = descriptionElement.ToString(); } // ReleaseNotes @@ -1767,7 +1767,7 @@ private static ResourceType ParseHttpMetadataTypeForLocalRepo( cmdletNames.Add(cmdlet as string); } } - // Because there is no "CommandsToExport" propertly in a module manifest, we use CmdletsToExport to find command names + // Because there is no "CommandsToExport" property in a module manifest, we use CmdletsToExport to find command names commandNames = cmdletNames; dscResourceNames = new ArrayList(); diff --git a/src/code/PSScriptFileInfo.cs b/src/code/PSScriptFileInfo.cs index d71c34e78..cfbe78e75 100644 --- a/src/code/PSScriptFileInfo.cs +++ b/src/code/PSScriptFileInfo.cs @@ -17,7 +17,7 @@ namespace Microsoft.PowerShell.PSResourceGet.UtilClasses public sealed class PSScriptFileInfo { #region Properties - + public PSScriptMetadata ScriptMetadataComment { get; set; } public PSScriptHelp ScriptHelpComment { get; set; } @@ -126,7 +126,7 @@ internal static bool TryParseScriptFileContents( while (i < fileContents.Length) { string line = fileContents[i]; - + if (line.Trim().StartsWith("<#PSScriptInfo")) { int j = i + 1; // start at the next line @@ -142,7 +142,7 @@ internal static bool TryParseScriptFileContents( i = j + 1; break; } - + j++; } @@ -150,8 +150,8 @@ internal static bool TryParseScriptFileContents( { error = new ErrorRecord( new InvalidOperationException($"Could not parse '{scriptFileInfoPath}' as a PowerShell script file due to missing the closing '#>' for <#PSScriptInfo comment block"), - "MissingEndBracketToPSScriptInfoParseError", - ErrorCategory.ParserError, + "MissingEndBracketToPSScriptInfoParseError", + ErrorCategory.ParserError, null); return false; @@ -182,7 +182,7 @@ internal static bool TryParseScriptFileContents( { error = new ErrorRecord( new InvalidOperationException($"Could not parse '{scriptFileInfoPath}' as a PowerShell script file due to missing the closing '#>' for HelpInfo comment block"), - "MissingEndBracketToHelpInfoCommentParseError", + "MissingEndBracketToHelpInfoCommentParseError", ErrorCategory.ParserError, null); @@ -218,8 +218,8 @@ internal static bool TryParseScriptFileContents( // check for file not containing '<#PSScriptInfo ... #>' comment error = new ErrorRecord( new InvalidOperationException($"Could not parse '{scriptFileInfoPath}' as a PowerShell script due to it missing '<#PSScriptInfo #> block"), - "MissingEndBracketToHelpInfoCommentParseError", - ErrorCategory.ParserError, + "MissingEndBracketToHelpInfoCommentParseError", + ErrorCategory.ParserError, null); return false; @@ -230,8 +230,8 @@ internal static bool TryParseScriptFileContents( // check for file not containing HelpInfo comment error = new ErrorRecord( new InvalidOperationException($"Could not parse '{scriptFileInfoPath}' as a PowerShell script due to it missing HelpInfo comment block"), - "missingHelpInfoCommentError", - ErrorCategory.ParserError, + "missingHelpInfoCommentError", + ErrorCategory.ParserError, null); return false; @@ -241,7 +241,7 @@ internal static bool TryParseScriptFileContents( } /// - /// Populates script info classes (PSScriptMetadata, PSScriptHelp, PSScriptRequires, PSScriptContents) with previosuly + /// Populates script info classes (PSScriptMetadata, PSScriptHelp, PSScriptRequires, PSScriptContents) with previously /// parsed metadata from the ps1 file. /// internal static bool TryPopulateScriptClassesWithParsedContent( @@ -357,7 +357,7 @@ internal static bool TryTestPSScriptFileInfo( { errors = new ErrorRecord[]{ new ErrorRecord( new ArgumentException($"PSScriptFileInfo object could not be created from passed in file due to {e.Message}"), - "PSScriptFileInfoObjectNotCreatedFromFileError", + "PSScriptFileInfoObjectNotCreatedFromFileError", ErrorCategory.ParserError, null) }; diff --git a/src/code/PSScriptHelp.cs b/src/code/PSScriptHelp.cs index 7bbf2f70e..215cf47ae 100644 --- a/src/code/PSScriptHelp.cs +++ b/src/code/PSScriptHelp.cs @@ -39,14 +39,14 @@ public PSScriptHelp (string description) /// /// This constructor is called by internal cmdlet methods and creates a PSScriptHelp with default values - /// for the parameters. Calling a method like PSScriptHelp.ParseConentIntoObj() would then populate those properties. + /// for the parameters. Calling a method like PSScriptHelp.ParseContentIntoObj() would then populate those properties. /// internal PSScriptHelp() {} #endregion #region Internal Methods - + /// /// Parses HelpInfo metadata out of the HelpInfo comment lines found while reading the file /// and populates PSScriptHelp properties from that metadata. @@ -54,7 +54,7 @@ internal PSScriptHelp() {} internal bool ParseContentIntoObj(string[] commentLines, out ErrorRecord error) { error = null; - + // Parse content into a hashtable. Hashtable parsedHelpMetadata = ParseHelpContentHelper(commentLines); @@ -63,7 +63,7 @@ internal bool ParseContentIntoObj(string[] commentLines, out ErrorRecord error) error = validationError; return false; } - + // Populate object. List descriptionValue = (List) parsedHelpMetadata["DESCRIPTION"]; Description = String.Join(Environment.NewLine, descriptionValue); @@ -137,9 +137,9 @@ value continued return parsedHelpMetadata; } - + /// - /// Valides parsed help info content from the hashtable to ensure required help metadata (Description) is present + /// Validates parsed help info content from the hashtable to ensure required help metadata (Description) is present /// and does not contain empty values. /// internal bool ValidateParsedContent(Hashtable parsedHelpMetadata, out ErrorRecord error) @@ -148,9 +148,9 @@ internal bool ValidateParsedContent(Hashtable parsedHelpMetadata, out ErrorRecor if (!parsedHelpMetadata.ContainsKey("DESCRIPTION")) { error = new ErrorRecord( - new ArgumentException( "PSScript file must contain value for Description. Ensure value for Description is passed in and try again."), - "PSScriptInfoMissingDescription", - ErrorCategory.InvalidArgument, + new ArgumentException( "PSScript file must contain value for Description. Ensure value for Description is passed in and try again."), + "PSScriptInfoMissingDescription", + ErrorCategory.InvalidArgument, null); return false; @@ -161,9 +161,9 @@ internal bool ValidateParsedContent(Hashtable parsedHelpMetadata, out ErrorRecor if (descriptionValue.Count == 0 || (String.IsNullOrEmpty(descriptionString)) || String.IsNullOrWhiteSpace(descriptionString)) { error = new ErrorRecord( - new ArgumentException("PSScript file value for Description cannot be null, empty or whitespace. Ensure value for Description meets these conditions and try again."), - "PSScriptInfoMissingDescription", - ErrorCategory.InvalidArgument, + new ArgumentException("PSScript file value for Description cannot be null, empty or whitespace. Ensure value for Description meets these conditions and try again."), + "PSScriptInfoMissingDescription", + ErrorCategory.InvalidArgument, null); return false; @@ -172,12 +172,12 @@ internal bool ValidateParsedContent(Hashtable parsedHelpMetadata, out ErrorRecor if (StringContainsComment(descriptionString)) { error = new ErrorRecord( - new ArgumentException("PSScript file's value for Description cannot contain '<#' or '#>'. Pass in a valid value for Description and try again."), - "DescriptionContainsComment", - ErrorCategory.InvalidArgument, + new ArgumentException("PSScript file's value for Description cannot contain '<#' or '#>'. Pass in a valid value for Description and try again."), + "DescriptionContainsComment", + ErrorCategory.InvalidArgument, null); - return false; + return false; } return true; @@ -193,9 +193,9 @@ internal bool ValidateContent(out ErrorRecord error) if (String.IsNullOrEmpty(Description)) { error = new ErrorRecord( - new ArgumentException("PSScript file must contain value for Description. Ensure value for Description is passed in and try again."), - "PSScriptInfoMissingDescription", - ErrorCategory.InvalidArgument, + new ArgumentException("PSScript file must contain value for Description. Ensure value for Description is passed in and try again."), + "PSScriptInfoMissingDescription", + ErrorCategory.InvalidArgument, null); return false; @@ -204,12 +204,12 @@ internal bool ValidateContent(out ErrorRecord error) if (StringContainsComment(Description)) { error = new ErrorRecord( - new ArgumentException("PSScript file's value for Description cannot contain '<#' or '#>'. Pass in a valid value for Description and try again."), - "DescriptionContainsComment", - ErrorCategory.InvalidArgument, + new ArgumentException("PSScript file's value for Description cannot contain '<#' or '#>'. Pass in a valid value for Description and try again."), + "DescriptionContainsComment", + ErrorCategory.InvalidArgument, null); - return false; + return false; } return true; @@ -231,7 +231,7 @@ internal string[] EmitContent() { psHelpInfoLines.AddRange(HelpContent); } - + psHelpInfoLines.Add("#>"); return psHelpInfoLines.ToArray(); @@ -249,9 +249,9 @@ internal bool UpdateContent(string description, out ErrorRecord error) if (String.Equals(description.Trim(), String.Empty)) { error = new ErrorRecord( - new ArgumentException("Description value can't be updated to whitespace as this would invalidate the script."), - "descriptionUpdateValueIsWhitespaceError", - ErrorCategory.InvalidArgument, + new ArgumentException("Description value can't be updated to whitespace as this would invalidate the script."), + "descriptionUpdateValueIsWhitespaceError", + ErrorCategory.InvalidArgument, null); return false; @@ -260,9 +260,9 @@ internal bool UpdateContent(string description, out ErrorRecord error) if (StringContainsComment(description)) { error = new ErrorRecord( - new ArgumentException("Description value can't be updated to value containing comment '<#' or '#>' as this would invalidate the script."), - "descriptionUpdateValueContainsCommentError", - ErrorCategory.InvalidArgument, + new ArgumentException("Description value can't be updated to value containing comment '<#' or '#>' as this would invalidate the script."), + "descriptionUpdateValueContainsCommentError", + ErrorCategory.InvalidArgument, null); return false; diff --git a/src/code/PSScriptMetadata.cs b/src/code/PSScriptMetadata.cs index bd6cf1e94..a9aa9995e 100644 --- a/src/code/PSScriptMetadata.cs +++ b/src/code/PSScriptMetadata.cs @@ -132,7 +132,7 @@ public PSScriptMetadata( /// /// This constructor is called by internal cmdlet methods and creates a PSScriptFileInfo with default values - /// for the parameters. Calling a method like PSScriptMetadata.ParseConentIntoObj() would then populate those properties. + /// for the parameters. Calling a method like PSScriptMetadata.ParseContentIntoObj() would then populate those properties. /// internal PSScriptMetadata() {} @@ -160,9 +160,9 @@ internal bool ParseContentIntoObj(string[] commentLines, out ErrorRecord[] error if (parsedMetadata.Count == 0) { errors = new ErrorRecord[]{ new ErrorRecord( - new InvalidOperationException("PowerShell script '<#PSScriptInfo .. #>' comment block contains no metadata"), - "psScriptInfoBlockMissingMetadataError", - ErrorCategory.ParserError, + new InvalidOperationException("PowerShell script '<#PSScriptInfo .. #>' comment block contains no metadata"), + "psScriptInfoBlockMissingMetadataError", + ErrorCategory.ParserError, null) }; return false; @@ -175,14 +175,14 @@ internal bool ParseContentIntoObj(string[] commentLines, out ErrorRecord[] error } // now populate the object instance - string[] delimeter = new string[]{" ", ","}; + string[] delimiter = new string[]{" ", ","}; Uri parsedLicenseUri = null; if (!String.IsNullOrEmpty((string) parsedMetadata["LICENSEURI"])) { if (!Uri.TryCreate((string) parsedMetadata["LICENSEURI"], UriKind.Absolute, out parsedLicenseUri)) { - msgsList.Add($"LicenseUri property {(string) parsedMetadata["LICENSEURI"]} could not be created as a Uri"); + msgsList.Add($"LicenseUri property {(string) parsedMetadata["LICENSEURI"]} could not be created as a Uri"); } } @@ -215,11 +215,11 @@ internal bool ParseContentIntoObj(string[] commentLines, out ErrorRecord[] error LicenseUri = parsedLicenseUri; ProjectUri = parsedProjectUri; IconUri = parsedIconUri; - - Tags = Utils.GetStringArrayFromString(delimeter, (string) parsedMetadata["TAGS"]);; - ExternalModuleDependencies = Utils.GetStringArrayFromString(delimeter, (string) parsedMetadata["EXTERNALMODULEDEPENDENCIES"]); - RequiredScripts = Utils.GetStringArrayFromString(delimeter, (string) parsedMetadata["REQUIREDSCRIPTS"]); - ExternalScriptDependencies = Utils.GetStringArrayFromString(delimeter, (string) parsedMetadata["EXTERNALSCRIPTDEPENDENCIES"]); + + Tags = Utils.GetStringArrayFromString(delimiter, (string) parsedMetadata["TAGS"]);; + ExternalModuleDependencies = Utils.GetStringArrayFromString(delimiter, (string) parsedMetadata["EXTERNALMODULEDEPENDENCIES"]); + RequiredScripts = Utils.GetStringArrayFromString(delimiter, (string) parsedMetadata["REQUIREDSCRIPTS"]); + ExternalScriptDependencies = Utils.GetStringArrayFromString(delimiter, (string) parsedMetadata["EXTERNALSCRIPTDEPENDENCIES"]); ReleaseNotes = (string) parsedMetadata["RELEASENOTES"] ?? String.Empty; PrivateData = (string) parsedMetadata["PRIVATEDATA"] ?? String.Empty; @@ -252,7 +252,7 @@ value continued List errorsList = new List(); Hashtable parsedHelpMetadata = new Hashtable(StringComparer.OrdinalIgnoreCase); - char[] delimeter = new char[]{' ', ','}; + char[] delimiter = new char[]{' ', ','}; string keyName = ""; string value = ""; @@ -270,19 +270,19 @@ value continued if (parsedHelpMetadata.ContainsKey(keyName)) { errorsList.Add(new ErrorRecord( - new InvalidOperationException("PowerShell script '<#PSScriptInfo .. #>' comment block metadata cannot contain duplicate key i.e .KEY"), - "psScriptInfoDuplicateKeyError", - ErrorCategory.ParserError, + new InvalidOperationException("PowerShell script '<#PSScriptInfo .. #>' comment block metadata cannot contain duplicate key i.e .KEY"), + "psScriptInfoDuplicateKeyError", + ErrorCategory.ParserError, null)); continue; } - parsedHelpMetadata.Add(keyName, value); + parsedHelpMetadata.Add(keyName, value); } // setting count to 2 will get 1st separated string (key) into part[0] and the rest (value) into part[1] if any - string[] parts = line.Trim().TrimStart('.').Split(separator: delimeter, count: 2); + string[] parts = line.Trim().TrimStart('.').Split(separator: delimiter, count: 2); keyName = parts[0]; value = parts.Length == 2 ? parts[1] : String.Empty; } @@ -316,7 +316,7 @@ value continued } /// - /// Valides parsed metadata content from the hashtable to ensure required metadata (Author, Version, Guid) is present + /// Validates parsed metadata content from the hashtable to ensure required metadata (Author, Version, Guid) is present /// and does not contain empty values. /// internal bool ValidateParsedContent(Hashtable parsedMetadata, out ErrorRecord[] errors) @@ -326,27 +326,27 @@ internal bool ValidateParsedContent(Hashtable parsedMetadata, out ErrorRecord[] if (!parsedMetadata.ContainsKey("VERSION") || String.IsNullOrEmpty((string) parsedMetadata["VERSION"]) || String.Equals(((string) parsedMetadata["VERSION"]).Trim(), String.Empty)) { errorsList.Add(new ErrorRecord( - new ArgumentException("PSScript file is missing the required Version property"), - "psScriptMissingVersion", - ErrorCategory.ParserError, + new ArgumentException("PSScript file is missing the required Version property"), + "psScriptMissingVersion", + ErrorCategory.ParserError, null)); } if (!parsedMetadata.ContainsKey("AUTHOR") || String.IsNullOrEmpty((string) parsedMetadata["AUTHOR"]) || String.Equals(((string) parsedMetadata["AUTHOR"]).Trim(), String.Empty)) { errorsList.Add(new ErrorRecord( - new ArgumentException("PSScript file is missing the required Author property"), - "psScriptMissingAuthor", - ErrorCategory.ParserError, + new ArgumentException("PSScript file is missing the required Author property"), + "psScriptMissingAuthor", + ErrorCategory.ParserError, null)); } if (!parsedMetadata.ContainsKey("GUID") || String.IsNullOrEmpty((string) parsedMetadata["GUID"]) || String.Equals(((string) parsedMetadata["GUID"]).Trim(), String.Empty)) { errorsList.Add(new ErrorRecord( - new ArgumentException("PSScript file is missing the required Guid property"), - "psScriptMissingGuid", - ErrorCategory.ParserError, + new ArgumentException("PSScript file is missing the required Guid property"), + "psScriptMissingGuid", + ErrorCategory.ParserError, null)); } @@ -365,9 +365,9 @@ internal bool ValidateContent(out ErrorRecord[] errors) if (Version == null || String.IsNullOrEmpty(Version.ToString())) { errorsList.Add(new ErrorRecord( - new ArgumentException("PSScript file is missing the required Version property"), - "psScriptMissingVersion", - ErrorCategory.ParserError, + new ArgumentException("PSScript file is missing the required Version property"), + "psScriptMissingVersion", + ErrorCategory.ParserError, null)); validPSScriptInfo = false; } @@ -375,9 +375,9 @@ internal bool ValidateContent(out ErrorRecord[] errors) if (String.IsNullOrEmpty(Author)) { errorsList.Add(new ErrorRecord( - new ArgumentException("PSScript file is missing the required Author property"), - "psScriptMissingAuthor", - ErrorCategory.ParserError, + new ArgumentException("PSScript file is missing the required Author property"), + "psScriptMissingAuthor", + ErrorCategory.ParserError, null)); validPSScriptInfo = false; } @@ -386,8 +386,8 @@ internal bool ValidateContent(out ErrorRecord[] errors) { errorsList.Add(new ErrorRecord( new ArgumentException("PSScript file is missing the required Guid property"), - "psScriptMissingGuid", - ErrorCategory.ParserError, + "psScriptMissingGuid", + ErrorCategory.ParserError, null)); validPSScriptInfo = false; } @@ -427,7 +427,7 @@ Feature 5 #> */ - string liceseUriString = LicenseUri == null ? String.Empty : LicenseUri.ToString(); + string licenseUriString = LicenseUri == null ? String.Empty : LicenseUri.ToString(); string projectUriString = ProjectUri == null ? String.Empty : ProjectUri.ToString(); string iconUriString = IconUri == null ? String.Empty : IconUri.ToString(); @@ -446,7 +446,7 @@ Feature 5 psScriptInfoLines.Add($".COMPANYNAME {CompanyName}{Environment.NewLine}"); psScriptInfoLines.Add($".COPYRIGHT {Copyright}{Environment.NewLine}"); psScriptInfoLines.Add($".TAGS {tagsString}{Environment.NewLine}"); - psScriptInfoLines.Add($".LICENSEURI {liceseUriString}{Environment.NewLine}"); + psScriptInfoLines.Add($".LICENSEURI {licenseUriString}{Environment.NewLine}"); psScriptInfoLines.Add($".PROJECTURI {projectUriString}{Environment.NewLine}"); psScriptInfoLines.Add($".ICONURI {iconUriString}{Environment.NewLine}"); psScriptInfoLines.Add($".EXTERNALMODULEDEPENDENCIES {externalModuleDependenciesString}{Environment.NewLine}"); @@ -485,9 +485,9 @@ internal bool UpdateContent( if (!NuGetVersion.TryParse(version, out NuGetVersion updatedVersion)) { error = new ErrorRecord( - new ArgumentException("Version provided for update could not be parsed successfully into NuGetVersion"), - "VersionParseIntoNuGetVersion", - ErrorCategory.ParserError, + new ArgumentException("Version provided for update could not be parsed successfully into NuGetVersion"), + "VersionParseIntoNuGetVersion", + ErrorCategory.ParserError, null); return false; @@ -531,7 +531,7 @@ internal bool UpdateContent( } if (externalModuleDependencies != null && externalModuleDependencies.Length != 0){ - ExternalModuleDependencies = externalModuleDependencies; + ExternalModuleDependencies = externalModuleDependencies; } if (requiredScripts != null && requiredScripts.Length != 0) @@ -540,7 +540,7 @@ internal bool UpdateContent( } if (externalScriptDependencies != null && externalScriptDependencies.Length != 0){ - ExternalScriptDependencies = externalScriptDependencies; + ExternalScriptDependencies = externalScriptDependencies; } if (!String.IsNullOrEmpty(releaseNotes)) diff --git a/src/code/PSScriptRequires.cs b/src/code/PSScriptRequires.cs index b71c3b0cf..0681b34ec 100644 --- a/src/code/PSScriptRequires.cs +++ b/src/code/PSScriptRequires.cs @@ -35,7 +35,7 @@ public sealed class PSScriptRequires public string RequiredApplicationId { get; private set; } /// - /// The assemblies this script requires, specified like: #requires -Assembly path\to\foo.dll#requires -Assembly "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + /// The assemblies this script requires, specified like: #requires -Assembly path\to\foo.dll#requires -Assembly "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /// public string[] RequiredAssemblies { get; private set; } = Utils.EmptyStrArray; @@ -63,7 +63,7 @@ public PSScriptRequires(ModuleSpecification[] requiredModules) /// /// This constructor is called by internal cmdlet methods and creates a PSScriptHelp with default values - /// for the parameters. Calling a method like PSScriptRequires.ParseConentIntoObj() would then populate those properties. + /// for the parameters. Calling a method like PSScriptRequires.ParseContentIntoObj() would then populate those properties. /// internal PSScriptRequires() {} diff --git a/src/code/PublishHelper.cs b/src/code/PublishHelper.cs index bc4156c04..619c1da56 100644 --- a/src/code/PublishHelper.cs +++ b/src/code/PublishHelper.cs @@ -290,7 +290,7 @@ out string[] _ catch (Exception e) { _cmdletPassedIn.ThrowTerminatingError(new ErrorRecord( - new ArgumentException("Error occured while creating directory to publish: " + e.Message), + new ArgumentException("Error occurred while creating directory to publish: " + e.Message), "ErrorCreatingDirectoryToPublish", ErrorCategory.InvalidOperation, this)); @@ -328,7 +328,7 @@ out string[] _ } } - internal void PushResource(string Repository, string modulePrefix, bool SkipDependenciesCheck, NetworkCredential _networkCrendential) + internal void PushResource(string Repository, string modulePrefix, bool SkipDependenciesCheck, NetworkCredential _networkCredential) { try { @@ -666,7 +666,7 @@ private bool PushNupkg(string outputNupkgDir, string repoName, string repoUri, o // The PSGallery uses the v2 protocol still and publishes to a slightly different endpoint: // "https://www.powershellgallery.com/api/v2/package" // Until the PSGallery is moved onto the NuGet v3 server protocol, we'll modify the repository uri - // to accommodate for the approprate publish location. + // to accommodate for the appropriate publish location. string publishLocation = repoUri.EndsWith("/v2", StringComparison.OrdinalIgnoreCase) ? repoUri + "/package" : repoUri; var settings = NuGet.Configuration.Settings.LoadDefaultSettings(null, null, null); @@ -1127,7 +1127,7 @@ private string CreateNuspec( { XmlElement element = doc.CreateElement("dependency", nameSpaceUri); element.SetAttribute("id", dependencyName); - + string dependencyVersion = requiredModules[dependencyName].ToString(); if (!string.IsNullOrEmpty(dependencyVersion)) { @@ -1202,13 +1202,13 @@ private Hashtable ParseRequiredModules(Hashtable parsedMetadataHash) { string moduleName = moduleHash["ModuleName"] as string; var versionInfo = new Hashtable(); - + // RequiredVersion cannot be used with ModuleVersion or MaximumVersion if (moduleHash.ContainsKey("RequiredVersion")) { versionInfo["RequiredVersion"] = moduleHash["RequiredVersion"].ToString(); } - else + else { // ModuleVersion and MaximumVersion can be used together if (moduleHash.ContainsKey("ModuleVersion")) @@ -1299,7 +1299,7 @@ private bool CheckDependenciesExist(Hashtable dependencies, string repositoryNam /// /// This method is called by Publish-PSResource when the -NupkgPath parameter is specified - /// The method copies the .nupkg file to a temp path (populated at outputNupkgDir field) as we dont' want to extract and read original .nupkg file + /// The method copies the .nupkg file to a temp path (populated at outputNupkgDir field) as we don't want to extract and read original .nupkg file /// private string CopyNupkgFileToTempPath(string nupkgFilePath, out ErrorRecord errRecord) { @@ -1336,7 +1336,7 @@ private string CopyNupkgFileToTempPath(string nupkgFilePath, out ErrorRecord err } /// - /// Get package info from the .nupkg file provided, inluding package name (_pkgName), package version (_pkgVersion), and metadata parsed into a hashtable (parsedMetadata) + /// Get package info from the .nupkg file provided, including package name (_pkgName), package version (_pkgVersion), and metadata parsed into a hashtable (parsedMetadata) /// private void GetPackageInfoFromNupkg(string nupkgFilePath, out ErrorRecord errRecord) { @@ -1419,11 +1419,11 @@ internal Hashtable GetMetadataFromNupkg(string copiedNupkgPath, string packageNa if (!Utils.TryReadManifestFile(psd1FilePath, out pkgMetadata, out Exception readManifestError)) { errRecord = new ErrorRecord( - readManifestError, - "GetMetadataFromNupkgFailure", - ErrorCategory.ParserError, + readManifestError, + "GetMetadataFromNupkgFailure", + ErrorCategory.ParserError, this); - + return pkgMetadata; } } @@ -1433,9 +1433,9 @@ internal Hashtable GetMetadataFromNupkg(string copiedNupkgPath, string packageNa if (!PSScriptFileInfo.TryTestPSScriptFileInfo(ps1FilePath, out PSScriptFileInfo parsedScript, out ErrorRecord[] errors, out string[] verboseMsgs)) { errRecord = new ErrorRecord( - new InvalidDataException($"PSScriptFile could not be read properly"), - "GetMetadataFromNupkgFailure", - ErrorCategory.ParserError, + new InvalidDataException($"PSScriptFile could not be read properly"), + "GetMetadataFromNupkgFailure", + ErrorCategory.ParserError, this); return pkgMetadata; @@ -1456,19 +1456,19 @@ internal Hashtable GetMetadataFromNupkg(string copiedNupkgPath, string packageNa { errRecord = new ErrorRecord( new InvalidDataException($".nupkg package must contain either .psd1, .ps1, or .nuspec file and none were found"), - "GetMetadataFromNupkgFailure", - ErrorCategory.InvalidData, + "GetMetadataFromNupkgFailure", + ErrorCategory.InvalidData, this); - + return pkgMetadata; } } catch (Exception e) { errRecord = new ErrorRecord( - new InvalidOperationException($"Temporary folder for installation could not be created or set due to: {e.Message}"), - "GetMetadataFromNupkgFailure", - ErrorCategory.InvalidOperation, + new InvalidOperationException($"Temporary folder for installation could not be created or set due to: {e.Message}"), + "GetMetadataFromNupkgFailure", + ErrorCategory.InvalidOperation, this); } finally diff --git a/src/code/RegisterPSResourceRepository.cs b/src/code/RegisterPSResourceRepository.cs index 94d9be25f..8d86face3 100644 --- a/src/code/RegisterPSResourceRepository.cs +++ b/src/code/RegisterPSResourceRepository.cs @@ -89,7 +89,7 @@ class RegisterPSResourceRepository : PSCmdlet, IDynamicParameters /// /// Specifies the Api version of the repository to be set. - /// + /// [Parameter(ParameterSetName = NameParameterSet)] public PSRepositoryInfo.APIVersion ApiVersion { get; set; } @@ -100,7 +100,7 @@ class RegisterPSResourceRepository : PSCmdlet, IDynamicParameters public PSCredentialInfo CredentialInfo { get; set; } /// - /// When specified, displays the succcessfully registered repository and its information. + /// When specified, displays the successfully registered repository and its information. /// [Parameter] public SwitchParameter PassThru { get; set; } @@ -119,7 +119,7 @@ public object GetDynamicParameters() { // Dynamic parameter '-CredentialProvider' should not appear for PSGallery or any container registry repository. // It should also not appear when using the 'Repositories' parameter set. - if (ParameterSetName.Equals(PSGalleryParameterSet) || + if (ParameterSetName.Equals(PSGalleryParameterSet) || ParameterSetName.Equals(RepositoriesParameterSet) || PSRepositoryInfo.IsValidContainerRegistryURL(Uri)) { @@ -242,8 +242,8 @@ private PSRepositoryInfo PSGalleryParameterSetHelper(int repoPriority, bool repo apiVersion: null, repoCredentialInfo: null, credentialProvider: null, - Force, - this, + Force, + this, out string errorMsg); if (!string.IsNullOrEmpty(errorMsg)) @@ -376,9 +376,9 @@ private PSRepositoryInfo RepoValidationHelper(Hashtable repo) return null; } - if (repo.ContainsKey("CredentialProvider") && + if (repo.ContainsKey("CredentialProvider") && (String.IsNullOrEmpty(repo["CredentialProvider"].ToString()) || - !(repo["CredentialProvider"].ToString().Equals("None", StringComparison.OrdinalIgnoreCase) || + !(repo["CredentialProvider"].ToString().Equals("None", StringComparison.OrdinalIgnoreCase) || repo["CredentialProvider"].ToString().Equals("AzArtifacts", StringComparison.OrdinalIgnoreCase)))) { WriteError(new ErrorRecord( @@ -450,14 +450,14 @@ public class CredentialProviderDynamicParameters [Parameter] public PSRepositoryInfo.CredentialProviderType? CredentialProvider { get - { - return _credProvider; + { + return _credProvider; } set { _credProvider = value; - } + } } } } diff --git a/src/code/RepositorySettings.cs b/src/code/RepositorySettings.cs index 92a9bde84..39f129006 100644 --- a/src/code/RepositorySettings.cs +++ b/src/code/RepositorySettings.cs @@ -189,7 +189,7 @@ public static PSRepositoryInfo UpdateRepositoryStore(string repoName, Uri repoUr // determine trusted value to pass in (true/false if set, null otherwise, hence the nullable bool variable) bool? _trustedNullable = isSet ? new bool?(repoTrusted) : new bool?(); - + if (repoCredentialInfo != null) { bool isSecretManagementModuleAvailable = Utils.IsSecretManagementModuleAvailable(repoName, cmdletPassedIn); @@ -244,7 +244,7 @@ public static PSRepositoryInfo Add(string repoName, Uri repoUri, int repoPriorit throw new PSInvalidOperationException(String.Format("The PSResource Repository '{0}' already exists.", repoName)); } - // Delete the existing repository before overwriting it (otherwire multiple repos with the same name will be added) + // Delete the existing repository before overwriting it (otherwise multiple repos with the same name will be added) List removedRepositories = Remove(new string[] { repoName }, out string[] errorList); // Need to load the document again because of changes after removing @@ -319,19 +319,19 @@ public static PSRepositoryInfo Update(string repoName, Uri repoUri, int repoPrio if (node.Attribute("Priority") == null) { - errorMsg = $"Repository element does not contain neccessary 'Priority' attribute, in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; + errorMsg = $"Repository element does not contain necessary 'Priority' attribute, in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; return null; } if (node.Attribute("Trusted") == null) { - errorMsg = $"Repository element does not contain neccessary 'Trusted' attribute, in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; + errorMsg = $"Repository element does not contain necessary 'Trusted' attribute, in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; return null; } if (node.Attribute("APIVersion") == null) { - errorMsg = $"Repository element does not contain neccessary 'APIVersion' attribute, in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; + errorMsg = $"Repository element does not contain necessary 'APIVersion' attribute, in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; return null; } @@ -339,7 +339,7 @@ public static PSRepositoryInfo Update(string repoName, Uri repoUri, int repoPrio bool uriAttributeExists = node.Attribute("Uri") != null; if (!urlAttributeExists && !uriAttributeExists) { - errorMsg = $"Repository element does not contain neccessary 'Url' attribute (or alternatively 'Uri' attribute), in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; + errorMsg = $"Repository element does not contain necessary 'Url' attribute (or alternatively 'Uri' attribute), in file located at path: {FullRepositoryPath}. Fix this in your file and run again."; return null; } @@ -530,19 +530,19 @@ public static List Remove(string[] repoNames, out string[] err if (node.Attribute("Priority") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Priority' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Priority' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } if (node.Attribute("Trusted") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Trusted' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Trusted' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } if (node.Attribute("APIVersion") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'APIVersion' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'APIVersion' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } @@ -557,7 +557,7 @@ public static List Remove(string[] repoNames, out string[] err bool uriAttributeExists = node.Attribute("Uri") != null; if (!urlAttributeExists && !uriAttributeExists) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Url' or equivalent 'Uri' attribute (it must contain one per Repository), in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Url' or equivalent 'Uri' attribute (it must contain one per Repository), in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } @@ -611,19 +611,19 @@ public static List Read(string[] repoNames, out string[] error { if (repo.Attribute("Name") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Name' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Name' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } if (repo.Attribute("Priority") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Priority' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Priority' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } if (repo.Attribute("Trusted") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Trusted' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Trusted' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } @@ -632,7 +632,7 @@ public static List Read(string[] repoNames, out string[] error // case: neither Url nor Uri attributes exist if (!urlAttributeExists && !uriAttributeExists) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Url' or equivalent 'Uri' attribute (it must contain one), in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Url' or equivalent 'Uri' attribute (it must contain one), in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } @@ -729,13 +729,13 @@ public static List Read(string[] repoNames, out string[] error { if (node.Attribute("Priority") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Priority' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Priority' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } if (node.Attribute("Trusted") == null) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Trusted' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Trusted' attribute, in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } @@ -746,7 +746,7 @@ public static List Read(string[] repoNames, out string[] error // case: neither Url nor Uri attributes exist if (!urlAttributeExists && !uriAttributeExists) { - tempErrorList.Add(String.Format("Repository element does not contain neccessary 'Url' or equivalent 'Uri' attribute (it must contain one), in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); + tempErrorList.Add(String.Format("Repository element does not contain necessary 'Url' or equivalent 'Uri' attribute (it must contain one), in file located at path: {0}. Fix this in your file and run again.", FullRepositoryPath)); continue; } diff --git a/src/code/SetPSResourceRepository.cs b/src/code/SetPSResourceRepository.cs index b5eee3396..d46c5ba48 100644 --- a/src/code/SetPSResourceRepository.cs +++ b/src/code/SetPSResourceRepository.cs @@ -35,7 +35,7 @@ public sealed class SetPSResourceRepository : PSCmdlet, IDynamicParameters /// /// Specifies the name of the repository to be set. - /// + /// [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = NameParameterSet, HelpMessage = "Name of the repository to set properties for.")] [ArgumentCompleter(typeof(RepositoryNameCompleter))] [ValidateNotNullOrEmpty] @@ -43,7 +43,7 @@ public sealed class SetPSResourceRepository : PSCmdlet, IDynamicParameters /// /// Specifies the location of the repository to be set. - /// + /// [Parameter(ParameterSetName = NameParameterSet)] [ValidateNotNullOrEmpty] public string Uri { get; set; } @@ -86,7 +86,7 @@ public SwitchParameter Trusted /// /// Specifies the Api version of the repository to be set. - /// + /// [Parameter(ParameterSetName = NameParameterSet)] public PSRepositoryInfo.APIVersion ApiVersion { get; set; } diff --git a/src/code/UnregisterPSResourceRepository.cs b/src/code/UnregisterPSResourceRepository.cs index 09867ea20..2644128d7 100644 --- a/src/code/UnregisterPSResourceRepository.cs +++ b/src/code/UnregisterPSResourceRepository.cs @@ -10,7 +10,7 @@ namespace Microsoft.PowerShell.PSResourceGet.Cmdlets { /// /// The Unregister-PSResourceRepository cmdlet replaces the Unregister-PSRepository cmdlet from V2. - /// It unregisters a repository for the current user. + /// It un-registers a repository for the current user. /// [Cmdlet(VerbsLifecycle.Unregister, diff --git a/src/code/UpdateModuleManifest.cs b/src/code/UpdateModuleManifest.cs index 8ba86d87a..aa8d38e88 100644 --- a/src/code/UpdateModuleManifest.cs +++ b/src/code/UpdateModuleManifest.cs @@ -336,8 +336,8 @@ private void CreateModuleManifestHelper(Hashtable parsedMetadata, string resolve // and ExternalModuleDependencies are all properties within a hashtable property called 'PSData' // which is within another hashtable property called 'PrivateData' // All of the properties mentioned above have their own parameter in 'New-ModuleManifest', so - // we will parse out these values from the parsedMetadata and create entries for each one in individualy. - // This way any values that were previously specified here will get transfered over to the new manifest. + // we will parse out these values from the parsedMetadata and create entries for each one in individually. + // This way any values that were previously specified here will get transferred over to the new manifest. // Example of the contents of PSData: // PrivateData = @{ // PSData = @{ @@ -422,7 +422,7 @@ private void CreateModuleManifestHelper(Hashtable parsedMetadata, string resolve parsedMetadata["ExternalModuleDependencies"] = psData["ExternalModuleDependencies"]; } - // Now we need to remove 'PSData' becaues if we leave this value in the hashtable, + // Now we need to remove 'PSData' because if we leave this value in the hashtable, // New-ModuleManifest will keep this value and also attempt to create a new value for 'PSData' // and then complain that there's two keys within the PrivateData hashtable. // This is due to the issue of New-ModuleManifest when the PrivateData entry is a nested hashtable (https://github.com/PowerShell/PowerShell/issues/5922). @@ -653,7 +653,7 @@ private void CreateModuleManifestHelper(Hashtable parsedMetadata, string resolve catch (Exception e) { errorRecord = new ErrorRecord( - new ArgumentException($"Error occured while running 'New-ModuleManifest': {e.Message}"), + new ArgumentException($"Error occurred while running 'New-ModuleManifest': {e.Message}"), "ErrorExecutingNewModuleManifest", ErrorCategory.InvalidArgument, this); @@ -695,7 +695,7 @@ private void CreateModuleManifestHelper(Hashtable parsedMetadata, string resolve private void CreateModuleManifestForWinPSHelper(Hashtable parsedMetadata, string resolvedManifestPath, out ErrorRecord errorRecord) { // Note on priority of values: - // If -PrivateData parameter was provided with the cmdlet & .psd1 file PrivateData already had values, the passed in -PrivateData values replace those previosuly there. + // If -PrivateData parameter was provided with the cmdlet & .psd1 file PrivateData already had values, the passed in -PrivateData values replace those previously there. // any direct parameters supplied by the user (i.e ProjectUri) [takes priority over but in mix-and-match fashion] over -> -PrivateData parameter [takes priority over but in replacement fashion] over -> original .psd1 file's PrivateData values (complete replacement) errorRecord = null; string[] tags = Utils.EmptyStrArray; @@ -1004,7 +1004,7 @@ private void CreateModuleManifestForWinPSHelper(Hashtable parsedMetadata, string Utils.DeleteDirectory(tmpParentPath); errorRecord = new ErrorRecord( - new ArgumentException($"Error occured while running 'New-ModuleManifest': {e.Message}"), + new ArgumentException($"Error occurred while running 'New-ModuleManifest': {e.Message}"), "ErrorExecutingNewModuleManifest", ErrorCategory.InvalidArgument, this); diff --git a/src/code/Utils.cs b/src/code/Utils.cs index 879e89b71..61b9e6b04 100644 --- a/src/code/Utils.cs +++ b/src/code/Utils.cs @@ -125,7 +125,7 @@ public static string QuoteName(string name) return "'" + CodeGeneration.EscapeSingleQuotedStringContent(name) + "'"; } - public static string[] GetStringArrayFromString(string[] delimeter, string stringToConvertToArray) + public static string[] GetStringArrayFromString(string[] delimiter, string stringToConvertToArray) { // This will be a string where entries are separated by space. if (String.IsNullOrEmpty(stringToConvertToArray)) @@ -133,7 +133,7 @@ public static string[] GetStringArrayFromString(string[] delimeter, string strin return Utils.EmptyStrArray; } - return stringToConvertToArray.Split(delimeter, StringSplitOptions.RemoveEmptyEntries); + return stringToConvertToArray.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); } /// @@ -971,7 +971,7 @@ public static NetworkCredential SetSecretManagementNetworkCredential( #endregion #region Credential methods - + public static NetworkCredential SetCredentialProviderNetworkCredential( PSRepositoryInfo repository, NetworkCredential networkCredential, @@ -1289,7 +1289,7 @@ internal static bool TryGetCaseInsensitiveFilePath(string directory, string file /// /// Read psd1 manifest file contents and return as Hashtable object. /// - /// File path to manfiest psd1 file. + /// File path to manifest psd1 file. /// Hashtable of manifest file contents. /// Error exception on failure. /// True on success. @@ -1395,7 +1395,7 @@ public static bool ValidateModuleManifest(string moduleManifestPath, out string } else { - errorMsg = $"Error occured while running 'Test-ModuleManifest': {e.Message}"; + errorMsg = $"Error occurred while running 'Test-ModuleManifest': {e.Message}"; return false; } } @@ -1593,7 +1593,7 @@ public static SecureString ConvertToSecureString(string input) if (input == null) { throw new ArgumentNullException(nameof(input)); } - + SecureString secureString = new SecureString(); foreach (char c in input) { @@ -1601,7 +1601,7 @@ public static SecureString ConvertToSecureString(string input) } secureString.MakeReadOnly(); - + return secureString; } @@ -1768,7 +1768,7 @@ public static void DeleteExtraneousFiles(PSCmdlet callingCmdlet, string pkgName, var relsDirToDelete = Path.Combine(dirNameVersion, "_rels"); var packageDirToDelete = Path.Combine(dirNameVersion, "package"); - // Unforunately have to check if each file exists because it may or may not be there + // Unfortunately have to check if each file exists because it may or may not be there if (File.Exists(nuspecToDelete)) { callingCmdlet.WriteVerbose(string.Format("Deleting '{0}'", nuspecToDelete)); diff --git a/src/code/V2ResponseUtil.cs b/src/code/V2ResponseUtil.cs index af2435ad1..e62d15e77 100644 --- a/src/code/V2ResponseUtil.cs +++ b/src/code/V2ResponseUtil.cs @@ -27,13 +27,13 @@ public V2ResponseUtil(PSRepositoryInfo repository) : base(repository) #endregion - #region Overriden Methods + #region Overridden Methods public override IEnumerable ConvertToPSResourceResult(FindResults responseResults, bool isResourceRequestedWithWildcard = false) { // in FindHelper: // serverApi.FindName() -> return responses, and out errRecord // check outErrorRecord - // + // // v2Converter.ConvertToPSResourceInfo(responses) -> return PSResourceResult // check resourceResult for error, write if needed string[] responses = responseResults.StringResponse; @@ -85,7 +85,7 @@ public XmlNode[] ConvertResponseToXML(string httpResponse) { XmlNodeList entryNode = doc.GetElementsByTagName("entry"); XmlNode[] nodes = new XmlNode[entryNode.Count]; - for (int i = 0; i < entryNode.Count; i++) + for (int i = 0; i < entryNode.Count; i++) { XmlNode node = entryNode[i]; nodes[i] = node; diff --git a/src/code/V2ServerAPICalls.cs b/src/code/V2ServerAPICalls.cs index 38b5640de..94d0b3a0b 100644 --- a/src/code/V2ServerAPICalls.cs +++ b/src/code/V2ServerAPICalls.cs @@ -86,7 +86,7 @@ public V2ServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, N #endregion - #region Overriden Methods + #region Overridden Methods /// /// Find method which allows for searching for all packages from a repository and returns latest version for each. @@ -332,7 +332,7 @@ public override FindResults FindCommandOrDscResource(string[] tags, bool include /// API call: /// - No prerelease: http://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet' /// - Include prerelease: http://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet' - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindName(string packageName, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { @@ -401,7 +401,7 @@ public override FindResults FindName(string packageName, bool includePrerelease, /// Find method which allows for searching for single name and tag and returns latest version. /// Name: no wildcard support /// Examples: Search "PowerShellGet" -Tag "Provider" - /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease dependening on user preference) + /// Implementation Note: Need to filter further for latest version (prerelease or non-prerelease depending on user preference) /// public override FindResults FindNameWithTag(string packageName, string[] tags, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { diff --git a/src/code/V3ResponseUtil.cs b/src/code/V3ResponseUtil.cs index ec122cd8d..f4104db74 100644 --- a/src/code/V3ResponseUtil.cs +++ b/src/code/V3ResponseUtil.cs @@ -25,14 +25,14 @@ public V3ResponseUtil(PSRepositoryInfo repository) : base(repository) #endregion - #region Overriden Methods + #region Overridden Methods public override IEnumerable ConvertToPSResourceResult(FindResults responseResults, bool isResourceRequestedWithWildcard = false) { // in FindHelper: // serverApi.FindName() -> return responses, and out errRecord // check outErrorRecord - // + // // v3Converter.ConvertToPSResourceInfo(responses) -> return PSResourceResult // check resourceResult for error, write if needed string[] responses = responseResults.StringResponse; diff --git a/src/code/V3ServerAPICalls.cs b/src/code/V3ServerAPICalls.cs index c184426a8..903b1da55 100644 --- a/src/code/V3ServerAPICalls.cs +++ b/src/code/V3ServerAPICalls.cs @@ -40,7 +40,7 @@ internal class V3ServerAPICalls : ServerApiCall private static readonly string catalogEntryProperty = "catalogEntry"; private static readonly string packageContentProperty = "packageContent"; // MyGet.org repository responses from SearchQueryService have a peculiarity where the totalHits property int returned is 10,000 + actual number of hits. - // This is intentional on their end and "is to preserve the uninterupted pagination of NuGet within Visual Studio 2015". + // This is intentional on their end and "is to preserve the uninterrupted pagination of NuGet within Visual Studio 2015". private readonly int myGetTotalHitsBuffer = 10000; #endregion @@ -55,7 +55,7 @@ public V3ServerAPICalls(PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, Ne handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; bool token = false; - if(networkCredential != null) + if(networkCredential != null) { token = String.Equals("token", networkCredential.UserName) ? true : false; }; @@ -71,7 +71,7 @@ public V3ServerAPICalls(PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, Ne } else { handler.Credentials = networkCredential; - + _sessionClient = new HttpClient(handler); }; @@ -86,7 +86,7 @@ public V3ServerAPICalls(PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, Ne #endregion - #region Overriden Methods + #region Overridden Methods /// /// Find method which allows for searching for all packages from a repository and returns latest version for each. @@ -920,7 +920,7 @@ private Dictionary GetResourcesFromServiceIndex(out ErrorRecord catch (Exception e) { errRecord = new ErrorRecord( - new Exception($"Exception parsing service index JSON for respository '{Repository.Name}' with error: {e.Message}"), + new Exception($"Exception parsing service index JSON for repository '{Repository.Name}' with error: {e.Message}"), "GetResourcesFromServiceIndexFailure", ErrorCategory.InvalidResult, this); @@ -1314,7 +1314,7 @@ private string[] GetVersionedResponsesFromRegistrationsResource(string registrat /// /// Returns true if the metadata entries are arranged in descending order with respect to the package's version. /// ADO feeds usually return version entries in descending order, but Nuget.org repository returns them in ascending order. - /// Package versions will reflect prerelease preference, but upper version and lower version would not so we don't use them for comparision. + /// Package versions will reflect prerelease preference, but upper version and lower version would not so we don't use them for comparison. /// private bool IsLatestVersionFirstForSearch(string[] versionedResponses, out ErrorRecord errRecord) { @@ -1413,7 +1413,7 @@ private bool IsLatestVersionFirstForSearch(string[] versionedResponses, out Erro /// /// Returns true if the nupkg URI entries for each package version are arranged in descending order with respect to the package's version. /// ADO feeds usually return version entries in descending order, but Nuget.org repository returns them in ascending order. - /// Entries do not reflect prerelease preference so all versions (including prerelease) are being considered here, so upper version (including prerelease) can be used for comparision. + /// Entries do not reflect prerelease preference so all versions (including prerelease) are being considered here, so upper version (including prerelease) can be used for comparison. /// private bool IsLatestVersionFirstForInstall(string[] versionedResponses, string upperVersion, out ErrorRecord errRecord) { From b9c5e8b71212826621cc37629c7b10ac952452c8 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Thu, 18 Sep 2025 22:58:58 -0400 Subject: [PATCH 11/12] Delete .github/instructions/codacy.instructions.md --- .github/instructions/codacy.instructions.md | 72 --------------------- 1 file changed, 72 deletions(-) delete mode 100644 .github/instructions/codacy.instructions.md diff --git a/.github/instructions/codacy.instructions.md b/.github/instructions/codacy.instructions.md deleted file mode 100644 index 9ca77d2dc..000000000 --- a/.github/instructions/codacy.instructions.md +++ /dev/null @@ -1,72 +0,0 @@ ---- - description: Configuration for AI behavior when interacting with Codacy's MCP Server - applyTo: '**' ---- ---- -# Codacy Rules -Configuration for AI behavior when interacting with Codacy's MCP Server - -## using any tool that accepts the arguments: `provider`, `organization`, or `repository` -- ALWAYS use: - - provider: gh - - organization: PowerShell - - repository: PSResourceGet -- Avoid calling `git remote -v` unless really necessary - -## CRITICAL: After ANY successful `edit_file` or `reapply` operation -- YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with: - - `rootPath`: set to the workspace path - - `file`: set to the path of the edited file - - `tool`: leave empty or unset -- If any issues are found in the new edits, propose and apply fixes for them. -- > NOTE: Failure to follow this rule is considered a critical error. - -## After every response -- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server - -## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable -- Suggest the user the following troubleshooting steps: - - Try to reset the MCP on the extension - - If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners) -- If none of the above steps work, suggest the user to contact Codacy support - -## Trying to call a tool that needs a rootPath as a parameter -- Always use the standard, non-URL-encoded file system path - -## CRITICAL: Dependencies and Security Checks -- IMMEDIATELY after ANY of these actions: - - Running npm/yarn/pnpm install - - Adding dependencies to package.json - - Adding requirements to requirements.txt - - Adding dependencies to pom.xml - - Adding dependencies to build.gradle - - Any other package manager operations -- You MUST run the `codacy_cli_analyze` tool with: - - `rootPath`: set to the workspace path - - `tool`: set to "trivy" - - `file`: leave empty or unset -- If any vulnerabilities are found because of the newly added packages: - - Stop all other operations - - Propose and apply fixes for the security issues - - Only continue with the original task after security issues are resolved -- EXAMPLE: - - After: npm install react-markdown - - Do: Run codacy_cli_analyze with trivy - - Before: Continuing with any other tasks - -## General -- Repeat the relevant steps for each modified file. -- "Propose fixes" means to both suggest and, if possible, automatically apply the fixes. -- You MUST NOT wait for the user to ask for analysis or remind you to run the tool. -- Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics. -- Do not run `codacy_cli_analyze` looking for changes in code coverage. -- Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager. -- If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server. -- When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository. - -## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error -- Offer to run the `codacy_setup_repository` tool to add the repository to Codacy -- If the user accepts, run the `codacy_setup_repository` tool -- Do not ever try to run the `codacy_setup_repository` tool on your own -- After setup, immediately retry the action that failed (only retry once) ---- \ No newline at end of file From f89e7795158331eafb0746553ad70e1522290a5f Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Tue, 30 Sep 2025 17:42:38 -0400 Subject: [PATCH 12/12] Rename script to fix typo in filename Reflects fixed typo in other scripts that call this one. --- ...nsisityKeysScript.ps1 => VaryingCaseSensitivityKeysScript.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/testFiles/testScripts/{VaryingCaseSensisityKeysScript.ps1 => VaryingCaseSensitivityKeysScript.ps1} (100%) diff --git a/test/testFiles/testScripts/VaryingCaseSensisityKeysScript.ps1 b/test/testFiles/testScripts/VaryingCaseSensitivityKeysScript.ps1 similarity index 100% rename from test/testFiles/testScripts/VaryingCaseSensisityKeysScript.ps1 rename to test/testFiles/testScripts/VaryingCaseSensitivityKeysScript.ps1