Skip to content

chore: Add license header enforcement to all source files#112

Merged
mohamedmansour merged 3 commits intomainfrom
copilot/add-license-header-to-source-files
Mar 16, 2026
Merged

chore: Add license header enforcement to all source files#112
mohamedmansour merged 3 commits intomainfrom
copilot/add-license-header-to-source-files

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

Every source file (.rs, .ts, .js, .cs, .h, .proto) must carry the Microsoft copyright header. No enforcement existed—this adds the check to cargo xtask check and mass-adds the header to all 157 existing files.

New: xtask/src/license_headers.rs

  • Iterative tree walker that checks every source file for the two-line header
  • check() fails with a list of non-compliant files; fix() prepends missing headers
  • Skips target/, node_modules/, dist/, obj/, bin/, .git/ and auto-generated files (webui_ffi.h)
  • 7 unit tests including a workspace-wide regression guard

cargo xtask check integration

  • LICENSE_HEADERS runs as the first step in the pipeline, before fmt
  • Standalone command: cargo xtask license-headers [--fix]
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

Copilot instructions update

  • Added "License header" section under code organization
  • Updated pipeline description, commands table, and acceptance checklist
Original prompt

This section details on the original issue you should resolve

<issue_title>Every file must have a license header</issue_title>
<issue_description>File Header. Include the following header in each source file.

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

And make sure the linter (cargo deny) verifies this in CI as well for example cargo xtask check should fail becuase it includes deny check.

We need to enforce .rs, cs, .h, .ts and any source file to have this file header</issue_description>

<agent_instructions>We need a recommended way to always have these file header, so include it in the custom instructions as well to enforce it, and cargo deny, but make sure other ones have it. You can exclude .html/.css/.json/.yml/.xml from this check.

and do a mass adding this header to all files. You can skip .html/.css/.json/.yml files.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI and others added 2 commits March 16, 2026 05:06
…ource files

Co-authored-by: mohamedmansour <68524+mohamedmansour@users.noreply.github.com>
…ries

Co-authored-by: mohamedmansour <68524+mohamedmansour@users.noreply.github.com>
Copilot AI changed the title [WIP] [ISSUE-123] Add license header to all source files Add license header enforcement to all source files Mar 16, 2026
Copilot AI requested a review from mohamedmansour March 16, 2026 05:15
@mohamedmansour mohamedmansour marked this pull request as ready for review March 16, 2026 05:18
@mohamedmansour mohamedmansour changed the title Add license header enforcement to all source files chore: Add license header enforcement to all source files Mar 16, 2026
@mohamedmansour mohamedmansour merged commit d14ee2f into main Mar 16, 2026
15 checks passed
@mohamedmansour mohamedmansour deleted the copilot/add-license-header-to-source-files branch March 16, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every file must have a license header

3 participants