Skip to content

Commit

Permalink
fix !type:
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 committed Oct 11, 2024
1 parent cdf61fa commit b98e6c9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Tools/_sunrise/Schemas/validate_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ def check_dir(dir: str):
def check_yml(yml_path: str):
try:
with open(yml_path, "r", encoding="utf-8") as file:
data = yaml.safe_load(file) # Замените на safe_load для большей безопасности
content = file.read()
# Удаляем строки с тегами !type:
filtered_content = remove_type_tags(content)

# Загружаем оставшийся текст в формате YAML
data = yaml.safe_load(filtered_content)

# Проверка нужных полей на русские символы
for key in ['name', 'description', 'suffix']:
Expand All @@ -43,6 +48,12 @@ def check_yml(yml_path: str):
except Exception as e:
add_error(yml_path, f"Ошибка чтения файла: {e}")

def remove_type_tags(content: str) -> str:
"""Удаляет строки с тегами !type:."""
lines = content.splitlines()
filtered_lines = [line for line in lines if '!type:' not in line]
return '\n'.join(filtered_lines)

def has_russian_chars(text: str) -> bool:
"""Проверяет, содержит ли текст русские символы."""
return bool(re.search(r'[а-яА-Я]', text))
Expand Down

0 comments on commit b98e6c9

Please sign in to comment.