You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(validation): add Name field validation and improve error output
- Validate that Name field parts start with language code (2 uppercase letters + space)
- Group errors by file with max 10 errors shown per file
- Add summary with files/errors count
"""Check that each part of the Name field starts with a language code (two uppercase letters) followed by a space."""
170
+
if"Name"notindf.columns:
171
+
return []
172
+
173
+
errors: list[str] = []
174
+
foridx, nameindf["Name"].items():
175
+
ifpd.isna(name):
176
+
continue
177
+
178
+
parts=_split_csv_list(str(name))
179
+
forpartinparts:
180
+
# Each part must start with a language code (2 uppercase letters) followed by a space
181
+
iflen(part) <3:
182
+
errors.append(
183
+
f"{filename} (line {_csv_line(int(idx))}): Name part '{part}' is too short (must be language code + space + text). Hint: Use %2C instead of comma within text."
184
+
)
185
+
continue
186
+
187
+
# Check first 2 characters are uppercase letters (language code)
188
+
ifnot (part[0].isupper() andpart[0].isalpha() and
189
+
part[1].isupper() andpart[1].isalpha()):
190
+
errors.append(
191
+
f"{filename} (line {_csv_line(int(idx))}): Name part '{part}' must start with a language code (two uppercase letters). Hint: If this text contains a comma, use %2C instead."
192
+
)
193
+
continue
194
+
195
+
# Check that the 3rd character is a space
196
+
ifpart[2] !=' ':
197
+
errors.append(
198
+
f"{filename} (line {_csv_line(int(idx))}): Name part '{part}' must have a space after the language code"
0 commit comments