Patchwork [8,of,9] docchecker: use indentation of 4 spaces

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Feb. 10, 2016, 1:58 p.m.
Message ID <f17178eff48f064225d8.1455112726@feefifofum>
Download mbox | patch
Permalink /patch/13096/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Katsunori FUJIWARA - Feb. 10, 2016, 1:58 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1455111869 -32400
#      Wed Feb 10 22:44:29 2016 +0900
# Node ID f17178eff48f064225d89a7eb351220b6ccd1ef0
# Parent  4606840cefadab8f4730eee3c6ccda8185168dbc
docchecker: use indentation of 4 spaces

This is fixing for 'must indent 4 spaces' check-code rule.

check-code has overlooked this, because a file isn't recognized as one
to be checked (this problem is fixed by subsequent patch).

Patch

diff --git a/doc/docchecker b/doc/docchecker
--- a/doc/docchecker
+++ b/doc/docchecker
@@ -14,41 +14,41 @@  hg_backtick = re.compile(r""":hg:`[^`]*'
 hg_cramped = re.compile(r'\w:hg:`')
 
 def check(line):
-  if hg_backtick.search(line):
-    print(line)
-    print("""warning: please avoid nesting ' in :hg:`...`""")
-  if hg_cramped.search(line):
-    print(line)
-    print('warning: please have a space before :hg:')
+    if hg_backtick.search(line):
+        print(line)
+        print("""warning: please avoid nesting ' in :hg:`...`""")
+    if hg_cramped.search(line):
+        print(line)
+        print('warning: please have a space before :hg:')
 
 def work(file):
-  (llead, lline) = ('', '')
+    (llead, lline) = ('', '')
 
-  for line in file:
-    # this section unwraps lines
-    match = leadingline.match(line)
-    if not match:
-      check(lline)
-      (llead, lline) = ('', '')
-      continue
+    for line in file:
+        # this section unwraps lines
+        match = leadingline.match(line)
+        if not match:
+            check(lline)
+            (llead, lline) = ('', '')
+            continue
 
-    lead, line = match.group(1), match.group(2)
-    if (lead == llead):
-      if (lline != ''):
-        lline += ' ' + line
-      else:
-        lline = line
-    else:
-      check(lline)
-      (llead, lline) = (lead, line)
-  check(lline)
+        lead, line = match.group(1), match.group(2)
+        if (lead == llead):
+            if (lline != ''):
+                lline += ' ' + line
+            else:
+                lline = line
+        else:
+            check(lline)
+            (llead, lline) = (lead, line)
+    check(lline)
 
 def main():
-  for f in sys.argv[1:]:
-    try:
-      with open(f) as file:
-        work(file)
-    except BaseException as e:
-      print("failed to process %s: %s" % (f, e))
+    for f in sys.argv[1:]:
+        try:
+            with open(f) as file:
+                work(file)
+        except BaseException as e:
+            print("failed to process %s: %s" % (f, e))
 
 main()