-
Notifications
You must be signed in to change notification settings - Fork 35
feat: add PowerShell script to validate copyright headers #370
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
base: main
Are you sure you want to change the base?
feat: add PowerShell script to validate copyright headers #370
Conversation
Adds Test-CopyrightHeaders.ps1 script that validates the presence of copyright and SPDX license headers in source files. Features: - Scans .ps1, .psm1, .psd1, .sh files by default - Checks for 'Copyright (c) Microsoft Corporation.' line - Checks for 'SPDX-License-Identifier: MIT' line - Handles shebang and #Requires statement positioning - Outputs JSON results to logs/copyright-header-results.json - Supports -FailOnMissing for CI integration Also includes: - npm script: validate:copyright - Pester tests for all validation scenarios Fixes microsoft#306
katriendg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - this looks good and covers the issue.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #370 +/- ##
==========================================
+ Coverage 52.44% 53.45% +1.01%
==========================================
Files 17 18 +1
Lines 3110 3197 +87
==========================================
+ Hits 1631 1709 +78
- Misses 1479 1488 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Can you please review if you can improve code coverage? Thanks |
|
@littleKitchen please see the PowerShell failed check and review your Tests. |
Summary
Fixes #306
Adds
Test-CopyrightHeaders.ps1script that validates the presence of copyright and SPDX license headers in source files.Changes
New Files
scripts/linting/Test-CopyrightHeaders.ps1- Main validation scriptscripts/tests/linting/Test-CopyrightHeaders.Tests.ps1- Pester testsModified Files
package.json- Addedvalidate:copyrightnpm scriptFeatures
.ps1,.psm1,.psd1,.shfiles by default# Copyright (c) Microsoft Corporation.line# SPDX-License-Identifier: MITline#Requiresstatement positioning (checks first 15 lines)-FailOnMissingflag for CI integrationTesting
Pester tests cover: