# Episode filename pattern.
P_EPISODE_FILENAME = re.compile(r'/_episodes/(\d\d)-[-\w]+.md$')
+# Pattern to match lines ending with whitespace.
+P_TRAILING_WHITESPACE = re.compile(r'\s+$')
+
# What kinds of blockquotes are allowed?
KNOWN_BLOCKQUOTES = {
'callout',
parser = OptionParser()
parser.add_option('-l', '--linelen',
default=False,
+ action="store_true",
dest='line_lengths',
help='Check line lengths')
parser.add_option('-p', '--parser',
help='source directory')
parser.add_option('-w', '--whitespace',
default=False,
+ action="store_true",
dest='trailing_whitespace',
help='Check for trailing whitespace')
"""Check for whitespace at the ends of lines."""
if self.args.trailing_whitespace:
- trailing = [i for (i, l, n) in self.lines if l.endswidth(' ')]
+ trailing = [i for (i, l, n) in self.lines if P_TRAILING_WHITESPACE.match(l)]
self.reporter.check(not trailing,
self.filename,
'Line(s) end with whitespace: {0}',
- ', '.join([str[i] for i in over]))
+ ', '.join([str(i) for i in trailing]))
def check_blockquote_classes(self):