Repository: sphinx-contrib/sphinx-lint

Issue:
Invalid markup after a table is not detected
`sphinx-lint` does not report invalid reST markup after a table, for example:
```
+--------------+----------+-----------+-----------+
| row 1, col 1 | column 2 | column 3  | column 4  |
+--------------+----------+-----------+-----------+
| row 2        |          |           |           |
+--------------+----------+-----------+-----------+

:role:`foo
```

This seems to be caused by the `return` statement in the table detection logic (https://github.com/sphinx-contrib/sphinx-lint/blob/main/sphinxlint/checkers.py#L58).
Changing `return` to `continue` should fix this issue.

Hints from issue comments:
@hugovk: Good find, would you like to put together a PR with tests to fix this? @koyuki7w: @hugovk Thanks, I opened the PR.

Solution patch:
diff --git a/sphinxlint/checkers.py b/sphinxlint/checkers.py
index 1844697..05afe35 100644
--- a/sphinxlint/checkers.py
+++ b/sphinxlint/checkers.py
@@ -55,7 +55,7 @@ def check_missing_backtick_after_role(file, lines, options=None):
     """
     for paragraph_lno, paragraph in paragraphs(lines):
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         for error in rst.ROLE_MISSING_CLOSING_BACKTICK_RE.finditer(paragraph):
             error_offset = paragraph[: error.start()].count("\n")
             yield (
@@ -77,7 +77,7 @@ def check_missing_space_after_literal(file, lines, options=None):
     """
     for paragraph_lno, paragraph in paragraphs(lines):
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         paragraph = clean_paragraph(paragraph)
         for role in _RST_ROLE_RE.finditer(paragraph):
             if not _END_STRING_SUFFIX_RE.match(role[0][-1]):
@@ -101,7 +101,7 @@ def check_unbalanced_inline_literals_delimiters(file, lines, options=None):
     """
     for paragraph_lno, paragraph in paragraphs(lines):
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         paragraph = clean_paragraph(paragraph)
         for lone_double_backtick in _LONE_DOUBLE_BACKTICK_RE.finditer(paragraph):
             error_offset = paragraph[: lone_double_backtick.start()].count("\n")
@@ -135,7 +135,7 @@ def check_default_role(file, lines, options=None):
                 and stripped_line.count("|") >= 4
                 and "|" in match.group(0)
             ):
-                return  # we don't handle tables yet.
+                continue  # we don't handle tables yet.
             if _ends_with_role_tag(before_match):
                 # It's not a default role: it ends with a tag.
                 continue
@@ -279,7 +279,7 @@ def check_role_with_double_backticks(file, lines, options=None):
         if "`" not in paragraph:
             continue
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         paragraph = escape2null(paragraph)
         while True:
             inline_literal = min(
@@ -310,7 +310,7 @@ def check_missing_space_before_role(file, lines, options=None):
     """
     for paragraph_lno, paragraph in paragraphs(lines):
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         paragraph = clean_paragraph(paragraph)
         for match in rst.ROLE_GLUED_WITH_WORD_RE.finditer(paragraph):
             error_offset = paragraph[: match.start()].count("\n")
@@ -335,7 +335,7 @@ def check_missing_space_before_default_role(file, lines, options=None):
     """
     for paragraph_lno, paragraph in paragraphs(lines):
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         paragraph = clean_paragraph(paragraph)
         paragraph = rst.INTERPRETED_TEXT_RE.sub("", paragraph)
         for role in rst.inline_markup_gen(
@@ -361,7 +361,7 @@ def check_hyperlink_reference_missing_backtick(file, lines, options=None):
     """
     for paragraph_lno, paragraph in paragraphs(lines):
         if paragraph.count("|") > 4:
-            return  # we don't handle tables yet.
+            continue  # we don't handle tables yet.
         paragraph = clean_paragraph(paragraph)
         paragraph = rst.INTERPRETED_TEXT_RE.sub("", paragraph)
         for hyperlink_reference in _HYPERLINK_REFERENCE_RE.finditer(paragraph):


Test patch:
diff --git a/tests/fixtures/xfail/missing-backtick-after-role-after-table.rst b/tests/fixtures/xfail/missing-backtick-after-role-after-table.rst
new file mode 100644
index 0000000..fc5b0ae
--- /dev/null
+++ b/tests/fixtures/xfail/missing-backtick-after-role-after-table.rst
@@ -0,0 +1,9 @@
+.. expect: role missing closing backtick: ':role:`foo\n' (missing-backtick-after-role)
+
++--------------+----------+-----------+-----------+
+| row 1, col 1 | column 2 | column 3  | column 4  |
++--------------+----------+-----------+-----------+
+| :role:`bar   |          |           |           |
++--------------+----------+-----------+-----------+
+
+:role:`foo