227 yield report_problem('unknown-metacommand', |
227 yield report_problem('unknown-metacommand', |
228 bad_object = element, |
228 bad_object = element, |
229 command_text = element.text, |
229 command_text = element.text, |
230 ) |
230 ) |
231 |
231 |
232 @problem_type('bad-whitespace', |
|
233 severity = 'hold', |
|
234 message = lambda whitespaces: str.format( |
|
235 'non-standard whitespace in description: {whitespaces}', |
|
236 whitespaces = whitespaces, |
|
237 ) |
|
238 ) |
|
239 def bad_whitespace_test(model): |
|
240 if model.header.valid: |
|
241 import re |
|
242 description = model.header.description |
|
243 # checking against string.whitespace is not adequate enough |
|
244 # because it only contains ASCII characters. So checking using a |
|
245 # regular expression is necessary. |
|
246 bad_whitespaces = set(re.findall('\s', description)) - {' '} |
|
247 if bad_whitespaces: |
|
248 yield report_problem( |
|
249 'bad-whitespace', |
|
250 bad_object = model.body[0], |
|
251 whitespaces = ', '.join( |
|
252 repr(whitespace) |
|
253 for whitespace in sorted(bad_whitespaces) |
|
254 ), |
|
255 ) |
|
256 |
|
257 manifest = { |
232 manifest = { |
258 'tests': [ |
233 'tests': [ |
259 colours_test, |
234 colours_test, |
260 syntax_errors, |
235 syntax_errors, |
261 bad_header, |
236 bad_header, |