From 788b7e558b9203ae74a882f612406710fa12cfe9 Mon Sep 17 00:00:00 2001 From: sanfrancrisko Date: Mon, 16 Aug 2021 17:12:59 +0100 Subject: [PATCH] (GH-16) Do not warn on "\s" string literal Prior to this commit, if the `\s` escape sequence was used, this would cause a F+ from the `double_quoted_strings` check. This commit updates the `double_quoted_string` check to permit the `\s` string literal. --- lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb | 2 +- .../plugins/check_strings/double_quoted_strings_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb b/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb index e03169124..74388154f 100644 --- a/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +++ b/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb @@ -4,7 +4,7 @@ # # https://puppet.com/docs/puppet/latest/style_guide.html#quoting PuppetLint.new_check(:double_quoted_strings) do - ESCAPE_CHAR_RE = %r{(\\\$|\\"|\\'|'|\r|\t|\\t|\n|\\n|\\\\)} + ESCAPE_CHAR_RE = %r{(\\\$|\\"|\\'|'|\r|\t|\\t|\\s|\n|\\n|\\\\)} def check tokens.select { |token| diff --git a/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb b/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb index 906bd1ff5..030a6417a 100644 --- a/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +++ b/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb @@ -103,6 +103,7 @@ class puppet::master::maintenance ( $string5 = "this string contains \\'escaped \\' single quotes" $string6 = "this string contains \r carriage return" $string7 = "this string contains \\\\ an escaped backslash" + $string8 = "this string contains \\s" END end