microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
docs/contributing/copyright-headers.md
74lines · modecode
| 1 | --- |
| 2 | title: Copyright Header Guidelines |
| 3 | description: Standards for copyright and license headers in source files to meet OpenSSF Best Practices badge criteria |
| 4 | author: Microsoft |
| 5 | ms.date: 2026-01-31 |
| 6 | ms.topic: reference |
| 7 | keywords: |
| 8 | - copyright |
| 9 | - license |
| 10 | - SPDX |
| 11 | - headers |
| 12 | - OpenSSF |
| 13 | estimated_reading_time: 2 |
| 14 | --- |
| 15 | |
| 16 | This document defines the copyright and license header format required for source files in the hve-core repository. Following these guidelines ensures compliance with [OpenSSF Best Practices](https://www.bestpractices.dev/en/criteria/2) Gold badge criteria for `copyright_per_file` and `license_per_file`. |
| 17 | |
| 18 | ## Overview |
| 19 | |
| 20 | All source files in this repository must include a copyright and license header. We use the [SPDX License Identifier](https://spdx.org/licenses/) standard to provide machine-readable license information. |
| 21 | |
| 22 | ## Header Format |
| 23 | |
| 24 | ### PowerShell Files |
| 25 | |
| 26 | ```text |
| 27 | # Copyright (c) Microsoft Corporation. |
| 28 | # SPDX-License-Identifier: MIT |
| 29 | ``` |
| 30 | |
| 31 | Applies to: `.ps1` files |
| 32 | |
| 33 | ## Placement Rules |
| 34 | |
| 35 | The header placement depends on any required directives in the file: |
| 36 | |
| 37 | ### With #Requires Statements |
| 38 | |
| 39 | Place the header **after** any `#Requires` statements: |
| 40 | |
| 41 | ```powershell |
| 42 | #Requires -Version 7.0 |
| 43 | #Requires -Modules @{ ModuleName="Pester"; ModuleVersion="5.0" } |
| 44 | # Copyright (c) Microsoft Corporation. |
| 45 | # SPDX-License-Identifier: MIT |
| 46 | |
| 47 | # Script content starts here |
| 48 | ``` |
| 49 | |
| 50 | ### Without #Requires Statements |
| 51 | |
| 52 | If no `#Requires` statements exist, place the header at the first line: |
| 53 | |
| 54 | ```powershell |
| 55 | # Copyright (c) Microsoft Corporation. |
| 56 | # SPDX-License-Identifier: MIT |
| 57 | |
| 58 | param( |
| 59 | [string]$Path |
| 60 | ) |
| 61 | ``` |
| 62 | |
| 63 | ## References |
| 64 | |
| 65 | - [Microsoft Open Source](https://opensource.microsoft.com/) - Microsoft's open source program and governance |
| 66 | - [SPDX License List](https://spdx.org/licenses/) - Standard license identifiers |
| 67 | - [SPDX License Identifier Specification](https://spdx.github.io/spdx-spec/v2.3/using-SPDX-short-identifiers-in-source-files/) - How to use SPDX identifiers in source files |
| 68 | - [OpenSSF Best Practices Badge Criteria](https://www.bestpractices.dev/en/criteria/2) - Gold level requirements |
| 69 | - [PowerShell/PowerShell header example](https://github.com/PowerShell/PowerShell/blob/master/tools/Sign-Package.ps1) - Reference implementation |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | *🤖 Crafted with precision by ✨Copilot following brilliant human instruction, |
| 74 | then carefully refined by our team of discerning human reviewers.* |