Skip to content

Commit

Permalink
style: fix restrict-template-expressions rule violations
Browse files Browse the repository at this point in the history
  • Loading branch information
ssimek committed Jan 17, 2025
1 parent d855332 commit 5ce25a1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export default tseslint.config(
'@typescript-eslint/no-require-imports': 'off', // 24 instances
'no-cond-assign': 'off', // 21 instances
'no-empty': 'off', // 19 instances
'@typescript-eslint/restrict-template-expressions': 'off', // 17 instances
'@typescript-eslint/require-await': 'off', // 11 instances
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/backend/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ export class SymbolTable {
try {
await p.promise;
} catch (e) {
this.gdbSession.handleMsg('log', `Failed running: ${[p.args.join(' ')]}.\n ${e}`);
this.gdbSession.handleMsg('log', `Failed running: ${p.args.join(' ')}.\n ${e}`);
}
}
return Promise.resolve();
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/configprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati
config.showDevDebugOutput = configuration.get(CortexDebugKeys.DEV_DEBUG_MODE, ADAPTER_DEBUG_MODE.NONE);
}
if (!sanitizeDevDebug(config as unknown)) {
const modes = Object.values(ADAPTER_DEBUG_MODE);
const modes = Object.values(ADAPTER_DEBUG_MODE).join(',');
vscode.window.showInformationMessage(`launch.json: "showDevDebugOutput" muse be one of ${modes}. Setting to "${config.showDevDebugOutput}"`);
}

Expand Down
6 changes: 3 additions & 3 deletions src/frontend/rtos/rtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,16 +462,16 @@ class RTOSViewProvider implements vscode.WebviewViewProvider {
<meta http-equiv="Content-Security-Policy" content="default-src 'none';
style-src 'nonce-${nonce}' ${webview.cspSource}; script-src 'nonce-${nonce}';">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${rtosStyle}" rel="stylesheet">
<link href="${rtosStyle.toString()}" rel="stylesheet">
<style nonce="${nonce}">
${htmlInfo.css}
</style>
<title>RTOS Threads</title>
</head>
<body>
${htmlInfo.html}
<script type="module" nonce="${nonce}" src="${toolkitUri}"></script>
<script type="module" nonce="${nonce}" src="${scriptUri}"></script>
<script type="module" nonce="${nonce}" src="${toolkitUri.toString()}"></script>
<script type="module" nonce="${nonce}" src="${scriptUri.toString()}"></script>
</body>
</html>`;
return ret;
Expand Down
6 changes: 3 additions & 3 deletions src/remote/src/tcpportscanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class TcpPortScanner {

return new Promise(async (resolve, reject) => {
const results = await Promise.all(promises.map((p) => p.then((x) => x).catch((e) => e)));
ConsoleLog(`isPortInUseEx: Results ${results}`);
ConsoleLog('isPortInUseEx: Results', results);
for (const r of results) {
if (r !== false) {
resolve(true);
Expand Down Expand Up @@ -149,15 +149,15 @@ export class TcpPortScanner {
const endTime = process.hrtime(startTine);
if (inUse) {
busyPorts.push(port);
ConsoleLog(`Busy ports = ${busyPorts}`);
ConsoleLog('Busy ports', busyPorts);
} else {
if (consecutive && (freePorts.length > 0)
&& (port !== (1 + freePorts[freePorts.length - 1]))) {
ConsoleLog('TcpPortHelper.findFreePorts: Oops, reset for consecutive ports requirement');
freePorts = [];
}
freePorts.push(port);
ConsoleLog(`Free ports = ${freePorts}`);
ConsoleLog('Free ports', freePorts);
}
if (logEnable) {
const ms = (endTime[1] / 1e6).toFixed(2);
Expand Down
4 changes: 2 additions & 2 deletions src/tcpportscanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ export class TcpPortScanner {
const endTime = process.hrtime(startTine);
if (inUse) {
busyPorts.push(port);
ConsoleLog(`Busy ports = ${busyPorts}`);
ConsoleLog('Busy ports', busyPorts);
} else {
if (consecutive && (freePorts.length > 0)
&& (port !== (1 + freePorts[freePorts.length - 1]))) {
ConsoleLog('TcpPortHelper.findFreePorts: Oops, reset for consecutive ports requirement');
freePorts = [];
}
freePorts.push(port);
ConsoleLog(`Free ports = ${freePorts}`);
ConsoleLog('Free ports', freePorts);
}
if (logEnable) {
const ms = (endTime[1] / 1e6).toFixed(2);
Expand Down
14 changes: 7 additions & 7 deletions test/suite/tcpportscanner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ suite('TcpPortScanner Tests', () => {
const hostNameOrIp = '0.0.0.0';
timeIt();
await TcpPortScanner.findFreePorts(args, hostNameOrIp).then((ret) => {
if (doLog) { console.log(`Found free ports ${ret}, ${timeIt()}`); }
if (doLog) { console.log('Found free ports', ret, timeIt()); }
ports = ret;
assert.strictEqual(ports.length, args.retrieve, `wrong number of ports ${ports}`);
assert.strictEqual(ports.length, args.retrieve, `wrong number of ports ${ports.join(',')}`);
assert.strictEqual(ports[0] >= args.min, true);
assert.strictEqual(ports[args.retrieve - 1] <= args.max, true);
assert.deepStrictEqual(ports, ports.sort(), `ports are not ordered? ${ports}`);
assert.deepStrictEqual(ports, ports.sort(), `ports are not ordered? ${ports.join(',')}`);
}).catch((e) => {
assert.fail(`TcpPortScanner.find failed, ${timeIt()} ` + e);
});
Expand Down Expand Up @@ -87,15 +87,15 @@ suite('TcpPortScanner Tests', () => {
args.consecutive = true;
timeIt(true);
await TcpPortScanner.findFreePorts(args, hostNameOrIp).then((ret) => {
if (doLog) { console.log(`Found free consecutive ports ${ret} ${timeIt()}`); }
if (doLog) { console.log('Found free consecutive ports', ret, timeIt()); }
const newPorts = ret;
assert.strictEqual(newPorts.length, args.retrieve, `wrong number of ports ${newPorts}`);
assert.strictEqual(newPorts.length, args.retrieve, `wrong number of ports ${newPorts.join(',')}`);
assert.strictEqual(newPorts[0] >= args.min, true);
assert.strictEqual(newPorts[args.retrieve - 1] <= args.max, true);
assert.deepStrictEqual(newPorts, newPorts.sort(), `ports are not ordered? ${newPorts}`);
assert.deepStrictEqual(newPorts, newPorts.sort(), `ports are not ordered? ${newPorts.join(',')}`);
assert.strictEqual(newPorts.find((p) => p === port), undefined, `used port ${port} found as unused`);
for (let ix = 1; ix < args.retrieve; ix++) {
assert.strictEqual(newPorts[ix - 1] + 1, newPorts[ix], `ports are not consecutive ${newPorts}`);
assert.strictEqual(newPorts[ix - 1] + 1, newPorts[ix], `ports are not consecutive ${newPorts.join(',')}`);
}
}).catch((e) => {
assert.fail(`TcpPortScanner.find consecutive failed ${timeIt()} ` + e);
Expand Down

0 comments on commit 5ce25a1

Please sign in to comment.