Skip to content

Перевод строки в .gitattributes и общий сторож docsguard@v0.9.0 - #18

Merged
keyfire merged 3 commits into
mainfrom
chore/line-endings-and-guard
Sep 12, 2026
Merged

keyfire merged 3 commits into
mainfrom
chore/line-endings-and-guard

Conversation

@keyfire

@keyfire keyfire commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Two repository-wide settings, both about a failure that only shows up on somebody else's machine.

.gitattributes

The repository had none. * text=auto eol=lf stores and checks out every text file with line
feeds, whatever the machine is set to.

newline="" in the Python generators already covered the writes, and the writes are all it covers.
scripts/sync-docs.mjs reads a page and splices its tool catalogue into README.md and
docs/ru/README.ru.md by copying bytes, through Node's API, on Windows. Whatever came in goes back
out.

Renormalization turned out to be a no-op. git add --renormalize . produced no changes, so the
index was already on line feeds, and the first commit carries the file and its changelog entry and
nothing else. The binaries are named explicitly below the line: *.png, *.jpg, *.ico,
*.woff2, *.jar, *.zip. Only pictures, fonts and the release jar are in the repository today;
the other three are named before the first such file arrives.

The control run

A clone made with core.autocrlf=true, from main and from this branch:

main this branch
text files with CRLF in the working tree 214 0
the 11 binaries untouched untouched, byte-identical
git status clean clean

The clean status in both columns is the part worth keeping. core.autocrlf=true translates back on
comparison, so a CRLF working tree never reaches git status. It surfaces later, in the output of
a generator that copied those bytes.

docsguard@v0.9.0

Two things arrive with the version.

The source checks now read a file as utf-8-sig. Editors on Windows write a byte-order mark
without being asked, ast.parse answered it with a SyntaxError, and one such file left the whole
check with no findings from any file at all. A new test provokes the installed package with a
marked source, so a pin that stops covering this stops the suite instead of going quiet. The two
reader tests were parsing with path.read_text(encoding="utf-8") and now go through the package's
own read_text, which is the reader that handles the mark.

The second is shadowed_test_problems. A test that arrives under the name of an existing one takes
its place: Python keeps the last definition, pytest collects what the module ended up with, and the
number of tests goes up, because the newcomer was added. It is wired to python/tests, the one
folder pytest collects from here; the tests/ at the root holds the Java suite and no Python at
all. It found nothing: 13 files, no duplicate name in any namespace.

Both editions of CONTRIBUTING.md gain a "Naming a test" section beside the two conventions that
were already written down there.

How it was verified

python -m pytest -q is 195 passed, 1 skipped, up from 192: the shadowed-test check, its
provocation, and the byte-order-mark test. python scripts/check_docs.py is green,
node scripts/sync-docs.mjs leaves the mirrors unchanged, and the purity scan reports nothing.

🤖 Generated with Claude Code

Строка "* text=auto eol=lf" хранит и выдаёт текстовые файлы с переводом
строки, что бы ни стояло на машине. Ключ newline="" в генераторах на Python
сюда не достаёт: он говорит о записи, а sync-docs.mjs вклеивает каталог
инструментов со страницы в оба README побайтно. Индекс уже был на переводе
строки, поэтому файлы не перенормализовались – git add --renormalize не дал
ни одной правки.
В этом выпуске проверки исходников читают файл как utf-8-sig и больше не
падают на метке порядка байтов: редакторы на Windows ставят её сами, а
разбор через ast отвечал на неё SyntaxError и уносил находки по всем
остальным файлам. Оттуда же приехал сторож затенённых тестов – тест под
именем существующего занимает его место молча. Проверка подключена по
каталогу python/tests и не нашла ни одного случая.
@keyfire
keyfire merged commit e170bd9 into main Sep 12, 2026
6 checks passed
@keyfire
keyfire deleted the chore/line-endings-and-guard branch September 12, 2026 07:16
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.

1 participant