From 661be056f1cf8bbcb04faf73fbda09d06d6addbb Mon Sep 17 00:00:00 2001 From: Gandalf- Date: Sat, 19 Jan 2019 08:49:26 -0800 Subject: [PATCH] Issue 824 grep fixed strings and SC2063 Issue https://github.com/koalaman/shellcheck/issues/824 Fix up to original change to include '--fixed-strings' in the grep + regex special cases. --- src/ShellCheck/Checks/Commands.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ShellCheck/Checks/Commands.hs b/src/ShellCheck/Checks/Commands.hs index 6c82a4f..66f597b 100644 --- a/src/ShellCheck/Checks/Commands.hs +++ b/src/ShellCheck/Checks/Commands.hs @@ -212,6 +212,7 @@ prop_checkGrepRe16= verifyNot checkGrepRe "grep --include 'Foo*' file" prop_checkGrepRe17= verifyNot checkGrepRe "grep --exclude 'Foo*' file" prop_checkGrepRe18= verifyNot checkGrepRe "grep --exclude-dir 'Foo*' file" prop_checkGrepRe19= verify checkGrepRe "grep -- 'Foo*' file" +prop_checkGrepRe20= verifyNot checkGrepRe "grep --fixed-strings 'Foo*' file" checkGrepRe = CommandCheck (Basename "grep") check where check cmd = f cmd (arguments cmd) @@ -244,7 +245,7 @@ checkGrepRe = CommandCheck (Basename "grep") check where "Note that unlike globs, " ++ [char] ++ "* here matches '" ++ [char, char, char] ++ "' but not '" ++ wordStartingWith char ++ "'." where flags = map snd $ getAllFlags cmd - grepGlobFlags = ["F", "include", "exclude", "exclude-dir"] + grepGlobFlags = ["fixed-strings", "F", "include", "exclude", "exclude-dir"] wordStartingWith c = head . filter ([c] `isPrefixOf`) $ candidates