##// END OF EJS Templates
check-code: allow tabs in heredoc
Yuya Nishihara -
r35316:e223c043 default
parent child Browse files
Show More
@@ -135,7 +135,6 b' testpats = ['
135 (r'if\s*!', "don't use '!' to negate exit status"),
135 (r'if\s*!', "don't use '!' to negate exit status"),
136 (r'/dev/u?random', "don't use entropy, use /dev/zero"),
136 (r'/dev/u?random', "don't use entropy, use /dev/zero"),
137 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
137 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
138 (r'^( *)\t', "don't use tabs to indent"),
139 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
138 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
140 "put a backslash-escaped newline after sed 'i' command"),
139 "put a backslash-escaped newline after sed 'i' command"),
141 (r'^diff *-\w*[uU].*$\n(^ \$ |^$)', "prefix diff -u/-U with cmp"),
140 (r'^diff *-\w*[uU].*$\n(^ \$ |^$)', "prefix diff -u/-U with cmp"),
@@ -225,6 +224,7 b' utestpats = ['
225 ]
224 ]
226 ]
225 ]
227
226
227 # transform plain test rules to unified test's
228 for i in [0, 1]:
228 for i in [0, 1]:
229 for tp in testpats[i]:
229 for tp in testpats[i]:
230 p = tp[0]
230 p = tp[0]
@@ -235,6 +235,11 b' for i in [0, 1]:'
235 p = r"^ [$>] .*(%s)" % p
235 p = r"^ [$>] .*(%s)" % p
236 utestpats[i].append((p, m) + tp[2:])
236 utestpats[i].append((p, m) + tp[2:])
237
237
238 # don't transform the following rules:
239 # " > \t" and " \t" should be allowed in unified tests
240 testpats[0].append((r'^( *)\t', "don't use tabs to indent"))
241 utestpats[0].append((r'^( ?)\t', "don't use tabs to indent"))
242
238 utestfilters = [
243 utestfilters = [
239 (r"<<(\S+)((.|\n)*?\n > \1)", rephere),
244 (r"<<(\S+)((.|\n)*?\n > \1)", rephere),
240 (r"( +)(#([^!][^\n]*\S)?)", repcomment),
245 (r"( +)(#([^!][^\n]*\S)?)", repcomment),
@@ -173,6 +173,17 b''
173 don't use old-style two-argument raise, use Exception(message)
173 don't use old-style two-argument raise, use Exception(message)
174 [1]
174 [1]
175
175
176 $ cat <<EOF > tab.t
177 > indent
178 > > heredoc
179 > EOF
180 $ "$check_code" tab.t
181 tab.t:1:
182 > indent
183 don't use tabs to indent
184 [1]
185 $ rm tab.t
186
176 $ cat > rst.py <<EOF
187 $ cat > rst.py <<EOF
177 > """problematic rst text
188 > """problematic rst text
178 >
189 >
General Comments 0
You need to be logged in to leave comments. Login now