Skip to content

Commit 9c44ab7

Browse files
[doc] Remove trailing line feeds in generated RSTs
1 parent 54c6ec3 commit 9c44ab7

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

doc/exts/pylint_extensions.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,16 @@ def builder_inited(app: Optional[Sphinx]) -> None:
7474

7575
# Print checker documentation to stream
7676
by_checker = get_plugins_info(linter, doc_files)
77-
for checker, information in sorted(by_checker.items()):
77+
max_len = len(by_checker)
78+
for i, checker_information in enumerate(sorted(by_checker.items())):
79+
checker, information = checker_information
80+
j = -1
7881
checker = information["checker"]
7982
del information["checker"]
80-
print(checker.get_full_documentation(**information)[:-1], file=stream)
83+
if i == max_len - 1:
84+
# Remove the \n\n at the end of the file
85+
j = -3
86+
print(checker.get_full_documentation(**information)[:j], file=stream)
8187

8288

8389
def get_plugins_info(linter, doc_files):

doc/exts/pylint_options.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ def _write_options_page(options: OptionsDataDict, linter: PyLinter) -> None:
156156
stream.write(
157157
f"""
158158
159-
{sections_string}
160-
"""
159+
{sections_string}"""
161160
)
162161

163162

doc/user_guide/checkers/extensions.rst

-2
Original file line numberDiff line numberDiff line change
@@ -712,5 +712,3 @@ While Used checker Messages
712712
^^^^^^^^^^^^^^^^^^^^^^^^^^^
713713
:while-used (W0149): *Used `while` loop*
714714
Unbounded `while` loops can often be rewritten as bounded `for` loops.
715-
716-

doc/user_guide/checkers/features.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1860,5 +1860,3 @@ Variables checker Messages
18601860
:global-at-module-level (W0604): *Using the global statement at the module level*
18611861
Used when you use the "global" statement at the module level since it has no
18621862
effect
1863-
1864-

pylint/utils/docs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ def _get_checkers_documentation(linter: PyLinter) -> str:
8686

8787
def print_full_documentation(linter: PyLinter, stream: TextIO = sys.stdout) -> None:
8888
"""Output a full documentation in ReST format."""
89-
print(_get_checkers_documentation(linter)[:-1], file=stream)
89+
print(_get_checkers_documentation(linter)[:-3], file=stream)

0 commit comments

Comments
 (0)