##// END OF EJS Templates
doc: don't pass str to ui methods in check-seclevel.py
Matt Harbison -
r50691:98e7be1e default
parent child Browse files
Show More
@@ -42,7 +42,7 b' cd `hg root`'
42
42
43 # TODO: include hgext and hgext3rd
43 # TODO: include hgext and hgext3rd
44
44
45 pytype -V 3.7 --keep-going --jobs auto mercurial \
45 pytype -V 3.7 --keep-going --jobs auto doc/check-seclevel.py mercurial \
46 -x mercurial/bundlerepo.py \
46 -x mercurial/bundlerepo.py \
47 -x mercurial/context.py \
47 -x mercurial/context.py \
48 -x mercurial/crecord.py \
48 -x mercurial/crecord.py \
@@ -46,7 +46,7 b' def showavailables(ui, initlevel):'
46
46
47
47
48 def checkseclevel(ui, doc, name, initlevel):
48 def checkseclevel(ui, doc, name, initlevel):
49 ui.notenoi18n('checking "%s"\n' % name)
49 ui.notenoi18n(('checking "%s"\n' % name).encode('utf-8'))
50 if not isinstance(doc, bytes):
50 if not isinstance(doc, bytes):
51 doc = doc.encode('utf-8')
51 doc = doc.encode('utf-8')
52 blocks, pruned = minirst.parse(doc, 0, ['verbose'])
52 blocks, pruned = minirst.parse(doc, 0, ['verbose'])
@@ -70,14 +70,18 b' def checkseclevel(ui, doc, name, initlev'
70 nextlevel = mark2level[mark]
70 nextlevel = mark2level[mark]
71 if curlevel < nextlevel and curlevel + 1 != nextlevel:
71 if curlevel < nextlevel and curlevel + 1 != nextlevel:
72 ui.warnnoi18n(
72 ui.warnnoi18n(
73 'gap of section level at "%s" of %s\n' % (title, name)
73 ('gap of section level at "%s" of %s\n' % (title, name)).encode(
74 'utf-8'
75 )
74 )
76 )
75 showavailables(ui, initlevel)
77 showavailables(ui, initlevel)
76 errorcnt += 1
78 errorcnt += 1
77 continue
79 continue
78 ui.notenoi18n(
80 ui.notenoi18n(
79 'appropriate section level for "%s %s"\n'
81 (
80 % (mark * (nextlevel * 2), title)
82 'appropriate section level for "%s %s"\n'
83 % (mark * (nextlevel * 2), title)
84 ).encode('utf-8')
81 )
85 )
82 curlevel = nextlevel
86 curlevel = nextlevel
83
87
@@ -90,7 +94,9 b' def checkcmdtable(ui, cmdtable, namefmt,'
90 name = k.split(b"|")[0].lstrip(b"^")
94 name = k.split(b"|")[0].lstrip(b"^")
91 if not entry[0].__doc__:
95 if not entry[0].__doc__:
92 ui.notenoi18n(
96 ui.notenoi18n(
93 'skip checking %s: no help document\n' % (namefmt % name)
97 (
98 'skip checking %s: no help document\n' % (namefmt % name)
99 ).encode('utf-8')
94 )
100 )
95 continue
101 continue
96 errorcnt += checkseclevel(
102 errorcnt += checkseclevel(
@@ -117,7 +123,9 b' def checkhghelps(ui):'
117 mod = extensions.load(ui, name, None)
123 mod = extensions.load(ui, name, None)
118 if not mod.__doc__:
124 if not mod.__doc__:
119 ui.notenoi18n(
125 ui.notenoi18n(
120 'skip checking %s extension: no help document\n' % name
126 (
127 'skip checking %s extension: no help document\n' % name
128 ).encode('utf-8')
121 )
129 )
122 continue
130 continue
123 errorcnt += checkseclevel(
131 errorcnt += checkseclevel(
@@ -144,7 +152,9 b' def checkfile(ui, filename, initlevel):'
144 doc = fp.read()
152 doc = fp.read()
145
153
146 ui.notenoi18n(
154 ui.notenoi18n(
147 'checking input from %s with initlevel %d\n' % (filename, initlevel)
155 (
156 'checking input from %s with initlevel %d\n' % (filename, initlevel)
157 ).encode('utf-8')
148 )
158 )
149 return checkseclevel(ui, doc, 'input from %s' % filename, initlevel)
159 return checkseclevel(ui, doc, 'input from %s' % filename, initlevel)
150
160
General Comments 0
You need to be logged in to leave comments. Login now