Skip to content

Commit 7d23a83

Browse files
committed
Add semi-colon linting
1 parent 2583220 commit 7d23a83

24 files changed

+71
-70
lines changed

extensions/ql-vscode/.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
"indent": "off",
2929
"@typescript-eslint/indent": "off",
3030
"@typescript-eslint/no-throw-literal": "error",
31-
"no-useless-escape": 0
31+
"no-useless-escape": 0,
32+
"semi": 2
3233
},
3334
};

extensions/ql-vscode/src/adapt.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface RawResultSet {
3434
function adaptKind(kind: ColumnKind): ColumnType {
3535
// XXX what about 'u'?
3636
if (kind === 'e') {
37-
return { type: 'e', primitiveType: 's', locationStyle: LocationStyle.FivePart, hasLabel: true }
37+
return { type: 'e', primitiveType: 's', locationStyle: LocationStyle.FivePart, hasLabel: true };
3838
}
3939
else {
4040
return { type: kind };
@@ -51,7 +51,7 @@ export function adaptSchema(schema: ResultSetSchema): AdaptedSchema {
5151
name: schema.name,
5252
tupleCount: schema.rows,
5353
version: 0,
54-
}
54+
};
5555
}
5656

5757
export function adaptValue(val: ColumnValue): ResultValue {
@@ -87,7 +87,7 @@ export function adaptValue(val: ColumnValue): ResultValue {
8787
// something like the code in sarif-utils.ts?
8888
file: url.uri.replace(/file:/, ''),
8989
}
90-
}
90+
};
9191

9292
}
9393

@@ -99,5 +99,5 @@ export function adaptBqrs(schema: AdaptedSchema, page: DecodedBqrsChunk): RawRes
9999
return {
100100
schema,
101101
rows: page.tuples.map(adaptRow),
102-
}
102+
};
103103
}

extensions/ql-vscode/src/cli-version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function tryParseVersionString(versionString: string): Version | undefine
3434
patchVersion: Number.parseInt(match[3], 10),
3535
prereleaseVersion: match[4],
3636
rawString: versionString,
37-
}
37+
};
3838
}
3939

4040
/**

extensions/ql-vscode/src/cli.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class CodeQLCliServer implements Disposable {
165165
// If the server is not running a command run this immediately
166166
// otherwise add to the front of the queue (as we want to run this after the next command()).
167167
if (this.commandInProcess) {
168-
this.commandQueue.unshift(callback)
168+
this.commandQueue.unshift(callback);
169169
} else {
170170
callback();
171171
}
@@ -188,19 +188,19 @@ export class CodeQLCliServer implements Disposable {
188188
*/
189189
private async launchProcess(): Promise<child_process.ChildProcessWithoutNullStreams> {
190190
const config = await this.getCodeQlPath();
191-
return spawnServer(config, "CodeQL CLI Server", ["execute", "cli-server"], [], this.logger, _data => { /**/ })
191+
return spawnServer(config, "CodeQL CLI Server", ["execute", "cli-server"], [], this.logger, _data => { /**/ });
192192
}
193193

194194
private async runCodeQlCliInternal(command: string[], commandArgs: string[], description: string): Promise<string> {
195195
const stderrBuffers: Buffer[] = [];
196196
if (this.commandInProcess) {
197-
throw new Error("runCodeQlCliInternal called while cli was running")
197+
throw new Error("runCodeQlCliInternal called while cli was running");
198198
}
199199
this.commandInProcess = true;
200200
try {
201201
//Launch the process if it doesn't exist
202202
if (!this.process) {
203-
this.process = await this.launchProcess()
203+
this.process = await this.launchProcess();
204204
}
205205
// Grab the process so that typescript know that it is always defined.
206206
const process = this.process;
@@ -230,8 +230,8 @@ export class CodeQLCliServer implements Disposable {
230230
// Listen for process exit.
231231
process.addListener("close", (code) => reject(code));
232232
// Write the command followed by a null terminator.
233-
process.stdin.write(JSON.stringify(args), "utf8")
234-
process.stdin.write(this.nullBuffer)
233+
process.stdin.write(JSON.stringify(args), "utf8");
234+
process.stdin.write(this.nullBuffer);
235235
});
236236
// Join all the data together
237237
const fullBuffer = Buffer.concat(stdoutBuffers);
@@ -252,8 +252,8 @@ export class CodeQLCliServer implements Disposable {
252252
} finally {
253253
this.logger.log(Buffer.concat(stderrBuffers).toString("utf8"));
254254
// Remove the listeners we set up.
255-
process.stdout.removeAllListeners('data')
256-
process.stderr.removeAllListeners('data')
255+
process.stdout.removeAllListeners('data');
256+
process.stderr.removeAllListeners('data');
257257
process.removeAllListeners("close");
258258
}
259259
} finally {
@@ -349,7 +349,7 @@ export class CodeQLCliServer implements Disposable {
349349
try {
350350
yield JSON.parse(event) as EventType;
351351
} catch (err) {
352-
throw new Error(`Parsing output of ${description} failed: ${err.stderr || err}`)
352+
throw new Error(`Parsing output of ${description} failed: ${err.stderr || err}`);
353353
}
354354
}
355355
}
@@ -375,11 +375,11 @@ export class CodeQLCliServer implements Disposable {
375375
} catch (err) {
376376
reject(err);
377377
}
378-
}
378+
};
379379
// If the server is not running a command, then run the given command immediately,
380380
// otherwise add to the queue
381381
if (this.commandInProcess) {
382-
this.commandQueue.push(callback)
382+
this.commandQueue.push(callback);
383383
} else {
384384
callback();
385385
}
@@ -401,7 +401,7 @@ export class CodeQLCliServer implements Disposable {
401401
try {
402402
return JSON.parse(result) as OutputType;
403403
} catch (err) {
404-
throw new Error(`Parsing output of ${description} failed: ${err.stderr || err}`)
404+
throw new Error(`Parsing output of ${description} failed: ${err.stderr || err}`);
405405
}
406406
}
407407

@@ -535,12 +535,12 @@ export class CodeQLCliServer implements Disposable {
535535
try {
536536
output = await fs.readFile(interpretedResultsPath, 'utf8');
537537
} catch (err) {
538-
throw new Error(`Reading output of interpretation failed: ${err.stderr || err}`)
538+
throw new Error(`Reading output of interpretation failed: ${err.stderr || err}`);
539539
}
540540
try {
541541
return JSON.parse(output) as sarif.Log;
542542
} catch (err) {
543-
throw new Error(`Parsing output of interpretation failed: ${err.stderr || err}`)
543+
throw new Error(`Parsing output of interpretation failed: ${err.stderr || err}`);
544544
}
545545
}
546546

@@ -714,7 +714,7 @@ export async function runCodeQlCliCommand(codeQlPath: string, command: string[],
714714
logger.log(`CLI command succeeded.`);
715715
return result.stdout;
716716
} catch (err) {
717-
throw new Error(`${description} failed: ${err.stderr || err}`)
717+
throw new Error(`${description} failed: ${err.stderr || err}`);
718718
}
719719
}
720720

extensions/ql-vscode/src/databaseFetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function databaseFetcher(
4242
if (!storagePath) {
4343
throw new Error("No storage path specified.");
4444
}
45-
await fs.ensureDir(storagePath)
45+
await fs.ensureDir(storagePath);
4646
const unzipPath = await getStorageFolder(storagePath, databaseUrl);
4747

4848
const response = await fetch.default(databaseUrl);

extensions/ql-vscode/src/databases.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ async function findSourceArchive(
113113
databasePath: string, silent = false
114114
): Promise<vscode.Uri | undefined> {
115115

116-
const relativePaths = ['src', 'output/src_archive']
116+
const relativePaths = ['src', 'output/src_archive'];
117117

118118
for (const relativePath of relativePaths) {
119119
const basePath = path.join(databasePath, relativePath);
@@ -569,7 +569,7 @@ export class DatabaseManager extends DisposableObject {
569569
};
570570
const item = new DatabaseItemImpl(vscode.Uri.parse(state.uri), undefined, fullOptions,
571571
(item) => {
572-
this._onDidChangeDatabaseItem.fire(item)
572+
this._onDidChangeDatabaseItem.fire(item);
573573
});
574574
await this.addDatabaseItem(item);
575575

extensions/ql-vscode/src/definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async function getLinksForUriString(
158158
if (qlpack === undefined) {
159159
throw new Error("Can't infer qlpack from database source archive");
160160
}
161-
const links: FullLocationLink[] = []
161+
const links: FullLocationLink[] = [];
162162
for (const query of await resolveQueries(cli, qlpack, keyType)) {
163163
const templates: messages.TemplateDefinitions = {
164164
[TEMPLATE_NAME]: {

extensions/ql-vscode/src/distribution.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ const DEFAULT_DISTRIBUTION_REPOSITORY_NAME = "codeql-cli-binaries";
4242
export const DEFAULT_DISTRIBUTION_VERSION_CONSTRAINT: VersionConstraint = {
4343
description: "2.*.*",
4444
isVersionCompatible: (v: Version) => {
45-
return v.majorVersion === 2 && v.minorVersion >= 0
45+
return v.majorVersion === 2 && v.minorVersion >= 0;
4646
}
47-
}
47+
};
4848

4949
export interface DistributionProvider {
5050
getCodeQlPathWithoutVersionCheck(): Promise<string | undefined>;
@@ -86,7 +86,7 @@ export class DistributionManager implements DistributionProvider {
8686
return {
8787
codeQlPath,
8888
kind: FindDistributionResultKind.UnknownCompatibilityDistribution,
89-
}
89+
};
9090
}
9191
return {
9292
codeQlPath,
@@ -480,7 +480,7 @@ export class ReleasesApiConsumer {
480480
// mechanism is provided.
481481
delete headers["authorization"];
482482
}
483-
return await this.makeRawRequest(redirectUrl, headers, redirectCount + 1)
483+
return await this.makeRawRequest(redirectUrl, headers, redirectCount + 1);
484484
}
485485

486486
return response;

extensions/ql-vscode/src/helpers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async function internalShowAndLog(message: string, items: string[], outputLogger
116116
*/
117117
export async function showBinaryChoiceDialog(message: string): Promise<boolean> {
118118
const yesItem = { title: 'Yes', isCloseAffordance: false };
119-
const noItem = { title: 'No', isCloseAffordance: true }
119+
const noItem = { title: 'No', isCloseAffordance: true };
120120
const chosenItem = await Window.showInformationMessage(message, { modal: true }, yesItem, noItem);
121121
return chosenItem === yesItem;
122122
}
@@ -140,7 +140,7 @@ export function getOnDiskWorkspaceFolders() {
140140
const diskWorkspaceFolders: string[] = [];
141141
for (const workspaceFolder of workspaceFolders) {
142142
if (workspaceFolder.uri.scheme === "file")
143-
diskWorkspaceFolders.push(workspaceFolder.uri.fsPath)
143+
diskWorkspaceFolders.push(workspaceFolder.uri.fsPath);
144144
}
145145
return diskWorkspaceFolders;
146146
}
@@ -271,7 +271,7 @@ export async function getQlPackForDbscheme(cliServer: CodeQLCliServer, dbschemeP
271271
return {
272272
packName,
273273
packDir: dirs[0]
274-
}
274+
};
275275
});
276276
for (const { packDir, packName } of packs) {
277277
if (packDir !== undefined) {
@@ -285,7 +285,7 @@ export async function getQlPackForDbscheme(cliServer: CodeQLCliServer, dbschemeP
285285
}
286286

287287
export async function resolveDatasetFolder(cliServer: CodeQLCliServer, datasetFolder: string): Promise<DatasetFolderInfo> {
288-
const dbschemes = await glob(path.join(datasetFolder, '*.dbscheme'))
288+
const dbschemes = await glob(path.join(datasetFolder, '*.dbscheme'));
289289

290290
if (dbschemes.length < 1) {
291291
throw new Error(`Can't find dbscheme for current database in ${datasetFolder}`);
@@ -322,7 +322,7 @@ export class CachedOperation<U> {
322322
const fromCache = this.cached.get(t);
323323
if (fromCache !== undefined) {
324324
// Move to end of lru list
325-
this.lru.push(this.lru.splice(this.lru.findIndex(v => v === t), 1)[0])
325+
this.lru.push(this.lru.splice(this.lru.findIndex(v => v === t), 1)[0]);
326326
return fromCache;
327327
}
328328
// Otherwise check if in progress

extensions/ql-vscode/src/query-history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export class QueryHistoryManager {
305305
// displays query text in a read-only document
306306
vscode.workspace.registerTextDocumentContentProvider('codeql', {
307307
provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> {
308-
const params = new URLSearchParams(uri.query)
308+
const params = new URLSearchParams(uri.query);
309309

310310
return (
311311
JSON.parse(params.get('isQuickEval') || '') ? SHOW_QUERY_TEXT_QUICK_EVAL_MSG : SHOW_QUERY_TEXT_MSG

0 commit comments

Comments
 (0)