In computer programming, a linter is "any tool that flags suspicious usage in
software written in any computer language". In Symfony, linters are commands
that check the validity of several elements. For example, the lint:yaml
command checks that the syntax of the YAML files in your application is correct.
In Symfony 3.3 we added a new linter for XLIFF translation files. It works
the same as lint:yaml
, so you can lint single files, whole directories and
even entire bundles:
1 2 3 4 5 6 7 8 9 10 11
# lint a single file
$ ./bin/console lint:xliff app/Resources/translations/messages.en.xlf
# lint the whole directory
$ ./bin/console lint:xliff app/Resources/translations
# lint a specific bundle
$ ./bin/console lint:xliff @AppBundle
# add '--format=json' option to export the results into JSON format
$ ./bin/console lint:xliff @AppBundle --format=json
Executing linters automatically is a must-have for your Symfony applications, for example during the deployment process or as part of your CI workflow (like we do in the Symfony Demo application.)
Nice addition! What about a separate linter package?
See also: https://github.com/symfony/symfony/issues/18987
👍
If you need a separate package : https://mickaelandrieu.github.io/xml-linter/
Great post Thanks for sharing!