Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-ModuleManifest creates .psd1 content that fails PSScriptAnalyzer #705

Open
5 tasks done
tig opened this issue Nov 7, 2023 · 0 comments
Open
5 tasks done

Comments

@tig
Copy link

tig commented Nov 7, 2023

Prerequisites

Steps to reproduce

Use

#
# Module manifest for module 'F7History'
#
# Generated by: Tig Kindel
#
# Generated on: 11/7/2023
#

@{

# Script module or binary module file associated with this manifest.
RootModule = '.\F7History.psm1'

# Version number of this module.
ModuleVersion = '0.0.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = 'af35b6c1-758f-4d46-92ae-ac18cb9c983d'

# Author of this module
Author = 'Tig Kindel'

# Company or vendor of this module
CompanyName = 'Kindel, LLC'

# Copyright statement for this module
Copyright = '(c) Kindel, LLC. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Press F7 to get a graphical Command History in Powershell.'

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'PSReadline'; ModuleVersion = '2.1'; }, 
               @{ModuleName = 'Microsoft.PowerShell.ConsoleGuiTools'; ModuleVersion = '0.7.6.0'; })

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
# VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

    PSData = @{

        # Tags applied to this module. These help with module discovery in online galleries.
        Tags = 'Windows','Mac','Linux','History','ConsoleGuiTools','TUI','Out-ConsoleGridView','ocgv','Terminal.Gui','gui.cs'

        # A URL to the license for this module.
        LicenseUri = 'https://github.com/gui-cs/F7History/blob/main/LICENSE.md'

        # A URL to the main website for this project.
        ProjectUri = 'https://github.com/gui-cs/F7History/'

        # A URL to an icon representing this module.
        IconUri = 'https://gui-cs.github.io/Terminal.Gui/images/logo48.png'

        # ReleaseNotes of this module
        # ReleaseNotes = ''

        # Prerelease string of this module
        # Prerelease = ''

        # Flag to indicate whether the module requires explicit user acceptance for install/update/save
        # RequireLicenseAcceptance = $false

        # External dependent modules of this module
        ExternalModuleDependencies = @('Microsoft.PowerShell.ConsoleGuiTools','PSReadLine')

    } # End of PSData hashtable

 } # End of PrivateData hashtable

# HelpInfo URI of this module
HelpInfoURI = 'https://github.com/gui-cs/F7History/blob/main/README.md'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
}

Run

Update-ModuleManifest -RequiredModules @(
    @{ModuleName = "PSReadline"; ModuleVersion = "2.1" }, 
    @{ModuleName = "Microsoft.PowerShell.ConsoleGuiTools"; ModuleVersion = "0.0.0.0" }
) -Path F7History.psd1 
Invoke-ScriptAnalyzer F7History.psd1 -Recurse -Settings PSGallery

Workaround:

Invoke-ScriptAnalyzer F7History.ps1 -Settings PSGallery -Fix 

Expected behavior

No lint errors.

Actual behavior

RuleName   : PSAvoidTrailingWhitespace
Severity   : Information
ScriptName : F7History.psd1
Line       : 54
Message    : Line has trailing whitespace


### Error details

_No response_

### Environment data

```powershell
Name                           Value
----                           -----
PSVersion                      7.4.0-rc.1
PSEdition                      Core
GitCommitId                    7.4.0-rc.1
OS                             Microsoft Windows 10.0.25947
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


### Visuals

_No response_
@SteveL-MSFT SteveL-MSFT transferred this issue from PowerShell/PowerShell Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant