microsoft/hve-core

Public

mirrored from https://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
hve-core-v2.3.7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/linting/PSScriptAnalyzer.psd1

69lines · modeblame

d19c9b3alittleKitchen4 months ago1# Copyright (c) Microsoft Corporation.
2# SPDX-License-Identifier: MIT
3
9f975225Bill Berry7 months ago4# PSScriptAnalyzer Settings for HVE Core
5# Purpose: Enforce PowerShell best practices and coding standards
6
7@{
8# Severity levels: Error, Warning, Information
9# Only include rules that should fail the build
10Severity = @('Error', 'Warning')
11
12# Include all default rules
13IncludeDefaultRules = $true
14
15# Exclude specific rules that may not apply
16ExcludeRules = @(
17# Allow Write-Host for user-facing scripts (console output is intentional)
18'PSAvoidUsingWriteHost',
19# Allow plural nouns for functions that semantically return multiple items (e.g., Get-GitIgnorePatterns)
20'PSUseSingularNouns',
21# Skip ShouldProcess for simple GitHub Actions helper functions that only append to files
22'PSUseShouldProcessForStateChangingFunctions',
23# Skip false positive for error redirection operator (2>$null)
24'PSPossibleIncorrectUsageOfRedirectionOperator'
25)
26
27# Custom rule configurations
28Rules = @{
29# Enforce cmdlet alias avoidance (use full cmdlet names)
30PSAvoidUsingCmdletAliases = @{
31Enable = $true
32}
33
34# Require explicit parameter types
35PSUseCompatibleSyntax = @{
36Enable = $true
37TargetVersions = @('5.1', '7.0', '7.2')
38}
39
40# Enforce proper comment-based help
41PSProvideCommentHelp = @{
42Enable = $true
43ExportedOnly = $false
44BlockComment = $true
45VSCodeSnippetCorrection = $true
46Placement = 'before'
47}
48
49# Enforce proper OutputType declarations
50PSUseOutputTypeCorrectly = @{
51Enable = $true
52}
53
54# Enforce proper verb usage
55PSUseApprovedVerbs = @{
56Enable = $true
57}
58
59# Require BOM for UTF-8 encoded files
60PSUseBOMForUnicodeEncodedFile = @{
61Enable = $true
62}
63
64# Avoid using positional parameters
65PSAvoidUsingPositionalParameters = @{
66Enable = $false # Disabled - common in scripts
67}
68}
69}