PowerShell / PowerShell/PSResourceGet

PSResourceGet module assumes the required modules statement location in script file in specific place

Open
#1,248 7 comments 0 reactions 1 assignee View on GitHub

@anamnavi is already working on this.

Since Jul 12, 2023.

Area-InfoFile feature_request
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
Steps to reproduce

About Requires states that the #Requires statements can appear on any line in a script. Yet the module PSResourceGet assumes that #Requires -Modules statement is above comment based help block.

@'
<#PSScriptInfo
.VERSION 1.0.0
.GUID {0}
.AUTHOR Me
.TAGS
#>
<#
.DESCRIPTION
just for testing
#>

#Requires -Modules mymodule
'@ -f (new-guid) | set-content -path test.ps1

Get-PSScriptFileInfo -Path .\test.ps1 | select -ExpandProperty scriptRequiresComment
Expected behavior
RequiredModules
---------------
{mymodule}
Actual behavior
RequiredModules
---------------
{}
Error details

No response

Environment data

PSResourceGet: 0.5.22
PowerShell: 5.1 or 7.3.5

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.