In today's world of excellent CLI tools I don't think grep is a good choice, especially for checking irregular languages like XML. [0]<p>I use tools like `jq` [1] or `yq` [2] all the time for CI checks. One useful check, is we have a configuration file stored as several hundred lines of YAML. Its a nice thing to maintain a sorted order for that, so we have a git pre-commit hook that runs the following:<p>> yq eval --inplace '.my_key|= sort' my_file.yaml<p>Of course, a pre-commit hook or CI both work. There's pros and cons of both. For our team, the pre-commit hook is a low enough level of effort, and doesn't require a CI check for something that executes in milliseconds.<p>[0] <a href="https://stackoverflow.com/a/1732454" rel="nofollow">https://stackoverflow.com/a/1732454</a><p>[1] <a href="https://github.com/stedolan/jq" rel="nofollow">https://github.com/stedolan/jq</a><p>[2] <a href="https://github.com/mikefarah/yq" rel="nofollow">https://github.com/mikefarah/yq</a>