[CI] CLIPPY=true ./bin/test-exercise on macOS does not behave as expected
The BSD sed I have on macOS complains about the flags in: https://github.com/exercism/rust/blob/58efd1e80b371db9aa03cc3d6585a76422617d0d/bin/test-exercise#L79
sed: 1: "1i #![deny(clippy::all)]": command i expects \ followed by text
clippy /Users/eli/floss/exercism/rust/exercises/concept/entry-api OK
I'll explore a workaround. I prefer exiting early and expecting developers to have GNU sed installed.
OSX sed is weirdly limited. I had to script around that at a previous job; it was something like
# in the common imported header
sed=sed
if command -v gsed; then
sed=gsed
fi
# later in the file
$sed -i -e 's/my/expr/'
, which worked as long as everyone on OSX did brew install gnu-sed.
sed --version fails for BSD sed but succeeds for GNU sed.
We could use that for a simple check too!
I ended up doing brew install gnu-sed, then modifying my path to prefer gnused without having to use gsed 😄
I've been documenting my findings here: https://git.sr.ht/~efx/maintaining_tips
We could consider using:
- nu's
str find-replacehttps://www.nushell.sh/book/command_reference.html#examples - https://github.com/chmln/sd
i mildly prefer nu since it seems better as a long term choice.
My preference is to use tooling which requires the least amount of install/configuration. We don't want to burn CI seconds installing things, and we don't want to force users to install anything in order to interact with the track. sed has the advantage of appearing on every unix, even if it's limited.
The real solution is to adjust the script such that it does what we want even on osx.