Skip to content

Commit f49df65

Browse files
sunnamed434claude
andcommitted
Use !x instead of x == false
Modernize boolean-negation conditionals across the codebase. Nullable cases (bool?, e.g. x?.Prop == false) are left as-is since ! doesn't apply to them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 00f37e0 commit f49df65

41 files changed

Lines changed: 81 additions & 81 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/BitMono.CLI/Modules/OptionsObfuscationNeedsFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace BitMono.CLI.Modules;
1+
namespace BitMono.CLI.Modules;
22

33
internal class OptionsObfuscationNeedsFactory
44
{
@@ -116,7 +116,7 @@ public OptionsObfuscationNeedsFactory(string[] args)
116116
// Multiple dependency directories may be passed via -l/--libraries; fall back to the
117117
// configured (or default "libs") directory when none are given.
118118
var librariesPaths = options.Libraries
119-
.Where(x => string.IsNullOrWhiteSpace(x) == false)
119+
.Where(x => !string.IsNullOrWhiteSpace(x))
120120
.Select(PathFormatterUtility.Format)
121121
.ToList();
122122
var referencesDirectories = librariesPaths.Count > 0

src/BitMono.Core/Analyzing/BamlCriticalAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using BitMono.Core.Analyzing.Baml;
1+
using BitMono.Core.Analyzing.Baml;
22
using BitMono.Core.Services;
33

44
namespace BitMono.Core.Analyzing;
@@ -33,13 +33,13 @@ public bool NotCriticalToMakeChanges(IMetadataMember member)
3333
return true;
3434
}
3535
var declaringType = GetDeclaringType(member);
36-
return declaringType == null || referencedTypes.Contains(declaringType) == false;
36+
return declaringType == null || !referencedTypes.Contains(declaringType);
3737
}
3838

3939
private HashSet<TypeDefinition> GetReferencedTypes(ModuleDefinition module)
4040
{
4141
// Computed once per module (BAML parsing is shared across protections and members).
42-
if (ReferenceEquals(_module, module) == false || _referencedTypes == null)
42+
if (!ReferenceEquals(_module, module) || _referencedTypes == null)
4343
{
4444
_module = module;
4545
_referencedTypes = WpfBamlReferenceResolver.ResolveReferencedTypes(module);

src/BitMono.Core/Analyzing/CriticalInterfacesCriticalAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public CriticalInterfacesCriticalAnalyzer(CriticalsSettings criticalsSettings)
1111

1212
public bool NotCriticalToMakeChanges(TypeDefinition type)
1313
{
14-
if (_criticalsSettings.UseCriticalInterfaces == false)
14+
if (!_criticalsSettings.UseCriticalInterfaces)
1515
{
1616
return true;
1717
}

src/BitMono.Core/Analyzing/CriticalMethodsCriticalAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ public CriticalMethodsCriticalAnalyzer(CriticalsSettings criticalsSettings)
1111

1212
public bool NotCriticalToMakeChanges(MethodDefinition method)
1313
{
14-
if (_criticalsSettings.UseCriticalMethods == false)
14+
if (!_criticalsSettings.UseCriticalMethods)
1515
{
1616
return true;
1717
}
1818
var criticalMethodNames = _criticalsSettings.CriticalMethods;
19-
return criticalMethodNames.Any(x => x.Equals(method.Name)) == false;
19+
return !criticalMethodNames.Any(x => x.Equals(method.Name));
2020
}
2121
}

src/BitMono.Core/Analyzing/CriticalMethodsStartsWithAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ public CriticalMethodsStartsWithAnalyzer(CriticalsSettings criticalsSettings)
1111

1212
public bool NotCriticalToMakeChanges(MethodDefinition method)
1313
{
14-
if (_criticalsSettings.UseCriticalMethodsStartsWith == false)
14+
if (!_criticalsSettings.UseCriticalMethodsStartsWith)
1515
{
1616
return true;
1717
}
1818

1919
var criticalMethodsStartWith = _criticalsSettings.CriticalMethodsStartsWith;
20-
return criticalMethodsStartWith.Any(c => c.StartsWith(method.Name)) == false;
20+
return !criticalMethodsStartWith.Any(c => c.StartsWith(method.Name));
2121
}
2222
}

src/BitMono.Core/Analyzing/ModelAttributeCriticalAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public ModelAttributeCriticalAnalyzer(CriticalsSettings criticalsSettings)
1313

1414
public bool NotCriticalToMakeChanges(IHasCustomAttribute customAttribute)
1515
{
16-
if (_criticalsSettings.UseCriticalModelAttributes == false)
16+
if (!_criticalsSettings.UseCriticalModelAttributes)
1717
{
1818
return true;
1919
}

src/BitMono.Core/Analyzing/NameCriticalAnalyzer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ public NameCriticalAnalyzer(
2424

2525
public bool NotCriticalToMakeChanges(TypeDefinition type)
2626
{
27-
if (_criticalInterfacesCriticalAnalyzer.NotCriticalToMakeChanges(type) == false)
27+
if (!_criticalInterfacesCriticalAnalyzer.NotCriticalToMakeChanges(type))
2828
{
2929
return false;
3030
}
31-
if (_criticalBaseTypesCriticalAnalyzer.NotCriticalToMakeChanges(type) == false)
31+
if (!_criticalBaseTypesCriticalAnalyzer.NotCriticalToMakeChanges(type))
3232
{
3333
return false;
3434
}
3535
return true;
3636
}
3737
public bool NotCriticalToMakeChanges(MethodDefinition method)
3838
{
39-
if (_criticalMethodsCriticalAnalyzer.NotCriticalToMakeChanges(method) == false)
39+
if (!_criticalMethodsCriticalAnalyzer.NotCriticalToMakeChanges(method))
4040
{
4141
return false;
4242
}
43-
if (_criticalMethodsStartsWithAnalyzer.NotCriticalToMakeChanges(method) == false)
43+
if (!_criticalMethodsStartsWithAnalyzer.NotCriticalToMakeChanges(method))
4444
{
4545
return false;
4646
}

src/BitMono.Core/Analyzing/RuntimeCriticalAnalyzer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ public bool NotCriticalToMakeChanges(IMetadataMember member)
77
{
88
if (member is TypeDefinition type)
99
{
10-
return type.IsRuntimeSpecialName == false;
10+
return !type.IsRuntimeSpecialName;
1111
}
1212
if (member is FieldDefinition field)
1313
{
14-
return field.IsRuntimeSpecialName == false
15-
&& field.IsLiteral == false
14+
return !field.IsRuntimeSpecialName
15+
&& !field.IsLiteral
1616
&& field.DeclaringType?.IsEnum == false;
1717
}
1818
if (member is MethodDefinition method)
1919
{
20-
return method.IsRuntimeSpecialName == false || method.DeclaringType?.IsForwarder == false;
20+
return !method.IsRuntimeSpecialName || method.DeclaringType?.IsForwarder == false;
2121
}
2222
if (member is EventDefinition @event)
2323
{
24-
return @event.IsRuntimeSpecialName == false;
24+
return !@event.IsRuntimeSpecialName;
2525
}
2626
return true;
2727
}

src/BitMono.Core/Analyzing/SerializableBitCriticalAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace BitMono.Core.Analyzing;
1+
namespace BitMono.Core.Analyzing;
22

33
[SuppressMessage("ReSharper", "ConvertIfStatementToReturnStatement")]
44
public class SerializableBitCriticalAnalyzer : ICriticalAnalyzer<TypeDefinition>
@@ -12,7 +12,7 @@ public SerializableBitCriticalAnalyzer(ObfuscationSettings obfuscationSettings)
1212

1313
public bool NotCriticalToMakeChanges(TypeDefinition type)
1414
{
15-
if (_obfuscationSettings.SerializableBitObfuscationExclude == false)
15+
if (!_obfuscationSettings.SerializableBitObfuscationExclude)
1616
{
1717
return true;
1818
}

src/BitMono.Core/Extensions/ProtectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static string GetName(this Type source, bool inherit = false)
6363
var protectionNameAttribute = source.GetCustomAttribute<ProtectionNameAttribute>(inherit);
6464
if (protectionNameAttribute != null)
6565
{
66-
return string.IsNullOrWhiteSpace(protectionNameAttribute.Name) == false
66+
return !string.IsNullOrWhiteSpace(protectionNameAttribute.Name)
6767
? protectionNameAttribute.Name
6868
: source.Name;
6969
}

0 commit comments

Comments
 (0)