Skip to content

Commit fd4d6b7

Browse files
committed
fix: Avoid accidentally treating '' as valid
1 parent 5facab1 commit fd4d6b7

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

extensions/ql-vscode/src/archive-filesystem-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
169169
async readDirectory(uri: vscode.Uri): Promise<[string, vscode.FileType][]> {
170170
const ref = decodeSourceArchiveUri(uri);
171171
const archive = await this.getArchive(ref.sourceArchiveZipPath);
172-
let contents = archive.dirMap.get(ref.pathWithinSourceArchive);
172+
const contents = archive.dirMap.get(ref.pathWithinSourceArchive);
173173
const result = contents === undefined ? [] : Array.from(contents.entries());
174174
if (result === undefined) {
175175
throw vscode.FileSystemError.FileNotFound(uri);

extensions/ql-vscode/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ abstract class ConfigListener extends DisposableObject {
111111

112112
export class DistributionConfigListener extends ConfigListener implements DistributionConfig {
113113
public get customCodeQlPath(): string | undefined {
114-
return CUSTOM_CODEQL_PATH_SETTING.getValue() ? CUSTOM_CODEQL_PATH_SETTING.getValue() : undefined;
114+
return CUSTOM_CODEQL_PATH_SETTING.getValue() || undefined;
115115
}
116116

117117
public get includePrerelease(): boolean {
118118
return INCLUDE_PRERELEASE_SETTING.getValue();
119119
}
120120

121121
public get personalAccessToken(): string | undefined {
122-
return PERSONAL_ACCESS_TOKEN_SETTING.getValue() ? PERSONAL_ACCESS_TOKEN_SETTING.getValue() : undefined;
122+
return PERSONAL_ACCESS_TOKEN_SETTING.getValue() || undefined;
123123
}
124124

125125
public get onDidChangeDistributionConfiguration(): Event<void> {

extensions/ql-vscode/src/distribution.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class DistributionManager implements DistributionProvider {
9999
*/
100100
public async getCodeQlPathWithoutVersionCheck(): Promise<string | undefined> {
101101
// Check config setting, then extension specific distribution, then PATH.
102-
if (this._config.customCodeQlPath !== undefined) {
102+
if (this._config.customCodeQlPath) {
103103
if (!await fs.pathExists(this._config.customCodeQlPath)) {
104104
showAndLogErrorMessage(`The CodeQL executable path is specified as "${this._config.customCodeQlPath}" ` +
105105
"by a configuration setting, but a CodeQL executable could not be found at that path. Please check " +
@@ -520,8 +520,11 @@ export enum FindDistributionResultKind {
520520
NoDistribution
521521
}
522522

523-
export type FindDistributionResult = CompatibleDistributionResult | UnknownCompatibilityDistributionResult |
524-
IncompatibleDistributionResult | NoDistributionResult;
523+
export type FindDistributionResult =
524+
| CompatibleDistributionResult
525+
| UnknownCompatibilityDistributionResult
526+
| IncompatibleDistributionResult
527+
| NoDistributionResult;
525528

526529
interface CompatibleDistributionResult {
527530
codeQlPath: string;
@@ -551,8 +554,11 @@ export enum DistributionUpdateCheckResultKind {
551554
UpdateAvailable
552555
}
553556

554-
type DistributionUpdateCheckResult = AlreadyCheckedRecentlyResult | AlreadyUpToDateResult | InvalidLocationResult |
555-
UpdateAvailableResult;
557+
type DistributionUpdateCheckResult =
558+
| AlreadyCheckedRecentlyResult
559+
| AlreadyUpToDateResult
560+
| InvalidLocationResult
561+
| UpdateAvailableResult;
556562

557563
export interface AlreadyCheckedRecentlyResult {
558564
kind: DistributionUpdateCheckResultKind.AlreadyCheckedRecentlyResult;

0 commit comments

Comments
 (0)