From 53c53bbdbc6dd6b6bd5666e787838732f01b58c9 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 26 Dec 2019 19:42:30 -0600 Subject: [PATCH] Stringtable Validator - Check for tabs and correct spacing (#7332) * Stringtable Validator - Check for tabs and correct spacing * Improve error descriptions, Cleanup * Change encoding to utf-8 Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> --- addons/medical_gui/stringtable.xml | 4 +--- tools/stringtable_validator.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/addons/medical_gui/stringtable.xml b/addons/medical_gui/stringtable.xml index d1663ea0cc..64b57e7bc7 100644 --- a/addons/medical_gui/stringtable.xml +++ b/addons/medical_gui/stringtable.xml @@ -869,9 +869,7 @@ 已使用固定板 Dlaha aplikována - + Lost some blood Hat etwas Blut verloren diff --git a/tools/stringtable_validator.py b/tools/stringtable_validator.py index 7df6105394..5252297f56 100644 --- a/tools/stringtable_validator.py +++ b/tools/stringtable_validator.py @@ -115,6 +115,29 @@ def check_stringtable(filepath): print(" ERROR: Key '{}' is defined {} times.".format(id, count)) errors += 1 + # Check whitespace for tabs and correct number of indenting spaces + with open(filepath, "r", encoding = "utf-8") as file: + spacing_depth = 0 + + for line_number, line in enumerate(file, 1): + if "\t" in line: + print(" ERROR: Found a tab on line {}.".format(line_number)) + errors += 1 + + line_clean = line.lstrip().lower() + + if line_clean.startswith("