Skip to content

Commit

Permalink
Lesson checking parameter handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Wilson committed Jul 1, 2016
1 parent c2f89a7 commit fb17830
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/lesson_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
# 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',
Expand Down Expand Up @@ -106,6 +109,7 @@ def parse_args():
parser = OptionParser()
parser.add_option('-l', '--linelen',
default=False,
action="store_true",
dest='line_lengths',
help='Check line lengths')
parser.add_option('-p', '--parser',
Expand All @@ -118,6 +122,7 @@ def parse_args():
help='source directory')
parser.add_option('-w', '--whitespace',
default=False,
action="store_true",
dest='trailing_whitespace',
help='Check for trailing whitespace')

Expand Down Expand Up @@ -263,11 +268,11 @@ def check_trailing_whitespace(self):
"""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):
Expand Down

0 comments on commit fb17830

Please sign in to comment.