openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

[codex] Enforce LF line endings for text checkouts

Open Felyx-Fu opened this issue 6 months ago • 2 comments

Summary

  • Enforces LF checkout for repository text files by adding a default * text=auto eol=lf rule to .gitattributes.
  • Keeps existing explicit overrides, including .ps1 text eol=crlf, so Windows PowerShell scripts retain CRLF line endings.
  • Prevents clean Windows checkouts with global core.autocrlf=true from failing Prettier solely because app files are checked out with CRLF.

Problem

On Windows, a clean checkout can inherit the user's global Git setting core.autocrlf=true. The repo's Prettier config requires endOfLine: "lf", but .gitattributes only forced LF for shell/Docker/YAML files. As a result, pnpm format:check reported style issues in 1000+ app files before any contributor changes were made.

Solution

Add a repository-wide text default in .gitattributes so text files are checked out with LF regardless of the contributor's global autocrlf setting. Existing file-specific rules remain in place and continue to override the default where needed.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • [x] Tests added or updated — N/A: .gitattributes-only checkout metadata change; no runtime code path changed.
  • [x] Diff coverage ≥ 80% — N/A: no executable lines changed.
  • [x] Coverage matrix updated — N/A: no feature rows added, removed, or renamed.
  • [x] All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no feature IDs affected.
  • [x] No new external network dependencies introduced.
  • [x] Manual smoke checklist updated if this touches release-cut surfaces — N/A: contributor checkout metadata only.
  • [x] Linked issue closed via Closes #NNN in the ## Related section — N/A: no matching open issue found.

Impact

  • Developer workflow only.
  • Fresh Windows checkouts should now keep app text files LF-compatible with Prettier while preserving CRLF for PowerShell scripts.
  • No runtime, packaging, network, or migration impact.

Related

  • Closes: N/A
  • Follow-up PR(s)/TODOs: None

AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: codex/windows-lf-gitattributes
  • Commit SHA: 5fc2486d

Validation Run

  • [x] pnpm format:check — passed, including Prettier and Rust fmt checks.
  • [x] pnpm typecheck — passed.
  • [x] pnpm rust:check — passed on Windows after completing the local Rust/MSVC/CMake/Ninja/Clang toolchain; user-level CL=/utf-8 is set so CEF headers compile under code page 936.
  • [x] Focused tests: N/A, no runtime code changed.
  • [x] Tauri fmt/check (if changed): N/A, no Tauri source files changed; pnpm rust:check passed as a toolchain smoke check.

Additional validation:

  • [x] pnpm lint — passed with 46 existing warnings and 0 errors.
  • [x] git diff --cached --check — passed before commit.
  • [x] git check-attr eol text -- app/src/App.tsx app/package.json app/.prettierrc README.md .gitattributes scripts/install.ps1 scripts/install.sh — app text files resolve to eol=lf; scripts/install.ps1 remains eol=crlf.
  • [x] Temporary clone with core.autocrlf=true confirmed app/src/App.tsx, app/package.json, README.md, .gitattributes, and scripts/install.sh have no CRLF; scripts/install.ps1 retains CRLF.

Validation Blocked

  • None.

Behavior Changes

  • Intended behavior change: Fresh checkouts normalize text files to LF regardless of global Git autocrlf settings.
  • User-visible effect: Windows contributors should no longer see Prettier fail on a clean checkout due only to CRLF line endings.

Parity Contract

  • Legacy behavior preserved: Existing .ps1, .sh, Docker, and docker-compose line-ending rules are preserved.
  • Guard/fallback/dispatch parity checks: N/A, no runtime guard or dispatch behavior changed.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): None found for Windows/Prettier/autocrlf line-ending fix.
  • Canonical PR: This PR.
  • Resolution (closed/superseded/updated): N/A

Felyx-Fu avatar May 24 '26 09:05 Felyx-Fu

📝 Walkthrough

Walkthrough

This PR adds a global .gitattributes rule to apply text and LF line-ending normalization to all files in the repository. The rule uses text=auto for automatic text file detection and eol=lf to enforce Unix-style line endings.

Changes

Line Ending Normalization

Layer / File(s) Summary
Global text and LF configuration
.gitattributes
A catch-all .gitattributes rule is added with * text=auto eol=lf to mark all unmatched files as text and normalize line endings to LF across the repository.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • tinyhumansai/openhuman#2545: Also modifies .gitattributes to enforce LF line endings, adding file-pattern-specific rules alongside this global normalization approach.

Poem

🐰 A rabbit hops through line-ending lands,
Where eol=lf stands firm and clear—
No carriage returns, just Unix-clean strands,
All files aligned, no diff-chaos here! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly summarizes the main change: enforcing LF line endings for text file checkouts via .gitattributes configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 24 '26 09:05 coderabbitai[bot]

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan? Reviews resume once this user has a paid seat and their Git account is linked in Qodo. Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? These require an Enterprise plan - Contact us Contact us →

qodo-code-review[bot] avatar May 24 '26 10:05 qodo-code-review[bot]

simple yet elegant :)

senamakel avatar May 25 '26 04:05 senamakel