Show More
@@ -42,6 +42,14 b" ignorere = re.compile(br'''" | |||||
42 | config:\s(?P<config>\S+\.\S+)$ |
|
42 | config:\s(?P<config>\S+\.\S+)$ | |
43 | ''', re.VERBOSE | re.MULTILINE) |
|
43 | ''', re.VERBOSE | re.MULTILINE) | |
44 |
|
44 | |||
|
45 | if sys.version_info[0] > 2: | |||
|
46 | def mkstr(b): | |||
|
47 | if isinstance(b, str): | |||
|
48 | return b | |||
|
49 | return b.decode('utf8') | |||
|
50 | else: | |||
|
51 | mkstr = lambda x: x | |||
|
52 | ||||
45 | def main(args): |
|
53 | def main(args): | |
46 | for f in args: |
|
54 | for f in args: | |
47 | sect = b'' |
|
55 | sect = b'' | |
@@ -92,7 +100,7 b' def main(args):' | |||||
92 | # look for ignore markers |
|
100 | # look for ignore markers | |
93 | m = ignorere.search(l) |
|
101 | m = ignorere.search(l) | |
94 | if m: |
|
102 | if m: | |
95 | if m.group('reason') == 'inconsistent': |
|
103 | if m.group('reason') == b'inconsistent': | |
96 | allowinconsistent.add(m.group('config')) |
|
104 | allowinconsistent.add(m.group('config')) | |
97 | else: |
|
105 | else: | |
98 | documented[m.group('config')] = 1 |
|
106 | documented[m.group('config')] = 1 | |
@@ -106,16 +114,20 b' def main(args):' | |||||
106 | ctype = 'str' |
|
114 | ctype = 'str' | |
107 | name = m.group('section') + b"." + m.group('option') |
|
115 | name = m.group('section') + b"." + m.group('option') | |
108 | default = m.group('default') |
|
116 | default = m.group('default') | |
109 | if default in (None, 'False', 'None', '0', '[]', '""', "''"): |
|
117 | if default in ( | |
|
118 | None, b'False', b'None', b'0', b'[]', b'""', b"''"): | |||
110 | default = b'' |
|
119 | default = b'' | |
111 | if re.match(b'[a-z.]+$', default): |
|
120 | if re.match(b'[a-z.]+$', default): | |
112 | default = b'<variable>' |
|
121 | default = b'<variable>' | |
113 | if (name in foundopts and (ctype, default) != foundopts[name] |
|
122 | if (name in foundopts and (ctype, default) != foundopts[name] | |
114 | and name not in allowinconsistent): |
|
123 | and name not in allowinconsistent): | |
115 | print(l.rstrip()) |
|
124 | print(mkstr(l.rstrip())) | |
116 | print("conflict on %s: %r != %r" % (name, (ctype, default), |
|
125 | fctype, fdefault = foundopts[name] | |
117 | foundopts[name])) |
|
126 | print("conflict on %s: %r != %r" % ( | |
118 | print("at %s:%d:" % (f, linenum)) |
|
127 | mkstr(name), | |
|
128 | (mkstr(ctype), mkstr(default)), | |||
|
129 | (mkstr(fctype), mkstr(fdefault)))) | |||
|
130 | print("at %s:%d:" % (mkstr(f), linenum)) | |||
119 | foundopts[name] = (ctype, default) |
|
131 | foundopts[name] = (ctype, default) | |
120 | carryover = b'' |
|
132 | carryover = b'' | |
121 | else: |
|
133 | else: | |
@@ -132,8 +144,13 b' def main(args):' | |||||
132 | name.startswith(b"debug.")): |
|
144 | name.startswith(b"debug.")): | |
133 | ctype, default = foundopts[name] |
|
145 | ctype, default = foundopts[name] | |
134 | if default: |
|
146 | if default: | |
|
147 | if isinstance(default, bytes): | |||
|
148 | default = mkstr(default) | |||
135 | default = ' [%s]' % default |
|
149 | default = ' [%s]' % default | |
136 | print("undocumented: %s (%s)%s" % (name, ctype, default)) |
|
150 | elif isinstance(default, bytes): | |
|
151 | default = mkstr(default) | |||
|
152 | print("undocumented: %s (%s)%s" % ( | |||
|
153 | mkstr(name), mkstr(ctype), default)) | |||
137 |
|
154 | |||
138 | if __name__ == "__main__": |
|
155 | if __name__ == "__main__": | |
139 | if len(sys.argv) > 1: |
|
156 | if len(sys.argv) > 1: |
@@ -59,6 +59,7 b' test-censor.t' | |||||
59 | test-changelog-exec.t |
|
59 | test-changelog-exec.t | |
60 | test-check-code.t |
|
60 | test-check-code.t | |
61 | test-check-commit.t |
|
61 | test-check-commit.t | |
|
62 | test-check-config.py | |||
62 | test-check-execute.t |
|
63 | test-check-execute.t | |
63 | test-check-interfaces.py |
|
64 | test-check-interfaces.py | |
64 | test-check-module-imports.t |
|
65 | test-check-module-imports.t |
General Comments 0
You need to be logged in to leave comments.
Login now