Issue #778 - Group locale linter errors
This MR contains the following changes:
- Introduced
ResultGroup
class to represent a list of error strings,Error
objects andResultGroup
objects that we can output as a single string. - Return a
ResultGroup
object from eachvalidate()
function instead of throwing, in order to (a) collect all errors in a single result group and (b) run subsequent checks and not exit early. We should only skip subsequent checks, if they cannot be made (e.g. we cannot check a tag name, if we cannot find any tags). - Moved string validation into file validation for more logical grouping.
- Updated tests.
The output for the example file from the issue description appears as:
[Success]: Test locale linter
[Fail]: Validate translations
Validate '…/locale/en_US/foo.json'
Validate strings
Validate string 'foo-bar'
[Error]: Invalid string ID 'foo-bar'
Validate placeholders
[Error]: Unexpected placeholders
Validate tags
[Error]: Unexpected tag name 'foo'
Edited by Thomas Greiner