Skip to content

Commit f90c6a9

Browse files
committed
Fix: sonarqube smells
1 parent 0673e8c commit f90c6a9

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/System.Net.IPNetwork/CidrClassLess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed class CidrClassLess : ICidrGuess
2323
public bool TryGuessCidr(string ip, out byte cidr)
2424
{
2525
bool parsed = IPAddress.TryParse($"{ip}", out IPAddress ipaddress);
26-
if (parsed == false)
26+
if (!parsed)
2727
{
2828
cidr = 0;
2929
return false;

src/System.Net.IPNetwork/IPNetwork2Subnet.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ internal static void InternalSubnet(bool trySubnet, IPNetwork2 network, byte cid
9494
{
9595
if (network == null)
9696
{
97-
if (trySubnet == false)
97+
if (!trySubnet)
9898
{
9999
throw new ArgumentNullException(nameof(network));
100100
}
@@ -106,7 +106,7 @@ internal static void InternalSubnet(bool trySubnet, IPNetwork2 network, byte cid
106106
int maxCidr = network.family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
107107
if (cidr > maxCidr)
108108
{
109-
if (trySubnet == false)
109+
if (!trySubnet)
110110
{
111111
throw new ArgumentOutOfRangeException(nameof(cidr));
112112
}
@@ -117,7 +117,7 @@ internal static void InternalSubnet(bool trySubnet, IPNetwork2 network, byte cid
117117

118118
if (cidr < network.Cidr)
119119
{
120-
if (trySubnet == false)
120+
if (!trySubnet)
121121
{
122122
throw new ArgumentException("cidr");
123123
}

src/System.Net.IPNetwork/IPNetwork2Supernet.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ internal static void InternalSupernet(
9393
{
9494
if (network1 == null)
9595
{
96-
if (trySupernet == false)
96+
if (!trySupernet)
9797
{
9898
throw new ArgumentNullException(nameof(network1));
9999
}
@@ -104,7 +104,7 @@ internal static void InternalSupernet(
104104

105105
if (network2 == null)
106106
{
107-
if (trySupernet == false)
107+
if (!trySupernet)
108108
{
109109
throw new ArgumentNullException(nameof(network2));
110110
}
@@ -127,7 +127,7 @@ internal static void InternalSupernet(
127127

128128
if (network1.cidr != network2.cidr)
129129
{
130-
if (trySupernet == false)
130+
if (!trySupernet)
131131
{
132132
throw new ArgumentException("cidr");
133133
}
@@ -147,7 +147,7 @@ internal static void InternalSupernet(
147147
// last is the higher subnet
148148
if ((first.InternalBroadcast + 1) != last.InternalNetwork)
149149
{
150-
if (trySupernet == false)
150+
if (!trySupernet)
151151
{
152152
throw new ArgumentOutOfRangeException(nameof(network1));
153153
}
@@ -162,7 +162,7 @@ internal static void InternalSupernet(
162162
var networkSupernet = new IPNetwork2(uintSupernet, first.family, cidrSupernet);
163163
if (networkSupernet.InternalNetwork != first.InternalNetwork)
164164
{
165-
if (trySupernet == false)
165+
if (!trySupernet)
166166
{
167167
throw new ArgumentException("network");
168168
}

src/System.Net.IPNetwork/IPNetwork2SupernetArray.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal static bool InternalSupernet(bool trySupernet, IPNetwork2[] ipnetworks,
4949
{
5050
if (ipnetworks == null)
5151
{
52-
if (trySupernet == false)
52+
if (!trySupernet)
5353
{
5454
throw new ArgumentNullException(nameof(ipnetworks));
5555
}

src/System.Net.IPNetwork/IPNetwork2ToNetmask.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ internal static void InternalToNetmask(bool tryParse, byte cidr, AddressFamily f
6161
if (family != AddressFamily.InterNetwork
6262
&& family != AddressFamily.InterNetworkV6)
6363
{
64-
if (tryParse == false)
64+
if (!tryParse)
6565
{
6666
throw new ArgumentException("family");
6767
}
@@ -73,7 +73,7 @@ internal static void InternalToNetmask(bool tryParse, byte cidr, AddressFamily f
7373
int maxCidr = family == AddressFamily.InterNetwork ? 32 : 128;
7474
if (cidr > maxCidr)
7575
{
76-
if (tryParse == false)
76+
if (!tryParse)
7777
{
7878
throw new ArgumentOutOfRangeException(nameof(cidr));
7979
}

0 commit comments

Comments
 (0)