V7012. The conditional expression always returns the same value.
V7012 [CWE-1041] The conditional expression always returns the same value. dragAndDropCommand.ts 86
....
if (this.selection.endColumn <= this.targetPosition.column) {
// The target position is after the selection's end position
this.targetSelection = new Selection(
this.targetPosition.lineNumber - this.selection.endLineNumber
+ this.selection.startLineNumber,
this.selection.startLineNumber === this.selection.endLineNumber
? this.targetPosition.column - this.selection.endColumn
+ this.selection.startColumn
: this.targetPosition.column - this.selection.endColumn
+ this.selection.startColumn, // <=
this.targetPosition.lineNumber,
this.selection.startLineNumber === this.selection.endLineNumber ?
this.targetPosition.column :
this.selection.endColumn
);
}
....
V7012 [CWE-1041] The conditional expression 'item.protocol === TunnelProtocol.Https ? TunnelProtocol.Https : TunnelProtocol.Https' always returns the same value. tunnelView.ts 997
private onFocusChanged(event: ITableEvent<ITunnelItem>) {
if (event.indexes.length > 0 && event.elements.length > 0) {
this.lastFocus = [...event.indexes];
}
const elements = event.elements;
const item = elements && elements.length ? elements[0] : undefined;
if (item) {
this.tunnelViewSelectionContext.set(
makeAddress(item.remoteHost, item.remotePort));
this.tunnelTypeContext.set(item.tunnelType);
this.tunnelCloseableContext.set(!!item.closeable);
this.tunnelPrivacyContext.set(item.privacy.id);
this.tunnelProtocolContext.set(item.protocol === TunnelProtocol.Https
? TunnelProtocol.Https
: TunnelProtocol.Https);
....
}
}
V7012 The conditional expression always returns the same value. inlineEditsWordReplacementView.ts 222
....
const editorBackground = getEditorBackgroundColor(this._viewData.editorType);
const primaryActionStyles = derived(
this,
r => alternativeActionActive.read(r)
? primaryActiveStyles
: primaryActiveStyles // <=
);
const secondaryActionStyles = derived(
this,
r => alternativeActionActive.read(r)
? secondaryActiveStyles
: passiveStyles
);
....
V7012 The conditional expression always returns the same value. nls-analysis.ts 186
for (const namedImport of namedImports) {
const isTarget =
namedImport.name.getText() === functionName || (namedImport.propertyName &&
namedImport.propertyName.getText() === functionName);
if (!isTarget) {
continue;
}
const searchName = namedImport.propertyName
? namedImport.name
: namedImport.name; // <=
const refs = service.getReferencesAtPosition(
filename,
searchName.pos + 1
) ?? [];
....
}