Skip to content

Commit

Permalink
Fix Coverity code smells in V3 (#3312)
Browse files Browse the repository at this point in the history
* Fix Coverity code smells in V3

Signed-off-by: Timothy Johnson <[email protected]>

* Improve error handling in case profile is undefined

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>
  • Loading branch information
t1m0thyj and zFernand0 authored Nov 14, 2024
1 parent b3d654c commit fc799e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/zowe-explorer-api/src/fs/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class BaseProvider {
})
.then(async ({ userResponse }) => {
if (userResponse === "Retry" && opts?.retry?.fn != null) {
await opts.retry.fn(...(opts?.retry.args ?? []));
await opts.retry.fn(...(opts.retry.args ?? []));
}
})
.catch(() => {
Expand Down
8 changes: 4 additions & 4 deletions packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,12 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
comment: ["Data set name"],
}),
apiType: ZoweExplorerApiType.Mvs,
profileType: entry.metadata.profile.type,
profileType: entry.metadata.profile?.type,
retry: {
fn: this.writeFile.bind(this),
args: [uri, content, options],
},
templateArgs: { profileName: entry.metadata.profile.name ?? "" },
templateArgs: { profileName: entry.metadata.profile?.name ?? "" },
});
throw err;
}
Expand Down Expand Up @@ -664,7 +664,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
comment: ["File path"],
}),
apiType: ZoweExplorerApiType.Mvs,
profileType: entry.metadata.profile.type,
profileType: entry.metadata.profile?.type,
retry: {
fn: this.delete.bind(this),
args: [uri, _options],
Expand Down Expand Up @@ -711,7 +711,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
comment: ["Data set name"],
}),
apiType: ZoweExplorerApiType.Mvs,
profileType: entry.metadata.profile.type,
profileType: entry.metadata.profile?.type,
retry: {
fn: this.rename.bind(this),
args: [oldUri, newUri, options],
Expand Down
8 changes: 4 additions & 4 deletions packages/zowe-explorer/src/trees/uss/UssFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
fn: this.writeFile.bind(this),
args: [uri, content, options],
},
profileType: parentDir.metadata.profile.type,
templateArgs: { profileName: parentDir.metadata.profile.name ?? "" },
profileType: parentDir.metadata.profile?.type,
templateArgs: { profileName: parentDir.metadata.profile?.name ?? "" },
});
throw err;
}
Expand Down Expand Up @@ -611,8 +611,8 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
args: [uri, _options],
},
apiType: ZoweExplorerApiType.Uss,
profileType: parent.metadata.profile.type,
templateArgs: { profileName: parent.metadata.profile.name ?? "" },
profileType: parent.metadata.profile?.type,
templateArgs: { profileName: parent.metadata.profile?.name ?? "" },
});
throw err;
}
Expand Down

0 comments on commit fc799e3

Please sign in to comment.