Вебинар: Стратегия без иллюзий: как превращать цели в результаты - 19.08
V3029. The conditional expressions of the 'if' statements situated alongside each other are identical.
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 364, 369. TransitionBlock.cs 364
public void ComputeReturnValueTreatment(....)
{
....
if (descriptor.passedInRegisters)
{
if (descriptor.eightByteCount == 1)
{
if (descriptor.eightByteClassifications0
== SystemVClassificationType.SystemVClassificationTypeSSE)
{
// Structs occupying just one eightbyte are treated as int / double
fpReturnSize = sizeof(double);
}
}
else
{
// Size of the struct is 16 bytes
fpReturnSize = 16;
// The lowest two bits of the size encode
// the order of the int and SSE fields
if (descriptor.eightByteClassifications0 // <=
== SystemVClassificationType.SystemVClassificationTypeSSE)
{
fpReturnSize += 1;
}
if (descriptor.eightByteClassifications0 // <=
== SystemVClassificationType.SystemVClassificationTypeSSE)
{
fpReturnSize += 2;
}
}
break;
}
....
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 1264, 1267. EncodingManager.cs 1264
....
using (var process = new Process())
{
process.StartInfo = procStartInfo;
process.Start();
var message = await process.StandardOutput.ReadToEndAsync();
var error = await process.StandardError.ReadToEndAsync();
if (!string.IsNullOrWhiteSpace(message))
output += message + Environment.NewLine;
if (!string.IsNullOrWhiteSpace(message))
output += message + Environment.NewLine;
process.WaitForExit(1000);
}
....
SetCommand(id, true, command, output);
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 41, 43. GetObjectTorrentRequestMarshaller.cs 41
public IRequest Marshall(GetObjectTorrentRequest getObjectTorrentRequest)
{
....
if (getObjectTorrentRequest.IsSetRequestPayer())
request.Headers
.Add(S3Constants.AmzHeaderRequestPayer,
S3Transforms.ToStringValue(getObjectTorrentRequest.RequestPayer
.ToString()));
if (getObjectTorrentRequest.IsSetRequestPayer())
request.Headers
.Add(S3Constants.AmzHeaderRequestPayer,
S3Transforms.ToStringValue(getObjectTorrentRequest.RequestPayer
.ToString()));
....
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 59, 64. BTCpayMiddleware.cs 59
public async Task Invoke(HttpContext httpContext)
{
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
try
{
var bitpayAuth = GetBitpayAuth(httpContext, out bool isBitpayAuth);
var isBitpayAPI = IsBitpayAPI(httpContext, isBitpayAuth);
if (isBitpayAPI && httpContext.Request.Method == "OPTIONS")
{
httpContext.Response.StatusCode = 200;
httpContext.Response.SetHeader("Access-Control-Allow-Origin", "*");
if (httpContext.Request.Headers.ContainsKey("...."))
{
httpContext.Response.SetHeader("Access-Control-Allow-Headers",
httpContext.Request.Headers["...."].FirstOrDefault());
}
return; // We bypass MVC completely
}
httpContext.SetIsBitpayAPI(isBitpayAPI);
if (isBitpayAPI) // <=
{
httpContext.Response.SetHeader("Access-Control-Allow-Origin", "*");
httpContext.SetBitpayAuth(bitpayAuth);
}
if (isBitpayAPI) // <=
{
await _Next(httpContext);
return;
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 722, 728. BuiltinTools.cs 722
static Vector3 ResizeHandlesGUI(....)
{
....
Vector3 scale = Vector3.one;
....
if (uniformScaling) // <=
{
float refScale = (xHandle == 1 ? scale.y : scale.x);
scale = Vector3.one * refScale;
}
if (uniformScaling) // <=
{
float refScale = (xHandle == 1 ? scale.y : scale.x);
scale = Vector3.one * refScale;
}
....
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 930, 933. ZoomableArea.cs 930
public void SetScaleFocused(Vector2 focalPoint,
Vector2 newScale,
bool lockHorizontal,
bool lockVertical)
{
if (uniformScale)
lockHorizontal = lockVertical = false;
else
{
if (hZoomLockedByDefault)
lockHorizontal = !lockHorizontal;
if (hZoomLockedByDefault)
lockVertical = !lockVertical;
}
....
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 50, 57. AssetFolderDto.cs 50
private static AssetFolderDto CreateLinks(AssetFolderDto response,
Resources resources)
{
var values = new { app = resources.App, id = response.Id };
if (resources.CanUpdateAsset)
{
response.AddPutLink("update", resources.Url<AssetFoldersController>(x =>
nameof(x.PutAssetFolder), values));
response.AddPutLink("move", resources.Url<AssetFoldersController>(x =>
nameof(x.PutAssetFolderParent), values));
}
if (resources.CanUpdateAsset)
{
response.AddDeleteLink("delete", resources.Url<AssetFoldersController>(x =>
nameof(x.DeleteAssetFolder), values));
}
return response;
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 142, 152. LocalImageProvider.cs 142
private void PopulateImages(....)
{
....
// Logo
if (!isEpisode && !isSong && !isPerson)
{
added = AddImage(....);
if (!added)
{
added = AddImage(....);
}
}
// Art
if (!isEpisode && !isSong && !isPerson)
{
AddImage(....);
}
....
}
V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 91, 95. AWSSDK.AppSync.Net45 CreateApiKeyResponseUnmarshaller.cs 91
public override AmazonServiceException UnmarshallException(....)
{
....
if (errorResponse.Code != null &&
errorResponse.Code.Equals("LimitExceededException"))
{
return new LimitExceededException(errorResponse.Message,
innerException, errorResponse.Type, errorResponse.Code,
errorResponse.RequestId, statusCode);
}
if (errorResponse.Code != null &&
errorResponse.Code.Equals("LimitExceededException"))
{
return new LimitExceededException(errorResponse.Message,
innerException, errorResponse.Type, errorResponse.Code,
errorResponse.RequestId, statusCode);
}
....
}
Similar errors can be found in some other places:
V3029 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 338, 339. Program.cs 42
public void OnPropertyChanged(PropertyChangedEventArgs ea) {
....
var index = this.SelectedBrushCollectionIndex;
....
if (index >= 0) {
DebugManager.
LogData(this.BrushCollectionList[index].ToText());
}
if (index >= 0) {
this.SelectedBrushCollectionIndex = index;
}
....
}
V3029 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 223, 228. EditAndContinueTestHelpers.cs 223
internal void VerifySemantics(....)
{
....
if (additionalOldSources != null)
{
oldTrees = oldTrees.Concat(
additionalOldSources.Select(s => ParseText(s)));
}
if (additionalOldSources != null)
{
newTrees = newTrees.Concat(
additionalNewSources.Select(s => ParseText(s)));
}
....
}