Summary
Gitignore pattern matching fails in Linux dev container environments because Get-GitIgnorePatterns uses hardcoded Windows backslash (\) separators instead of platform-appropriate separators.
Problem
When running Validate-MarkdownFrontmatter.ps1 in the Ubuntu-based dev container, gitignore patterns like node_modules/ are converted to *\node_modules\* which never matches Linux file paths like /workspace/node_modules/....
Root Cause
Get-GitIgnorePatterns in LintingHelpers.psm1 hardcodes backslash separators
- PowerShell's
-like operator performs literal string matching
- Linux paths use forward slashes, so patterns with backslashes never match
Solution
- Use
[System.IO.Path]::DirectorySeparatorChar for platform detection
- Normalize input patterns by replacing both
/ and \ with the platform separator
- Refactor
Validate-MarkdownFrontmatter.ps1 to use the shared helper function (DRY principle)
Files Affected
scripts/linting/Modules/LintingHelpers.psm1 - Update Get-GitIgnorePatterns function
scripts/linting/Validate-MarkdownFrontmatter.ps1 - Replace inline parsing with shared function call
Acceptance Criteria
Summary
Gitignore pattern matching fails in Linux dev container environments because
Get-GitIgnorePatternsuses hardcoded Windows backslash (\) separators instead of platform-appropriate separators.Problem
When running
Validate-MarkdownFrontmatter.ps1in the Ubuntu-based dev container, gitignore patterns likenode_modules/are converted to*\node_modules\*which never matches Linux file paths like/workspace/node_modules/....Root Cause
Get-GitIgnorePatternsinLintingHelpers.psm1hardcodes backslash separators-likeoperator performs literal string matchingSolution
[System.IO.Path]::DirectorySeparatorCharfor platform detection/and\with the platform separatorValidate-MarkdownFrontmatter.ps1to use the shared helper function (DRY principle)Files Affected
scripts/linting/Modules/LintingHelpers.psm1- UpdateGet-GitIgnorePatternsfunctionscripts/linting/Validate-MarkdownFrontmatter.ps1- Replace inline parsing with shared function callAcceptance Criteria
node_modules/directory is properly excluded when running in Linux dev container