Skip to content

Commit 7d9d147

Browse files
committed
fixing linter issues
1 parent 3ffe002 commit 7d9d147

File tree

10 files changed

+92
-85
lines changed

10 files changed

+92
-85
lines changed

.vscode/tasks.json

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55
// ${fileDirname}: the current opened file's dirname
66
// ${fileExtname}: the current opened file's extension
77
// ${cwd}: the current working directory of the spawned process
8-
9-
// A task runner that calls a custom npm script that compiles the extension.
108
{
119
"version": "2.0.0",
12-
13-
// Run in a shell so "npm" command is properly resolved to "npm.cmd" on Windows systems.
14-
"type": "shell",
15-
16-
// we want to run npm
17-
"command": "npm",
18-
19-
// we run the custom script "compile" as defined in package.json
20-
"args": ["run", "compile", "--loglevel", "silent"],
21-
22-
// The tsc compiler is started in background mode
23-
"isBackground": true,
24-
25-
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
26-
"problemMatcher": "$tsc-watch",
27-
"tasks": []
10+
"tasks": [
11+
{
12+
// A task runner that calls a custom npm script that compiles the extension.
13+
"label": "compile",
14+
// Run in a shell so "npm" command is properly resolved to "npm.cmd" on Windows systems.
15+
"type": "shell",
16+
// we want to run npm
17+
"command": "npm",
18+
// we run the custom script "compile" as defined in package.json
19+
"args": [
20+
"run",
21+
"compile",
22+
"--loglevel",
23+
"silent"
24+
],
25+
// The tsc compiler is started in background mode
26+
"isBackground": true,
27+
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
28+
"problemMatcher": "$tsc-watch",
29+
// that's our build
30+
"group": "build"
31+
}
32+
]
2833
}

src/backend/mi2/mi2.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ export class MI2 extends EventEmitter implements IBackend {
145145
if (args.bootstrap) sshCMD = args.bootstrap + " && " + sshCMD;
146146
this.sshConn.exec(sshCMD, execArgs, (err, stream) => {
147147
if (err) {
148-
this.log("stderr", "Could not run " + this.application + "(" + sshCMD +") over ssh!");
148+
this.log("stderr", "Could not run " + this.application + "(" + sshCMD + ") over ssh!");
149149
if (err === undefined) {
150-
err = "<reason unknown>"
150+
err = "<reason unknown>";
151151
}
152152
this.log("stderr", err.toString());
153153
this.emit("quit");
@@ -177,7 +177,7 @@ export class MI2 extends EventEmitter implements IBackend {
177177
}).on("error", (err) => {
178178
this.log("stderr", "Error running " + this.application + " over ssh!");
179179
if (err === undefined) {
180-
err = "<reason unknown>"
180+
err = "<reason unknown>";
181181
}
182182
this.log("stderr", err.toString());
183183
this.emit("quit");
@@ -188,7 +188,7 @@ export class MI2 extends EventEmitter implements IBackend {
188188

189189
protected initCommands(target: string, cwd: string, attach: boolean = false) {
190190
// We need to account for the possibility of the path type used by the debugger being different
191-
// than the path type where the extension is running (e.g., SSH from Linux to Windows machine).
191+
// from the path type where the extension is running (e.g., SSH from Linux to Windows machine).
192192
// Since the CWD is expected to be an absolute path in the debugger's environment, we can test
193193
// that to determine the path type used by the debugger and use the result of that test to
194194
// select the correct API to check whether the target path is an absolute path.
@@ -215,7 +215,7 @@ export class MI2 extends EventEmitter implements IBackend {
215215
cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\""));
216216
if (this.prettyPrint)
217217
cmds.push(this.sendCommand("enable-pretty-printing"));
218-
for (let cmd of this.extraCommands) {
218+
for (const cmd of this.extraCommands) {
219219
cmds.push(this.sendCommand(cmd));
220220
}
221221

@@ -374,7 +374,7 @@ export class MI2 extends EventEmitter implements IBackend {
374374
this.emit("watchpoint", parsed);
375375
break;
376376
case "function-finished":
377-
// identical result -> send step-end
377+
// identical result send step-end
378378
// this.emit("step-out-end", parsed);
379379
// break;
380380
case "location-reached":
@@ -391,7 +391,7 @@ export class MI2 extends EventEmitter implements IBackend {
391391
case "fork":
392392
case "vfork":
393393
case "exec":
394-
// TODO: inform the user, possibly add second inferiour
394+
// TODO: inform the user, possibly add second inferior
395395
this.emit("step-end", parsed);
396396
break;
397397
case "signal-received":
@@ -406,7 +406,7 @@ export class MI2 extends EventEmitter implements IBackend {
406406
break;
407407
// case "exited-signalled": // consider handling that explicit possible
408408
// this.log("stderr", "Program exited because of signal " + parsed.record("signal"));
409-
// this.emit("stoped", parsed);
409+
// this.emit("stopped", parsed);
410410
// break;
411411

412412
default:

src/backend/mi2/mi2lldb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class MI2_LLDB extends MI2 {
2929
];
3030
if (!attach)
3131
cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\""));
32-
for (let cmd of this.extraCommands) {
32+
for (const cmd of this.extraCommands) {
3333
cmds.push(this.sendCliCommand(cmd));
3434
}
3535
return cmds;
@@ -64,7 +64,7 @@ export class MI2_LLDB extends MI2 {
6464
// LLDB doesn't allow quoting the whole argument but rather only the file
6565
const target: string = (filename ? '"' + escape(filename) + '":' : "") + line;
6666
this.sendCliCommand("jump " + target).then(() => {
67-
this.emit("step-other", null);
67+
this.emit("step-other", undefined);
6868
resolve(true);
6969
}, reject);
7070
});

src/frontend/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ class MemoryContentProvider implements vscode.TextDocumentContentProvider {
111111
conn.write("examineMemory " + JSON.stringify([from, to - from + 1]));
112112
conn.once("data", data => {
113113
let formattedCode = " 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n";
114-
var index: number = from;
114+
let index: number = from;
115115
const hexString = data.toString();
116116
let x = 0;
117117
let asciiLine = "";
118118
let byteNo = 0;
119119
for (let i = 0; i < hexString.length; i += 2) {
120120
if (x == 0) {
121-
var addr = index.toString(16);
121+
let addr = index.toString(16);
122122
while (addr.length < 16) addr = '0' + addr;
123123
formattedCode += addr + " ";
124124
}
@@ -165,7 +165,7 @@ class MemoryContentProvider implements vscode.TextDocumentContentProvider {
165165
}
166166

167167
function center(str: string, width: number): string {
168-
var left = true;
168+
let left = true;
169169
while (str.length < width) {
170170
if (left) str = ' ' + str;
171171
else str = str + ' ';

src/gdb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class GDBDebugSession extends MI2DebugSession {
165165
if (substitutions) {
166166
Object.keys(substitutions).forEach(source => {
167167
this.miDebugger.extraCommands.push("gdb-set substitute-path \"" + escape(source) + "\" \"" + escape(substitutions[source]) + "\"");
168-
})
168+
});
169169
}
170170
}
171171
}

src/lldb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class LLDBDebugSession extends MI2DebugSession {
118118
if (substitutions) {
119119
Object.keys(substitutions).forEach(source => {
120120
this.miDebugger.extraCommands.push("settings append target.source-map " + source + " " + substitutions[source]);
121-
})
121+
});
122122
}
123123
}
124124
}

src/mibase.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class MI2DebugSession extends DebugSession {
5757
this.miDebugger.on("breakpoint", this.handleBreakpoint.bind(this));
5858
this.miDebugger.on("watchpoint", this.handleBreak.bind(this)); // consider to parse old/new, too (otherwise it is in the console only)
5959
this.miDebugger.on("step-end", this.handleBreak.bind(this));
60-
// this.miDebugger.on("step-out-end", this.handleBreak.bind(this)); // was combined into step-end
60+
//this.miDebugger.on("step-out-end", this.handleBreak.bind(this)); // was combined into step-end
6161
this.miDebugger.on("step-other", this.handleBreak.bind(this));
6262
this.miDebugger.on("signal-stop", this.handlePause.bind(this));
6363
this.miDebugger.on("thread-created", this.threadCreatedEvent.bind(this));
@@ -159,6 +159,7 @@ export class MI2DebugSession extends DebugSession {
159159

160160
if (this.serverPath)
161161
fs.unlink(this.serverPath, (err) => {
162+
// tslint:disable-next-line: no-console
162163
console.error("Failed to unlink debug server");
163164
});
164165
}
@@ -266,7 +267,7 @@ export class MI2DebugSession extends DebugSession {
266267
threads: []
267268
};
268269
for (const thread of threads) {
269-
let threadName = thread.name || thread.targetId || "<unnamed>";
270+
const threadName = thread.name || thread.targetId || "<unnamed>";
270271
response.body.threads.push(new Thread(thread.id, thread.id + ":" + threadName));
271272
}
272273
this.sendResponse(response);
@@ -353,7 +354,7 @@ export class MI2DebugSession extends DebugSession {
353354
//
354355
// If we don't send this event, the client may start requesting data (such as
355356
// stack frames, local variables, etc.) since they believe the target is
356-
// stopped. Furthermore the client may not be indicating the proper status
357+
// stopped. Furthermore, the client may not be indicating the proper status
357358
// to the user (may indicate stopped when the target is actually running).
358359
this.sendEvent(new ContinuedEvent(1, true));
359360
}));
@@ -392,7 +393,7 @@ export class MI2DebugSession extends DebugSession {
392393
const createScope = (scopeName: string, expensive: boolean): Scope => {
393394
const key: string = scopeName + ":" + threadId + ":" + level;
394395
let handle: number;
395-
396+
396397
if (this.scopeHandlesReverse.hasOwnProperty(key)) {
397398
handle = this.scopeHandlesReverse[key];
398399
} else {
@@ -401,7 +402,7 @@ export class MI2DebugSession extends DebugSession {
401402
}
402403

403404
return new Scope(scopeName, handle, expensive);
404-
}
405+
};
405406

406407
scopes.push(createScope("Local", false));
407408

@@ -505,7 +506,7 @@ export class MI2DebugSession extends DebugSession {
505506
// Variable members
506507
let variable;
507508
try {
508-
// TODO: this evals on an (effectively) unknown thread for multithreaded programs.
509+
// TODO: this evaluates on an (effectively) unknown thread for multithreaded programs.
509510
variable = await this.miDebugger.evalExpression(JSON.stringify(id), 0, 0);
510511
try {
511512
let expanded = expandValue(createVariable, variable.result("value"), id, variable);
@@ -563,7 +564,7 @@ export class MI2DebugSession extends DebugSession {
563564
this.sendResponse(response);
564565
};
565566
const addOne = async () => {
566-
// TODO: this evals on an (effectively) unknown thread for multithreaded programs.
567+
// TODO: this evaluates on an (effectively) unknown thread for multithreaded programs.
567568
const variable = await this.miDebugger.evalExpression(JSON.stringify(`${varReq.name}+${arrIndex})`), 0, 0);
568569
try {
569570
const expanded = expandValue(createVariable, variable.result("value"), varReq.name, variable);
@@ -709,7 +710,7 @@ export class MI2DebugSession extends DebugSession {
709710

710711
protected gotoTargetsRequest(response: DebugProtocol.GotoTargetsResponse, args: DebugProtocol.GotoTargetsArguments): void {
711712
const path: string = this.isSSH ? this.sourceFileMap.toRemotePath(args.source.path) : args.source.path;
712-
+ this.miDebugger.goto(path, args.line).then(done => {
713+
this.miDebugger.goto(path, args.line).then(done => {
713714
response.body = {
714715
targets: [{
715716
id: 1,

src/test/runTest.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
import * as path from 'path';
22

33
import { runTests } from 'vscode-test';
4+
// tslint:disable: no-console
45

56
async function main() {
6-
try {
7-
// The folder containing the Extension Manifest package.json
8-
// Passed to `--extensionDevelopmentPath`
9-
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
7+
try {
8+
// The folder containing the Extension Manifest package.json
9+
// Passed to `--extensionDevelopmentPath`
10+
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
1011

11-
// The path to the extension test runner script
12-
// Passed to --extensionTestsPath
13-
const extensionTestsPath = path.resolve(__dirname, './suite/index');
12+
// The path to the extension test runner script
13+
// Passed to `--extensionTestsPath`
14+
const extensionTestsPath = path.resolve(__dirname, './suite/index');
1415

15-
// Download VS Code, unzip it and run the integration test
16-
await runTests({ extensionDevelopmentPath, extensionTestsPath });
17-
} catch (err) {
18-
console.error(err);
19-
console.error('Failed to run tests');
20-
process.exit(1);
21-
}
16+
// Download VS Code, unzip it and run the integration test
17+
await runTests({ extensionDevelopmentPath, extensionTestsPath });
18+
} catch (err) {
19+
console.error(err);
20+
console.error('Failed to run tests');
21+
process.exit(1);
22+
}
2223
}
2324

24-
main();
25+
main();

src/test/suite/index.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ import * as Mocha from 'mocha';
33
import * as glob from 'glob';
44

55
export function run(): Promise<void> {
6-
// Create the mocha test
7-
const mocha = new Mocha({
8-
ui: 'tdd',
9-
useColors: true
10-
});
6+
// Create the mocha test
7+
const mocha = new Mocha({
8+
ui: 'tdd',
9+
useColors: true
10+
});
1111

12-
const testsRoot = path.resolve(__dirname, '..');
12+
const testsRoot = path.resolve(__dirname, '..');
1313

14-
return new Promise((c, e) => {
15-
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
16-
if (err) {
17-
return e(err);
18-
}
14+
return new Promise((c, e) => {
15+
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
16+
if (err) {
17+
return e(err);
18+
}
1919

20-
// Add files to the test suite
21-
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
20+
// Add files to the test suite
21+
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
2222

23-
try {
24-
// Run the mocha test
25-
mocha.run(failures => {
26-
if (failures > 0) {
27-
e(new Error(`${failures} tests failed.`));
28-
} else {
29-
c();
30-
}
31-
});
32-
} catch (err) {
33-
e(err);
34-
}
35-
});
36-
});
37-
}
23+
try {
24+
// Run the mocha test
25+
mocha.run(failures => {
26+
if (failures > 0) {
27+
e(new Error(`${failures} tests failed.`));
28+
} else {
29+
c();
30+
}
31+
});
32+
} catch (err) {
33+
e(err);
34+
}
35+
});
36+
});
37+
}

src/test/suite/mi_parse.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ suite("MI Parse", () => {
191191
test("empty string value first and last", () => {
192192
const parsed = parseMI(`15^done,register-names=["","r0","pc","","xpsr","","control",""]`);
193193
const result = parsed.result('register-names');
194-
assert.deepEqual(result, ["","r0","pc","","xpsr","","control", ""]);
194+
assert.deepEqual(result, ["", "r0", "pc", "", "xpsr", "", "control", ""]);
195195
});
196196
test("empty array values", () => {
197197
const parsed = parseMI(`15^done,foo={x=[],y="y"}`);

0 commit comments

Comments
 (0)