microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
docs/contributing/copyright-headers.md
96lines · 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-05-13 |
| 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 | ### Python Files |
| 35 | |
| 36 | ```text |
| 37 | # Copyright (c) Microsoft Corporation. |
| 38 | # SPDX-License-Identifier: MIT |
| 39 | ``` |
| 40 | |
| 41 | Applies to: `.py` files |
| 42 | |
| 43 | ## Placement Rules |
| 44 | |
| 45 | The header placement depends on any required directives in the file: |
| 46 | |
| 47 | ### With #Requires Statements |
| 48 | |
| 49 | Place the header **after** any `#Requires` statements: |
| 50 | |
| 51 | ```powershell |
| 52 | #Requires -Version 7.0 |
| 53 | #Requires -Modules @{ ModuleName="Pester"; ModuleVersion="5.0" } |
| 54 | # Copyright (c) Microsoft Corporation. |
| 55 | # SPDX-License-Identifier: MIT |
| 56 | |
| 57 | # Script content starts here |
| 58 | ``` |
| 59 | |
| 60 | ### Without #Requires Statements |
| 61 | |
| 62 | If no `#Requires` statements exist, place the header at the first line: |
| 63 | |
| 64 | ```powershell |
| 65 | # Copyright (c) Microsoft Corporation. |
| 66 | # SPDX-License-Identifier: MIT |
| 67 | |
| 68 | param( |
| 69 | [string]$Path |
| 70 | ) |
| 71 | ``` |
| 72 | |
| 73 | ### Python Files |
| 74 | |
| 75 | Place the header **after** any shebang line and **before** PEP 723 inline metadata or the module docstring: |
| 76 | |
| 77 | ```python |
| 78 | #!/usr/bin/env python3 |
| 79 | # Copyright (c) Microsoft Corporation. |
| 80 | # SPDX-License-Identifier: MIT |
| 81 | ``` |
| 82 | |
| 83 | If no shebang exists, place the header at the first line. |
| 84 | |
| 85 | ## References |
| 86 | |
| 87 | * [Microsoft Open Source](https://opensource.microsoft.com/) - Microsoft's open source program and governance |
| 88 | * [SPDX License List](https://spdx.org/licenses/) - Standard license identifiers |
| 89 | * [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 |
| 90 | * [OpenSSF Best Practices Badge Criteria](https://www.bestpractices.dev/en/criteria/2) - Gold level requirements |
| 91 | * [PowerShell/PowerShell header example](https://github.com/PowerShell/PowerShell/blob/master/tools/Sign-Package.ps1) - Reference implementation |
| 92 | |
| 93 | --- |
| 94 | |
| 95 | *🤖 Crafted with precision by ✨Copilot following brilliant human instruction, |
| 96 | then carefully refined by our team of discerning human reviewers.* |
| 97 | |