Grep one-liners as CI tasks
phili.pe
Grep one-liners as CI tasks
1–10 of 36 posts
Re: Grep one-liners as CI tasks
#2I’m also using grep in CI as a simple but effectieve check on dependency violations in some codebases.
Re: Grep one-liners as CI tasks
#3Extra fun thing to do: print a message describing why the decision was made and how to resolve the error in the failure message of your test!
[0] - https://docs.bazel.build/versions/main/be/shell.html#sh_test
Re: Grep one-liners as CI tasks
#4Re: Grep one-liners as CI tasks
#5Re: Grep one-liners as CI tasks
#6For Android specifically: Gradle and Android Studio both support a powerful linting framework (to the level that it can provide auto-fixes to the IDE). It's better to provide an in-editor to guide your contributors before it hits CI, then have CI nag if they didn't fix the in-editor warnings/errors:
Some examples of custom lint rules[1] and the default rules which Android Studio runs[2]:
[0] https://android.googlesource.com/platform/tools/base/+/32923...
[1] https://github.com/ankidroid/Anki-Android/tree/master/lint-r...
[2] https://github.com/ankidroid/Anki-Android/blob/master/lint-r...
Re: Grep one-liners as CI tasks
#7I recommend git grep, which is comparable in speed to ripgrep, since it ignores non-tracked files and searches the object storage directly. It is also able to run in parallel.
Re: Grep one-liners as CI tasks
#8I 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:
> yq eval --inplace '.my_key|= sort' my_file.yaml
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.
[0] https://stackoverflow.com/a/1732454
Re: Grep one-liners as CI tasks
#9Re: Grep one-liners as CI tasks
#10"Too many exclamation marks"