chore(build): normalize PlatyPS-generated doc line endings to LF#45
chore(build): normalize PlatyPS-generated doc line endings to LF#45tablackburn wants to merge 2 commits into
Conversation
PowerShellBuild's BUILDHELP task invokes PlatyPS, which writes docs/en-US/*.md with CRLF on Windows. That contradicts the repo's .gitattributes (`* text=auto eol=lf`) and dirties git status after every local build with 28 phantom "modifications" (line-ending only, no content change). Two-layer prevention: 1. Build-time fix (`NormalizeDocsLineEndings` psake task): runs after BUILDHELP, rewrites any CRLF in docs/**/*.md to LF using UTF-8 without BOM. UnitTest and ScriptAnalysis now depend on this task instead of Build directly, so it always runs in the standard chain. Verified locally: 28 CRLF files were normalized to 0 after a `./build.ps1 UnitTest` run. 2. Pre-commit safety net (`mixed-line-ending --fix=lf` from pre-commit-hooks): catches CRLF from any other source — editors, ad-hoc tooling, future tasks — before it reaches the index. .gitattributes alone only acts at git operations and can't stop a tool from writing CRLF into the working tree between operations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughPre-commit hook and build task are added to enforce consistent LF line endings. The pre-commit hook auto-fixes mixed line endings during commits, while a new build task normalizes documentation markdown files from CRLF to LF before tests and analysis execute. ChangesLine Ending Normalization
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds two-layer protection against CRLF line endings being introduced into the repo by PlatyPS doc generation: a psake build task that normalizes docs/**/*.md to LF after Build, and a pre-commit hook as a safety net.
Changes:
- New
NormalizeDocsLineEndingspsake task runs afterBuildand rewrites CRLF to LF (UTF-8 no BOM), only touching files that actually changed. - Reroutes
UnitTestandScriptAnalysisto depend on the new task instead ofBuilddirectly. - Adds
pre-commit/pre-commit-hooksmixed-line-ending --fix=lfhook at v5.0.0.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| build.psake.ps1 | Adds NormalizeDocsLineEndings task and re-points UnitTest/ScriptAnalysis dependencies to it. |
| .pre-commit-config.yaml | Adds mixed-line-ending hook from pre-commit-hooks v5.0.0 as a safety net. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Style nit (non-blocking): |
The single-arg named-parameter variant is the over-application pattern agreed to revert across the JsmOps#9 / YTMP#23 / Plex#55 / ReScene#18 propagation — the rule scopes to 2+ args. Fixed before this pattern lands in the template and gets copied to the other PowerShellBuild + PlatyPS consumers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
PowerShellBuild's
BUILDHELPtask invokes PlatyPS, which writesdocs/en-US/*.mdwith CRLF on Windows. That contradicts the repo's.gitattributes(* text=auto eol=lf, pinned in #34) and dirtiesgit statusafter every local build with 28 phantom "modifications" — line-ending only, zero content change.This PR adds two-layer prevention.
Changes
Layer 1 — build-time fix (
build.psake.ps1)New
NormalizeDocsLineEndingspsake task that runs afterBuild:docs/**/*.md, rewrites any CRLF to LF using UTF-8 without BOM.UnitTestandScriptAnalysisnow depend onNormalizeDocsLineEndingsinstead ofBuilddirectly, so it always runs in the standard chain.Layer 2 — pre-commit safety net (
.pre-commit-config.yaml)Adds
mixed-line-ending --fix=lffrompre-commit/pre-commit-hooks:.gitattributesalone only acts at git operations and can't stop a tool from writing CRLF into the working tree between operations. This is the safety net.Verification
Layer 1 — local
./build.ps1 UnitTestrun:Post-build check: 28 files LF-only, 0 with CRLF,
git status docs/clean.Layer 2 — verified live on this PR's commit:
The pre-commit hook ran during the commit itself:
Test plan
./build.ps1 -Task UnitTest— 1423 pass, 0 fail, NormalizeDocsLineEndings reportsNormalized 28 doc file(s) to LFgit statusclean after build (no phantom doc modifications)pre-commit.ciconfirmsmixed-line-endinghook is validNotes
./build.ps1run during that work re-dirtied 28 docs ingit status.🤖 Generated with Claude Code
Summary by CodeRabbit