Skip to content

Commit 881a567

Browse files
docs(contributing): add copyright header guidelines (#382)
## Summary Create contributor documentation explaining the copyright and license header format required for source files. ## Changes - Create `docs/contributing/copyright-headers.md` with: - Header format examples for PowerShell, Bash, Python, C#, TypeScript, JavaScript - Placement rules (after shebang, after #Requires statements) - SPDX standard references and OpenSSF badge context - Add reference link from CONTRIBUTING.md under Style Guides section ## Acceptance Criteria Checklist - [x] Create docs/contributing/copyright-headers.md - [x] Include header format examples for PowerShell, Bash, Python, and C# - [x] Document placement rules (after shebang, after #Requires statements) - [x] Reference the MIT license and SPDX standard - [x] Add link to this document from CONTRIBUTING.md - [x] Frontmatter validates against schema Fixes #303 --------- Co-authored-by: Bill Berry <WilliamBerryiii@users.noreply.github.com>
1 parent 0efb722 commit 881a567

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ Refer to the [DevContainer README](./.devcontainer/README.md) for detailed infor
197197
- Run spell checking before committing changes
198198
- Format tables using the markdown-table-formatter tool
199199

200+
### Copyright and License Headers
201+
202+
All source files must include copyright and license headers to meet OpenSSF Best Practices badge criteria. See [Copyright Header Guidelines](./docs/contributing/copyright-headers.md) for format requirements and placement rules by file type.
203+
200204
## Testing Requirements
201205

202206
New functionality MUST include tests. This policy ensures code quality and prevents regressions.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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.*

0 commit comments

Comments
 (0)