Skip to content

chore: one line ending for the repository (.gitattributes + renormalize + enforcing test) - #38

Merged
xtimmy86x merged 1 commit into
OpenWebNet-HA:masterfrom
GreenGrassBlueOcean:chore/normalize-line-endings
Sep 16, 2026
Merged

xtimmy86x merged 1 commit into
OpenWebNet-HA:masterfrom
GreenGrassBlueOcean:chore/normalize-line-endings

Conversation

@GreenGrassBlueOcean

@GreenGrassBlueOcean GreenGrassBlueOcean commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Why

master stores five files with CRLF — .gitignore, LICENSE, OWNd/__main__.py, connection.py, message.py — next to an LF majority, and connection.py is mixed within the file. Any edit from a differently configured editor rewrites the whole file: #35 rendered as +248/−218 for a +38/−8 change and #36 as +691/−615 for +324/−248, and a reviewer passed on both for that reason. #35 flattened connection.py to CRLF, #36 flattened discovery.py to LF — each PR picked a different answer because the repo never gave one.

What — one commit, 6c47364

  • .gitattributes: * text=auto eol=lf; CRLF kept for *.bat / *.cmd / *.ps1; binaries listed.
  • git add --renormalize . — the five files, line endings only. git diff --ignore-cr-at-eol against its parent shows nothing but the two new files and one line in validate_corpus.py.
  • tests/test_line_endings.py — fails the suite if any tracked text file contains a CR, so a file that bypasses the clean filter is caught by CI, not by the next reviewer.
  • That test caught one immediately: tools/golden/validate_corpus.py rewrote tests/golden/corpus.json with the platform newline on every suite run, so every Windows checkout that ran the tests had a CRLF corpus.json sitting in its working tree ready to be committed. It now writes newline="\n".

632 tests (631 + the new one), ruff clean, mypy --strict clean. Run twice in a row on Windows: the tree stays clean.

Merge order — either works

This branch is master + the four commits of #39 + this one, so:

Nothing else needs to rebase either way. Any branch opened before this lands picks it up with git -c merge.renormalize=true rebase master — the three-way merge then compares normalised content and the line-ending change never conflicts with real edits.

🤖 Generated with Claude Code

@GreenGrassBlueOcean
GreenGrassBlueOcean marked this pull request as draft September 16, 2026 13:06
@GreenGrassBlueOcean
GreenGrassBlueOcean force-pushed the chore/normalize-line-endings branch from 8034c59 to 6c47364 Compare September 16, 2026 14:02
@GreenGrassBlueOcean GreenGrassBlueOcean changed the title chore: one line ending for the repository (.gitattributes + renormalize) — lands after #36 chore: one line ending for the repository (.gitattributes + renormalize + enforcing test) Sep 16, 2026
@GreenGrassBlueOcean
GreenGrassBlueOcean marked this pull request as ready for review September 16, 2026 14:02
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

xtimmy86x
xtimmy86x previously approved these changes Sep 16, 2026
@GreenGrassBlueOcean
GreenGrassBlueOcean dismissed xtimmy86x’s stale review September 16, 2026 16:09

The merge-base changed after approval.

@xtimmy86x

Copy link
Copy Markdown
Contributor

@GreenGrassBlueOcean you have to update to latest master for approval

…e, test)

master stored five files with CRLF - .gitignore, LICENSE, __main__.py,
connection.py, message.py - next to an LF majority, and connection.py
mixed the two within the file. Any edit from a differently configured
editor then rewrote the whole file: OpenWebNet-HA#35 rendered as +248/-218 for a
+38/-8 change, OpenWebNet-HA#36 as +691/-615 for +324/-248, and a reviewer passed
on both for that reason.

`* text=auto eol=lf`, `git add --renormalize .`, and
tests/test_line_endings.py so a CR that bypasses the clean filter fails
the suite instead of the next reviewer. That test found one such path
straight away: validate_corpus.py rewrote tests/golden/corpus.json with
the platform newline on every run, so any Windows checkout that ran the
suite had a CRLF corpus.json waiting to be committed. It now writes LF.

Every byte other than line endings is unchanged: `git diff
--ignore-cr-at-eol` shows only the two new files and the one-line
newline argument.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@GreenGrassBlueOcean
GreenGrassBlueOcean force-pushed the chore/normalize-line-endings branch from 6c47364 to a89badb Compare September 16, 2026 16:21
@GreenGrassBlueOcean

Copy link
Copy Markdown
Contributor Author

I have rebased the PR on the latest master. It should be good to go!

@xtimmy86x
xtimmy86x merged commit f473822 into OpenWebNet-HA:master Sep 16, 2026
6 checks passed
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.

3 participants