From 79eca42572998867c1b9e9b9ae96b8ffa952c666 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 24 May 2021 17:30:51 -0400 Subject: [PATCH] Update banned_commands.bats tests to ignore string literals --- test/banned_commands.bats | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/banned_commands.bats b/test/banned_commands.bats index 1bd278a0..f1fee138 100644 --- a/test/banned_commands.bats +++ b/test/banned_commands.bats @@ -38,10 +38,12 @@ teardown() { for cmd in "${banned_commands[@]}"; do # Assert command is not used in the lib and bin dirs # or expect an explicit comment at end of line, allowing it. - # Also ignore matches that are contained in comments or followed by an - # underscore (indicating it's a variable and not a command). + # Also ignore matches that are contained in comments or a string or + # followed by an underscore (indicating it's a variable and not a + # command). run bash -c "grep -nHR '$cmd' lib bin\ | grep -v '#.*$cmd'\ + | grep -v '\".*$cmd.*\"' \ | grep -v '${cmd}_'\ | grep -v '# asdf_allow: $cmd'"