소스 검색

Add segment length check per entry

This avoids an IndexError if the length of split segments is shorter than expected.
pull/635/merge
Dave Machado 6 년 전
committed by GitHub
부모
커밋
b756f21f13
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. +5
    -0
      build/validate_format.py

+ 5
- 0
build/validate_format.py 파일 보기

@@ -16,6 +16,7 @@ index_auth = 2
index_https = 3
index_cors = 4
index_link = 5
num_segments = 6

errors = []
title_links = []
@@ -133,6 +134,10 @@ def check_format(filename):
continue
num_in_category += 1
segments = line.split('|')[1:-1]
if len(segments) < num_segments:
add_error(line_num, "entry does not have all the required sections (have {}, need {})".format(
len(segments), num_segments))
continue
# START Global
for segment in segments:
# every line segment should start and end with exactly 1 space


불러오는 중...
취소
저장