Skip to content

Commit 8b1e49c

Browse files
Use more descriptive names
1 parent fe21a21 commit 8b1e49c

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

extensions/ql-vscode/src/pure/files.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ export function pathsEqual(
7272
}
7373

7474
/**
75-
* Returns true if path1 contains path2.
75+
* Returns true if `parent` contains `child`.
7676
*/
7777
export function containsPath(
78-
path1: string,
79-
path2: string,
78+
parent: string,
79+
child: string,
8080
platform: NodeJS.Platform,
8181
): boolean {
82-
return normalizePath(path2, platform).startsWith(
83-
normalizePath(path1, platform),
82+
return normalizePath(child, platform).startsWith(
83+
normalizePath(parent, platform),
8484
);
8585
}
8686

extensions/ql-vscode/test/unit-tests/pure/files.test.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -207,95 +207,95 @@ describe("pathsEqual", () => {
207207

208208
describe("containsPath", () => {
209209
const testCases: Array<{
210-
path1: string;
211-
path2: string;
210+
parent: string;
211+
child: string;
212212
platform: NodeJS.Platform;
213213
expected: boolean;
214214
}> = [
215215
{
216-
path1:
216+
parent:
217217
"/home/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
218-
path2:
218+
child:
219219
"/home/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
220220
platform: "linux",
221221
expected: true,
222222
},
223223
{
224-
path1:
224+
parent:
225225
"/HOME/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
226-
path2:
226+
child:
227227
"/home/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
228228
platform: "linux",
229229
expected: false,
230230
},
231231
{
232-
path1:
232+
parent:
233233
"/home/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
234-
path2:
234+
child:
235235
"/home/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
236236
platform: "linux",
237237
expected: false,
238238
},
239239
{
240-
path1:
240+
parent:
241241
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
242-
path2:
242+
child:
243243
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
244244
platform: "win32",
245245
expected: true,
246246
},
247247
{
248-
path1:
248+
parent:
249249
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
250-
path2:
250+
child:
251251
"c:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
252252
platform: "win32",
253253
expected: true,
254254
},
255255
{
256-
path1:
256+
parent:
257257
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
258-
path2:
258+
child:
259259
"D:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
260260
platform: "win32",
261261
expected: false,
262262
},
263263
{
264-
path1:
264+
parent:
265265
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
266-
path2:
266+
child:
267267
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
268268
platform: "win32",
269269
expected: false,
270270
},
271271
{
272-
path1:
272+
parent:
273273
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
274-
path2:
274+
child:
275275
"C:\\Users\\github\\projects\\vscode-codeql-starter\\codeql-custom-queries-javascript\\example.ql",
276276
platform: "win32",
277277
expected: true,
278278
},
279279
{
280-
path1:
280+
parent:
281281
"C:/Users/github/projects/vscode-codeql-starter/codeql-custom-queries-javascript",
282-
path2:
282+
child:
283283
"D:\\Users\\github\\projects\\vscode-codeql-starter\\codeql-custom-queries-javascript\\example.ql",
284284
platform: "win32",
285285
expected: false,
286286
},
287287
];
288288

289289
test.each(testCases)(
290-
"$path1 contains $path2 on $platform = $expected",
291-
({ path1, path2, platform, expected }) => {
290+
"$parent contains $child on $platform = $expected",
291+
({ parent, child, platform, expected }) => {
292292
if (platform !== process.platform) {
293293
// We're using the platform-specific path.resolve, so we can't really run
294294
// these tests on all platforms.
295295
return;
296296
}
297297

298-
expect(containsPath(path1, path2, platform)).toEqual(expected);
298+
expect(containsPath(parent, child, platform)).toEqual(expected);
299299
},
300300
);
301301
});

0 commit comments

Comments
 (0)