summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-06 10:16:30 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-06 13:22:08 +0100
commitc85d202a235a0b353c0f2bec3f02760f3643e52c (patch)
treea027aa33fc763bda95afd38afa7a4ac91f564b9c /script
parentdfb63cc1c365586a4c1e4bafd8b1bcbcf2bd455f (diff)
downloadpylint-git-c85d202a235a0b353c0f2bec3f02760f3643e52c.tar.gz
Remove all fmt off from the codebase
Diffstat (limited to 'script')
-rw-r--r--script/fix_documentation.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/script/fix_documentation.py b/script/fix_documentation.py
index f83327ec3..b83e4f3ec 100644
--- a/script/fix_documentation.py
+++ b/script/fix_documentation.py
@@ -1,11 +1,13 @@
"""Small script to fix various issues with the documentation. Used by pre-commit."""
-# fmt: off
+
import argparse
import re
import sys
from typing import List, Union
-INVALID_CODE_BLOCK_PATTERN = r"(?<=\s`)([\w\-\.\(\)\=]+\s{0,1}[\w\-\.\(\)\=]*)(?=`[,\.]{0,1}\s|$)"
+INVALID_CODE_BLOCK_PATTERN = (
+ r"(?<=\s`)([\w\-\.\(\)\=]+\s{0,1}[\w\-\.\(\)\=]*)(?=`[,\.]{0,1}\s|$)"
+)
FILE_CHANGELOG = "ChangeLog"
CHANGELOG_WHATS_NEW_PREFIX = "What's New in Pylint"
@@ -23,25 +25,24 @@ def fix_inline_code_blocks(file_content: str) -> str:
def changelog_insert_empty_lines(file_content: str) -> str:
"""Insert up to two empty lines before `What's New` entry in ChangeLog"""
- lines = file_content.split('\n')
+ lines = file_content.split("\n")
version_count = 0
for i, line in enumerate(lines):
if line.startswith(CHANGELOG_WHATS_NEW_PREFIX):
version_count += 1
- if (
- version_count == 1 or i < 2
- or lines[i - 1] == '' and lines[i - 2] == ''
- ):
+ if version_count == 1 or i < 2 or lines[i - 1] == "" and lines[i - 2] == "":
continue
- lines.insert(i, '')
- return '\n'.join(lines)
+ lines.insert(i, "")
+ return "\n".join(lines)
def main(argv: Union[List[str], None] = None) -> int:
argv = argv or sys.argv[1:]
parser = argparse.ArgumentParser()
parser.add_argument(
- "filenames", nargs="*", metavar="FILES",
+ "filenames",
+ nargs="*",
+ metavar="FILES",
help="File names to modify",
)
args = parser.parse_args(argv)