From 19d00809d195cee623592da155588d486ca9d75c Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 17 Jul 2022 08:49:03 +0200 Subject: [PATCH] quoted-strings: Merge comparisons with `in` To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained in it instead of checking for equality against each of the values. This is faster, less verbose, and more readable. --- yamllint/rules/quoted_strings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yamllint/rules/quoted_strings.py b/yamllint/rules/quoted_strings.py index fb0d85c..9b238f1 100644 --- a/yamllint/rules/quoted_strings.py +++ b/yamllint/rules/quoted_strings.py @@ -228,7 +228,7 @@ def check(conf, token, prev, next, nextnext, context): return # Ignore multi-line strings - if (not token.plain) and (token.style == "|" or token.style == ">"): + if not token.plain and token.style in ("|", ">"): return quote_type = conf['quote-type']