Skip to content

Commit

Permalink
Add check for duplicate links
Browse files Browse the repository at this point in the history
  • Loading branch information
davemachado committed May 6, 2018
1 parent 466f5e8 commit 2f4a80b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build/validate_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

errors = []
title_links = []
previous_links = []
anchor_re = re.compile(anchor + '\s(.+)')
section_title_re = re.compile('\*\s\[(.*)\]')

Expand Down Expand Up @@ -96,6 +97,10 @@ def check_entry(line_num, segments):
link = segments[index_link]
if not link.startswith('[Go!](http') or not link.endswith(')'):
add_error(line_num, 'link syntax should be "[Go!](LINK)"')
if link in previous_links:
add_error(line_num, 'duplicate link - entries should only be included in one section')
else:
previous_links.append(link)
# END Link


Expand Down

0 comments on commit 2f4a80b

Please sign in to comment.