[#13] Client: Use code analyzers

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-09-23 18:53:21 +03:00
parent d7dbbf8da8
commit d1271df207
102 changed files with 2168 additions and 733 deletions

View file

@ -4,7 +4,7 @@ using Frostfs.V2.Ape;
namespace FrostFS.SDK.ClientV2
{
public struct FrostFsChainTarget(FrostFsTargetType type, string name)
public struct FrostFsChainTarget(FrostFsTargetType type, string name) : IEquatable<FrostFsChainTarget>
{
private ChainTarget? chainTarget;
@ -33,5 +33,31 @@ namespace FrostFS.SDK.ClientV2
_ => throw new ArgumentException("Unexpected value for TargetType", nameof(type)),
};
}
public override readonly bool Equals(object obj)
{
var target = (FrostFsChainTarget)obj;
return Equals(target);
}
public override readonly int GetHashCode()
{
return $"{Name}{Type}".GetHashCode();
}
public static bool operator ==(FrostFsChainTarget left, FrostFsChainTarget right)
{
return left.Equals(right);
}
public static bool operator !=(FrostFsChainTarget left, FrostFsChainTarget right)
{
return !(left == right);
}
public readonly bool Equals(FrostFsChainTarget other)
{
return Type == other.Type && Name.Equals(other.Name, StringComparison.Ordinal);
}
}
}