doc8 reports unnecessary D002 and D004 on Windows line ending

Bug #1756704 reported by Lex Li
54
This bug affects 13 people
Affects Status Importance Assigned to Milestone
doc8
Confirmed
Undecided
Unassigned

Bug Description

It seems that such warnings come from Windows line ending `\r\n`,

'D002 Trailing whitespace'
'D004 Found literal carriage return'

doc8 should properly handle Windows line endings and do not report on such, because not all text files are of UNIX/Linux line ending `\n`.

(Linked to reStructuredText extension for VSCode https://github.com/vscode-restructuredtext/vscode-restructuredtext/issues/84)

Lex Li (lextm)
affects: manila → python-doc8 (Ubuntu)
description: updated
affects: python-doc8 (Ubuntu) → doc8
Lex Li (lextm)
description: updated
Revision history for this message
Mateusz Łoskot (mloskot) wrote :

I confirm this issue.

Revision history for this message
Laurent Garcin (laurent-garcin) wrote :

I also confirm this issue.

Revision history for this message
Rebecca Heineman (becky-e) wrote :

I confirm this issue. It's very troublesome since I do development primarily on a Windows box and all my text files are CR/LF (Although when I check out my files on macOS or Linux they are LF only), but this is quite annoying, especially in Visual Studio Code.

Revision history for this message
Deepak Maram (mskdeepak) wrote :

I can confirm this issue.

Changed in doc8:
status: New → Confirmed
Revision history for this message
Carlos Eduardo (silvacarlose) wrote :

I am also able to confirm this issue. I've worked it around in the following way:

1) Installed a linux subsystem in my Windows machine
2) Installed dos2unix
3) Ran dos2unix in ever single file I was having this issue

When I executed the docs generate command again all the issues disappeared.

More rerefence for docs2unix usage: https://www.computerhope.com/unix/dos2unix.htm

Revision history for this message
Adam Hendry (adamhendry) wrote :

+1 I can confirm this bug as well.

For VSCode, a temporary work around is to manually set line endings for `.rst` files to LF.

See: https://github.com/PyCQA/doc8/issues/78

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.