Command
New-ConfigurationValidation
Creates configuration for module validation checks during build.
Syntax
New-ConfigurationValidation [-AllowBannedCommandsIn <String[]>] [-AllowBinaryWildcardExports <Boolean>] [-AllowWildcardExports <Boolean>] [-BannedCommands <String[]>] [-BinarySeverity <Off|Warning|Error>] [-CsprojSeverity <Off|Warning|Error>] [-DocumentationSeverity <Off|Warning|Error>] [-Enable] [-EnableScriptAnalyzer] [-EnableTests] [-ExcludeCommands <String[]>] [-FileIntegrityCheckSyntax <Boolean>] [-FileIntegrityCheckTrailingWhitespace <Boolean>] [-FileIntegrityExcludeDirectories <String[]>] [-FileIntegritySeverity <Off|Warning|Error>] [-InternalFunctionPaths <String[]>] [-MinDescriptionPercent <Int32>] [-MinExamplesPerCommand <Int32>] [-MinParameterDescriptionPercent <Int32>] [-MinSynopsisPercent <Int32>] [-MinTypeDescriptionPercent <Int32>] [-PublicFunctionPaths <String[]>] [-RequireLibraryOutput <Boolean>] [-RequireTargetFramework <Boolean>] [-ScriptAnalyzerExcludeDirectories <String[]>] [-ScriptAnalyzerExcludeRules <String[]>] [-ScriptAnalyzerInstallIfUnavailable <Boolean>] [-ScriptAnalyzerSeverity <Off|Warning|Error>] [-ScriptAnalyzerSkipIfUnavailable <Boolean>] [-ScriptAnalyzerTimeoutSeconds <Int32>] [-StructureSeverity <Off|Warning|Error>] [-TestAdditionalModules <String[]>] [-TestForce] [-TestSkipDependencies] [-TestSkipImport] [-TestSkipModules <String[]>] [-TestsPath <String>] [-TestsSeverity <Off|Warning|Error>] [-TestTimeoutSeconds <Int32>] [-ValidateBinaryAssemblies <Boolean>] [-ValidateBinaryExports <Boolean>] [-ValidateExports <Boolean>] [-ValidateInternalNotExported <Boolean>] [-ValidateManifestFiles <Boolean>] [<CommonParameters>]#Parameter set:
All Parameter SetsDescription
Adds a single validation segment that can run structure, documentation, test, binary, and csproj checks. Each check can be configured as Off/Warning/Error to control whether it is informational or blocking.
Encoding and line-ending enforcement is handled by New-ConfigurationFileConsistency.
Examples
Enable validation with warnings for docs and errors for structure
New-ConfigurationValidation -Enable -StructureSeverity Error -DocumentationSeverity WarningRun tests and fail the build on test failures
New-ConfigurationValidation -Enable -EnableTests -TestsSeverity Error -TestsPath 'Tests'Parameters
- -AllowBannedCommandsIn String[]
- File names allowed to use banned commands.
- -AllowBinaryWildcardExports Boolean
- Allow wildcard exports for binary checks.
- -AllowWildcardExports Boolean
- Allow wildcard exports (skip export validation if FunctionsToExport='*').
- -BannedCommands String[]
- Commands that should not appear in scripts.
- -BinarySeverity ValidationSeverity
- Severity for binary export checks.
- Possible values:
Off,Warning,Error - -CsprojSeverity ValidationSeverity
- Severity for csproj validation checks.
- Possible values:
Off,Warning,Error - -DocumentationSeverity ValidationSeverity
- Severity for documentation checks.
- Possible values:
Off,Warning,Error - -Enable SwitchParameter
- Enable module validation checks during build.
- -EnableScriptAnalyzer SwitchParameter
- Enable PSScriptAnalyzer checks during validation.
- -EnableTests SwitchParameter
- Enable test execution during validation.
- -ExcludeCommands String[]
- Command names to exclude from documentation checks.
- -FileIntegrityCheckSyntax Boolean
- Check for PowerShell syntax errors.
- -FileIntegrityCheckTrailingWhitespace Boolean
- Check for trailing whitespace in scripts.
- -FileIntegrityExcludeDirectories String[]
- Directories to exclude from file integrity checks.
- -FileIntegritySeverity ValidationSeverity
- Severity for file integrity checks.
- Possible values:
Off,Warning,Error - -InternalFunctionPaths String[]
- Relative paths to internal function files (default: "internal\\functions").
- -MinDescriptionPercent Int32
- Minimum description coverage percentage (default 100).
- -MinExamplesPerCommand Int32
- Minimum examples per command (default 1).
- -MinParameterDescriptionPercent Int32
- Minimum percentage of parameters that must have descriptions (default 0 = disabled).
- -MinSynopsisPercent Int32
- Minimum synopsis coverage percentage (default 100).
- -MinTypeDescriptionPercent Int32
- Minimum percentage of unique input/output types that must have descriptions (default 0 = disabled).
- -PublicFunctionPaths String[]
- Relative paths to public function files (default: "functions").
- -RequireLibraryOutput Boolean
- Require OutputType=Library in csproj (when specified).
- -RequireTargetFramework Boolean
- Require TargetFramework/TargetFrameworks in csproj.
- -ScriptAnalyzerExcludeDirectories String[]
- Directories to exclude from PSScriptAnalyzer checks.
- -ScriptAnalyzerExcludeRules String[]
- PSScriptAnalyzer rules to exclude.
- Install PSScriptAnalyzer on demand before validation when it is missing.
- -ScriptAnalyzerSeverity ValidationSeverity
- Severity for PSScriptAnalyzer checks.
- Possible values:
Off,Warning,Error - Skip PSScriptAnalyzer checks if the module is not installed.
- -ScriptAnalyzerTimeoutSeconds Int32
- ScriptAnalyzer timeout, in seconds (default 300).
- -StructureSeverity ValidationSeverity
- Severity for module structure checks.
- Possible values:
Off,Warning,Error - -TestAdditionalModules String[]
- Additional modules to install for tests.
- -TestForce SwitchParameter
- Force dependency reinstall and module reimport during tests.
- -TestSkipDependencies SwitchParameter
- Skip dependency installation during tests.
- -TestSkipImport SwitchParameter
- Skip importing the module during tests.
- -TestSkipModules String[]
- Module names to skip during test dependency installation.
- -TestsPath String
- Path to tests (defaults to Tests under project root).
- -TestsSeverity ValidationSeverity
- Severity for test failures.
- Possible values:
Off,Warning,Error - -TestTimeoutSeconds Int32
- Test timeout, in seconds (default 600).
- -ValidateBinaryAssemblies Boolean
- Validate that binary assemblies exist.
- -ValidateBinaryExports Boolean
- Validate binary exports against CmdletsToExport/AliasesToExport.
- -ValidateExports Boolean
- Validate that FunctionsToExport matches public functions.
- -ValidateInternalNotExported Boolean
- Validate that internal functions are not exported.
- -ValidateManifestFiles Boolean
- Validate manifest file references (RootModule/Formats/Types/RequiredAssemblies).
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.