From 07428ca165700041991071b74d9300cffc1cca66 Mon Sep 17 00:00:00 2001 From: Cliffano Subagio Date: Mon, 13 Jan 2025 23:38:18 +1100 Subject: [PATCH] Fix code scanning alert no. 4: Useless regular-expression character escape Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- test/resource-types/text.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/resource-types/text.js b/test/resource-types/text.js index 19055263..38f2df52 100644 --- a/test/resource-types/text.js +++ b/test/resource-types/text.js @@ -56,7 +56,7 @@ describe('text', function() { path: 'somefile.txt', type: 'text', params: { - regex: '(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?' + regex: '(\\d+).(\\d+).(\\d+)(?:-([0-9A-Za-z-]+(?:.[0-9A-Za-z-]+)*))?' } }; this.mockFs.expects('readFileSync').once().withExactArgs('somefile.txt', 'UTF-8').returns(' version1 = "0.0.0", version2 = "1.1.1-beta" '); @@ -75,7 +75,7 @@ describe('text', function() { path: 'somefile.txt', type: 'text', params: { - regex: '(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?' + regex: '(\\d+).(\\d+).(\\d+)(?:-([0-9A-Za-z-]+(?:.[0-9A-Za-z-]+)*))?' } }; this.mockFs.expects('readFile').once().withExactArgs('somefile.txt', 'UTF-8', sinon.match.func).callsArgWith(2, null, ' version = "0.0.0" '); @@ -91,7 +91,7 @@ describe('text', function() { path: 'somefile.txt', type: 'text', params: { - regex: '(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?' + regex: '(\\d+).(\\d+).(\\d+)(?:-([0-9A-Za-z-]+(?:.[0-9A-Za-z-]+)*))?' } }; this.mockFs.expects('readFile').once().withExactArgs('somefile.txt', 'UTF-8', sinon.match.func).callsArgWith(2, null, ' version = "9.8.7" \n side_version = "1.2.3" '); @@ -107,7 +107,7 @@ describe('text', function() { path: 'somefile.txt', type: 'text', params: { - regex: '(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?' + regex: '(\\d+).(\\d+).(\\d+)(?:-([0-9A-Za-z-]+(?:.[0-9A-Za-z-]+)*))?' } }; this.mockFs.expects('readFile').once().withExactArgs('somefile.txt', 'UTF-8', sinon.match.func).callsArgWith(2, null, ' version = "1.1.1-pre.2" ');