Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt

Use this file to discover all available pages before exploring further.

powershell/PSUseToExportFieldsInManifest is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
PropertyValue
SeverityWarning
CategoryPSScriptAnalyzer
Auto-fixNo

Description

To improve the performance of module auto-discovery, module manifests should not use wildcards ('*') or null ($null) in the following entries:
  • AliasesToExport
  • CmdletsToExport
  • FunctionsToExport
  • VariablesToExport
Using wildcards or null causes PowerShell to perform expensive work to analyze a module during module auto-discovery.

How

Use an explicit list in the entries.

Example 1

Suppose there are no functions in your module to export. Then,

Problematic code

FunctionsToExport = $null

Correct code

FunctionsToExport = @()

Example 2

Suppose there are only two functions in your module, Get-Foo and Set-Foo that you want to export. Then,

Problematic code

FunctionsToExport = '*'

Correct code

FunctionsToExport = @(Get-Foo, Set-Foo)

Source

This rule documentation is adapted from Microsoft’s PSScriptAnalyzer documentation for UseToExportFieldsInManifest, licensed under CC BY 4.0.