SQSCANGHA-140 Fix code smells

Apply linter fixes to address code smells:
- Use replaceAll() instead of replace() with regex for string replacement
- Update dist files with linter changes

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Claire Villard 2026-04-27 19:10:48 +02:00
parent 7a11667fa2
commit daf2073c97
7 changed files with 27 additions and 26 deletions

View file

@ -62,7 +62,7 @@ describe("validateScannerVersion", () => {
validVersions.forEach((version) => {
it(`accepts ${version}`, () => {
assert.equal(validateScannerVersion(version), undefined);
assert.equals(validateScannerVersion(version), undefined);
});
});

View file

@ -111,7 +111,7 @@ export function convertToUnixPath(windowsPath) {
}
// Convert backslashes to forward slashes
let unixPath = windowsPath.replace(/\\/g, "/");
let unixPath = windowsPath.replaceAll('\\', "/");
// Convert drive letter (e.g., C: -> /c)
unixPath = unixPath.replace(/^([A-Za-z]):/, (match, drive) => {
@ -193,7 +193,6 @@ export async function importSonarSourceKey(gpgHome, keyFingerprint, keyserver) {
core.info(`Attempting fallback keyserver ${FALLBACK_KEYSERVER}...`);
await tryImportKey(gpgHome, keyFingerprint, FALLBACK_KEYSERVER);
core.info(`Successfully imported key from fallback keyserver ${FALLBACK_KEYSERVER}`);
return;
} catch (fallbackError) {
throw new Error(
`Failed to import SonarSource public key from all keyservers. ` +

View file

@ -18,8 +18,8 @@
import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as os from "os";
import * as path from "path";
import * as os from "node:os";
import * as path from "node:path";
import {
getPlatformFlavor,
getScannerDownloadURL,

View file

@ -18,9 +18,9 @@
import * as core from "@actions/core";
import * as exec from "@actions/exec";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import * as fs from "node.fs";
import * as os from "node.os";
import * as path from "node.path";
import { parseArgsStringToArgv } from "string-argv";
const KEYTOOL_MAIN_CLASS = "sun.security.tools.keytool.Main";

View file

@ -16,8 +16,8 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import fs from "fs";
import { join } from "path";
import fs from "node.fs";
import { join } from "node.path";
export function validateScannerVersion(version) {
if (!version) {