Commit 27fbd33
The copyright header validation script (`Test-CopyrightHeaders.ps1`) was
silently skipping all files under `.github/` because:
1. **`Get-ChildItem` without `-Force`** did not enumerate dot-prefixed
directories (`.github/`, `.venv/`)
2. **Wildcard substring matching** for exclusions (`-like
"*$excludePath*"`) caused `.git` to inadvertently match `.github`,
`.gitter`, `.gitbook`, etc.
This PR fixes both root causes and adds SPDX/copyright headers to the 29
Python files that were missed.
### Changes
- **Centralized `$DefaultExcludePaths`** — Single source of truth for
default exclusions, referenced by both the script parameter and
`Invoke-CopyrightHeaderCheck`
- **Regex-based exclusion** — Replaced wildcard substring matching with
path-separator-anchored regex (`[/\\](?:name)(?:[/\\]|$)`), preventing
partial-prefix false matches
- **`-Force` on `Get-ChildItem`** — Ensures dot-prefixed directories are
enumerated
- **13 new Pester tests** — Exclusion logic boundary tests and AST-based
drift prevention tests
- **29 Python files** — Added `# Copyright (c) Microsoft Corporation.`
and `# SPDX-License-Identifier: MIT` headers
## Related Issue(s)
Fixes #1055
## Type of Change
Select all that apply:
**Code & Documentation:**
* [x] Bug fix (non-breaking change fixing an issue)
* [ ] New feature (non-breaking change adding functionality)
* [ ] Breaking change (fix or feature causing existing functionality to
change)
* [ ] Documentation update
**Infrastructure & Configuration:**
* [ ] GitHub Actions workflow
* [x] Linting configuration (markdown, PowerShell, etc.)
* [ ] Security configuration
* [ ] DevContainer configuration
* [ ] Dependency update
**AI Artifacts:**
* [ ] Reviewed contribution with `prompt-builder` agent and addressed
all feedback
* [ ] Copilot instructions (`.github/instructions/*.instructions.md`)
* [ ] Copilot prompt (`.github/prompts/*.prompt.md`)
* [ ] Copilot agent (`.github/agents/*.agent.md`)
* [ ] Copilot skill (`.github/skills/*/SKILL.md`)
**Other:**
* [x] Script/automation (`.ps1`, `.sh`, `.py`)
* [ ] Other (please describe):
## Testing
- **44 Pester tests passing** (31 existing + 13 new) covering:
- Individual exclusion validation (`.git`, `.venv`, `.copilot-tracking`,
`node_modules`)
- Partial-prefix safety (`.git` not matching `.github`, `.gitter`,
`.gitbook`)
- `-Force` enumeration of dot-directories
- Empty exclusions baseline, multiple simultaneous exclusions, deep
nesting, custom paths, overlapping extensions
- AST-based introspection verifying `$DefaultExcludePaths` contents and
function parameter default alignment
- **139/139 copyright headers passing** across all scanned files
- **0 PSScriptAnalyzer findings** on changed scripts
## Checklist
### Required Checks
* [x] Documentation is updated (if applicable)
* [x] Files follow existing naming conventions
* [x] Changes are backwards compatible (if applicable)
* [x] Tests added for new functionality (if applicable)
### Required Automated Checks
The following validation commands must pass before merging:
* [x] Markdown linting: `npm run lint:md`
* [x] Spell checking: `npm run spell-check`
* [x] Frontmatter validation: `npm run lint:frontmatter`
* [x] Skill structure validation: `npm run validate:skills`
(pre-existing warnings only — `.pytest_cache`, `.ruff_cache`, `.venv` in
powerpoint skill)
* [x] Link validation: `npm run lint:md-links` (0 broken links)
* [x] PowerShell analysis: `npm run lint:ps`
* [ ] Plugin freshness: `npm run plugin:generate` (no plugin changes in
this PR)
## Security Considerations
* [x] This PR does not contain any sensitive or NDA information
* [x] Any new dependencies have been reviewed for security issues
* [x] Security-related scripts follow the principle of least privilege
## Additional Notes
- Exclusion regex uses `[regex]::Escape()` on path names, preventing
regex injection from exclusion entries.
- The `-Force` fix was the primary root cause — without it,
`Get-ChildItem` silently skips `.github/skills/` on Windows.
---------
Co-authored-by: Katrien De Graeve <katriendg@users.noreply.github.com>
1 parent dec56ac commit 27fbd33
31 files changed
Lines changed: 278 additions & 15 deletions
File tree
- .github/skills/experimental/powerpoint
- scripts
- tests
- scripts
- linting
- tests/linting
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
0 commit comments