-def check_blank_lines(raw_data, errors, error_msg):
- '''Blank lines are not allowed in category headers.'''
- lines = [x.strip() for x in raw_data.split('\n')]
- if '' in lines:
- add_error(error_msg, errors)
- add_suberror('{0} blank lines found in header'.format(lines.count('')), errors)
- return False
- return True
-
-
-def check_categories(left, right, errors, error_msg):
- '''Report set difference of categories.'''
- result = left - right
- if result:
- add_error(error_msg, errors)
- add_suberror('Offending entries: {0}'.format(result), errors)
- return False
- return True
+ lines = [(i, x) for (i, x) in enumerate(raw.strip().split('\n')) if not x.strip()]
+ reporter.check(not lines,
+ None,
+ 'Blank line(s) in header: {0}',
+ ', '.join(["{0}: {1}".format(i, x.rstrip()) for (i, x) in lines]))