mirror of
https://github.com/public-apis/public-apis.git
synced 2025-05-02 19:56:37 +02:00
Change line -> line_content
This commit is contained in:
parent
a935a05d6a
commit
d578ba7a32
1 changed files with 7 additions and 7 deletions
|
@ -193,15 +193,15 @@ def check_file_format(filename: str) -> None:
|
||||||
category = ''
|
category = ''
|
||||||
category_line = 0
|
category_line = 0
|
||||||
|
|
||||||
for line_num, line in enumerate(lines):
|
for line_num, line_content in enumerate(lines):
|
||||||
|
|
||||||
category_title_match = category_title_in_index_re.match(line)
|
category_title_match = category_title_in_index_re.match(line_content)
|
||||||
if category_title_match:
|
if category_title_match:
|
||||||
title_links.append(category_title_match.group(1))
|
title_links.append(category_title_match.group(1))
|
||||||
|
|
||||||
# check each category for the minimum number of entries
|
# check each category for the minimum number of entries
|
||||||
if line.startswith(anchor):
|
if line_content.startswith(anchor):
|
||||||
category_match = anchor_re.match(line)
|
category_match = anchor_re.match(line_content)
|
||||||
if category_match:
|
if category_match:
|
||||||
if category_match.group(1) not in title_links:
|
if category_match.group(1) not in title_links:
|
||||||
message = error_message(line_num, f'category header ({category_match.group(1)}) not added to Index section')
|
message = error_message(line_num, f'category header ({category_match.group(1)}) not added to Index section')
|
||||||
|
@ -214,17 +214,17 @@ def check_file_format(filename: str) -> None:
|
||||||
message = error_message(category_line, f'{category} category does not have the minimum {min_entries_per_section} entries (only has {num_in_category})')
|
message = error_message(category_line, f'{category} category does not have the minimum {min_entries_per_section} entries (only has {num_in_category})')
|
||||||
errors.append(message)
|
errors.append(message)
|
||||||
|
|
||||||
category = line.split(' ')[1]
|
category = line_content.split(' ')[1]
|
||||||
category_line = line_num
|
category_line = line_num
|
||||||
num_in_category = 0
|
num_in_category = 0
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# skips lines that we do not care about
|
# skips lines that we do not care about
|
||||||
if not line.startswith('|') or line.startswith('|---'):
|
if not line_content.startswith('|') or line_content.startswith('|---'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
num_in_category += 1
|
num_in_category += 1
|
||||||
segments = line.split('|')[1:-1]
|
segments = line_content.split('|')[1:-1]
|
||||||
if len(segments) < num_segments:
|
if len(segments) < num_segments:
|
||||||
message = error_message(line_num, f'entry does not have all the required sections (have {len(segments)}, need {num_segments})')
|
message = error_message(line_num, f'entry does not have all the required sections (have {len(segments)}, need {num_segments})')
|
||||||
errors.append(message)
|
errors.append(message)
|
||||||
|
|
Loading…
Add table
Reference in a new issue