Перевод строки в .gitattributes и общий сторож docsguard@v0.9.0 - #18
Merged
Merged
Conversation
Строка "* text=auto eol=lf" хранит и выдаёт текстовые файлы с переводом строки, что бы ни стояло на машине. Ключ newline="" в генераторах на Python сюда не достаёт: он говорит о записи, а sync-docs.mjs вклеивает каталог инструментов со страницы в оба README побайтно. Индекс уже был на переводе строки, поэтому файлы не перенормализовались – git add --renormalize не дал ни одной правки.
В этом выпуске проверки исходников читают файл как utf-8-sig и больше не падают на метке порядка байтов: редакторы на Windows ставят её сами, а разбор через ast отвечал на неё SyntaxError и уносил находки по всем остальным файлам. Оттуда же приехал сторож затенённых тестов – тест под именем существующего занимает его место молча. Проверка подключена по каталогу python/tests и не нашла ни одного случая.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two repository-wide settings, both about a failure that only shows up on somebody else's machine.
.gitattributesThe repository had none.
* text=auto eol=lfstores and checks out every text file with linefeeds, 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.mjsreads a page and splices its tool catalogue intoREADME.mdanddocs/ru/README.ru.mdby copying bytes, through Node's API, on Windows. Whatever came in goes backout.
Renormalization turned out to be a no-op.
git add --renormalize .produced no changes, so theindex 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, frommainand from this branch:maingit statusThe clean status in both columns is the part worth keeping.
core.autocrlf=truetranslates back oncomparison, so a CRLF working tree never reaches
git status. It surfaces later, in the output ofa generator that copied those bytes.
docsguard@v0.9.0Two things arrive with the version.
The source checks now read a file as
utf-8-sig. Editors on Windows write a byte-order markwithout being asked,
ast.parseanswered it with aSyntaxError, and one such file left the wholecheck 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'sown
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 takesits 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 onefolder pytest collects from here; the
tests/at the root holds the Java suite and no Python atall. It found nothing: 13 files, no duplicate name in any namespace.
Both editions of
CONTRIBUTING.mdgain a "Naming a test" section beside the two conventions thatwere already written down there.
How it was verified
python -m pytest -qis 195 passed, 1 skipped, up from 192: the shadowed-test check, itsprovocation, and the byte-order-mark test.
python scripts/check_docs.pyis green,node scripts/sync-docs.mjsleaves the mirrors unchanged, and the purity scan reports nothing.🤖 Generated with Claude Code