-
Notifications
You must be signed in to change notification settings - Fork 125
Closed as duplicate of#307
Closed as duplicate of#307
Copy link
Labels
ciContinuous integrationContinuous integrationfeatureNew feature triggering minor version bumpNew feature triggering minor version bump
Milestone
Description
Issue Description
Add a CI job that validates all PowerShell files (.ps1, .psm1, .psd1) contain the required Microsoft copyright and MIT license header at the top of the file.
Required Header Format
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.The header must appear at the very beginning of the file (lines 1-2). Additional metadata comments (purpose, author) may follow but are not required.
Acceptance Criteria
- Create validation script in
scripts/linting/that checks all PowerShell files - Script returns non-zero exit code when files are missing headers
- Script outputs list of non-compliant files with their paths
- Add npm script alias for local execution (e.g.,
npm run lint:copyright) - Integrate into existing CI linting workflow
- Document expected header format in
scripts/linting/README.md
Additional Context
Files to Check
- All
.ps1files (scripts) - All
.psm1files (modules) - All
.psd1files (module manifests)
Exclusions to Consider
scripts/tests/directory (test files may have different conventions)- Vendor/third-party files if any exist
Example Validation Logic
$expectedLine1 = '# Copyright (c) Microsoft Corporation.'
$expectedLine2 = '# Licensed under the MIT license.'
$content = Get-Content -Path $file -TotalCount 2
if ($content[0] -ne $expectedLine1 -or $content[1] -ne $expectedLine2) {
# File is non-compliant
}Related
- Existing linting scripts in
scripts/linting/ - PSScriptAnalyzer integration at
scripts/linting/Invoke-PSScriptAnalyzer.ps1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ciContinuous integrationContinuous integrationfeatureNew feature triggering minor version bumpNew feature triggering minor version bump