From ed1579a5c6c1a87e87adc4221213423952d55265 Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Wed, 18 Jun 2025 04:32:29 -0700 Subject: [PATCH] Fixed Q003 (avoidable-escaped-quote): Change outer quotes to avoid escaping inner quotes --- tools/readable_bash.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/readable_bash.py b/tools/readable_bash.py index 290fea1e..a97fcf8c 100644 --- a/tools/readable_bash.py +++ b/tools/readable_bash.py @@ -247,7 +247,7 @@ class SedReplace(Grammar): class EchoPipe(Grammar): grammar = OPTIONAL(SPACE), L("echo "), REST_OF_LINE, L(' | '), REST_OF_LINE, EOL def value(self): - text = " ".join(f"\"{s}\"" for s in self[2].string.split(" ")) + text = " ".join(f'"{s}"' for s in self[2].string.split(" ")) return "
echo " + recode_bash(text) + r" \
| " + recode_bash(self[4].string) + "
\n" def shell_line(bash): @@ -377,7 +377,7 @@ def recode_bash(s): tok = tok.replace(c, "\\" + c) tok = fixup_tokens(tok) if " " in tok or '"' in tok: - tok = tok.replace("\"", "\\\"") + tok = tok.replace('"', '\\"') tok = '"' + tok +'"' else: tok = tok.replace("'", "\\'")