Skip to content

Commit 34a1118

Browse files
scripts: Use portable paste invocation in language check (#5)
### Motivation The script that checks for unacceptable language used an invocation of `paste` that worked on Linux (i.e. in the CI), but not with the variant of `paste` preinstalled on Darwin platforms. This meant it failed like this: ```console ❯ bash scripts/check-for-unacceptable-language.sh ** Checking for unacceptable language... usage: paste [-s] [-d delimiters] file ... ``` Worse, the `|| true` was in the wrong place so it failed silently. ### Modifications - Use portable invocation of `paste` for Linux and Darwin. - Move the `|| true` so that, when it fails, it fails hard. ### Result Can run the script on Darwin. ### Testing ``` ❯ bash scripts/check-for-unacceptable-language.sh ** Checking for unacceptable language... ** ✅ Found no unacceptable language. ❯ echo kill >> README.md ❯ bash scripts/check-for-unacceptable-language.sh ** Checking for unacceptable language... ** ERROR: ❌ Found unacceptable language in files: README.md. ``` Signed-off-by: Si Beaumont <[email protected]>
1 parent 9d61b8f commit 34a1118

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

scripts/check-for-unacceptable-language.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ PATHS_WITH_UNACCEPTABLE_LANGUAGE=$(git -C "${REPO_ROOT}" grep \
2828
-f "${UNACCEPTABLE_LANGUAGE_PATTERNS_PATH}" \
2929
-- \
3030
":(exclude)${UNACCEPTABLE_LANGUAGE_PATTERNS_PATH}" \
31-
| paste -s -d " "
32-
) ||:
31+
) || true | /usr/bin/paste -s -d " " -
3332

3433
if [ -n "${PATHS_WITH_UNACCEPTABLE_LANGUAGE}" ]; then
3534
fatal "❌ Found unacceptable language in files: ${PATHS_WITH_UNACCEPTABLE_LANGUAGE}."

0 commit comments

Comments
 (0)