瀏覽代碼

Add check for duplicate links

pull/663/merge
davemachado 6 年之前
父節點
當前提交
2f4a80bf7b
共有 1 個檔案被更改,包括 5 行新增0 行删除
  1. +5
    -0
      build/validate_format.py

+ 5
- 0
build/validate_format.py 查看文件

@@ -20,6 +20,7 @@ num_segments = 6

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

@@ -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




Loading…
取消
儲存