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