format-validity
Valid syntax but broken for the platform.
Default severity: error
What it checks
The file parses, but the platform will reject or misread it: an unescaped apostrophe in an Android string, duplicate keys, a PO file without a Plural-Forms header, ARB placeholder metadata that does not match the message.
The file's parser reports it while reading the file, before any comparison.
Example
Android strings.xml: an apostrophe that aapt2 rejects unless it is escaped. Config used for both runs:
{
"sourceLocale": "en",
"files": [
{
"format": "android-xml",
"path": "res/values{-locale}/strings.xml"
}
]
}Fails
res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sync_error">The app could not sync.</string>
</resources>res/values-fr/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sync_error">L'application n'a pas pu se synchroniser.</string>
</resources>Gate output
sync_errorUnescaped apostrophe; write \' or wrap the value in double quotes, or aapt2 fails the buildres/values-fr/strings.xml:3
Passes
res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sync_error">The app could not sync.</string>
</resources>res/values-fr/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sync_error">L\'application n\'a pas pu se synchroniser.</string>
</resources>Gate output
No format-validity finding.
Change its severity
{
"checks": {
"format-validity": "warning"
}
}Use "off" to disable it. To hide one finding, add "suppress": ["format-validity:sync_error"]; a suppress rule that stops matching is reported so it can be removed.