doc/docchecker
changeset 43691 47ef023d0165
parent 41006 9bfbb9fc5871
child 45830 c102b704edb5
--- a/doc/docchecker	Sat Nov 16 11:59:22 2019 -0800
+++ b/doc/docchecker	Sat Nov 16 11:53:47 2019 -0800
@@ -15,6 +15,7 @@
 
 try:
     import msvcrt
+
     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
     msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
 except ImportError:
@@ -25,14 +26,18 @@
 leadingline = re.compile(br'(^\s*)(\S.*)$')
 
 checks = [
-  (br""":hg:`[^`]*'[^`]*`""",
-   b"""warning: please avoid nesting ' in :hg:`...`"""),
-  (br'\w:hg:`',
-   b'warning: please have a space before :hg:'),
-  (br"""(?:[^a-z][^'.])hg ([^,;"`]*'(?!hg)){2}""",
-   b'''warning: please use " instead of ' for hg ... "..."'''),
+    (
+        br""":hg:`[^`]*'[^`]*`""",
+        b"""warning: please avoid nesting ' in :hg:`...`""",
+    ),
+    (br'\w:hg:`', b'warning: please have a space before :hg:'),
+    (
+        br"""(?:[^a-z][^'.])hg ([^,;"`]*'(?!hg)){2}""",
+        b'''warning: please use " instead of ' for hg ... "..."''',
+    ),
 ]
 
+
 def check(line):
     messages = []
     for match, msg in checks:
@@ -43,6 +48,7 @@
         for msg in messages:
             stdout.write(b'%s\n' % msg)
 
+
 def work(file):
     (llead, lline) = (b'', b'')
 
@@ -55,8 +61,8 @@
             continue
 
         lead, line = match.group(1), match.group(2)
-        if (lead == llead):
-            if (lline != b''):
+        if lead == llead:
+            if lline != b'':
                 lline += b' ' + line
             else:
                 lline = line
@@ -65,6 +71,7 @@
             (llead, lline) = (lead, line)
     check(lline)
 
+
 def main():
     for f in sys.argv[1:]:
         try:
@@ -73,4 +80,5 @@
         except BaseException as e:
             sys.stdout.write(r"failed to process %s: %s\n" % (f, e))
 
+
 main()