Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _txt_checker(self, parsed_file):
for i, line in enumerate(parsed_file.lines_iter()):
if len(line) > self._max_line_length:
if not utils.contains_url(line):
yield (i + 1, "D001", "Line too long")
docutils_nodes.section,
)
for i, line in enumerate(lines):
if len(line) > self._max_line_length:
in_directive = False
for (start, end) in directives:
if i >= start and i <= end:
in_directive = True
break
if in_directive:
continue
stripped = line.lstrip()
if " " not in stripped:
# No room to split even if we could.
continue
if utils.contains_url(stripped):
continue
nodes = find_containing_nodes(i + 1)
if any_types(nodes, skip_types):
continue
if self._allow_long_titles and any_types(nodes, title_types):
continue
yield (i + 1, "D001", "Line too long")