Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent D004 false positive for windows users #144

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/doc8/checks.py
Expand Up @@ -61,11 +61,13 @@ def report_iter(self, line):


class CheckCarriageReturn(ContentCheck):
_CARRIAGE_RETURN_REGEX = re.compile(rb"\r(?!\n)")
REPORTS = frozenset(["D004"])

def report_iter(self, parsed_file):
for i, line in enumerate(parsed_file.lines):
if b"\r" in line:
matches = self._CARRIAGE_RETURN_REGEX.findall(line)
if len(matches) != 0:
yield (i + 1, "D004", "Found literal carriage return")


Expand Down