Add null and braces preferences to .editorconfig
MODIFY
.editorconfig
.editorconfig
@@ -94,6 +94,12 @@ csharp_prefer_simple_default_expression = true : error
csharp_indent_case_contents = true:warning
csharp_indent_switch_labels = true:warning
+#prefer 'is null' for reference equality checks
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error
+
+#prefer braces
+csharp_prefer_braces = true:error
+
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -416,7 +416,10 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
var fingerprint = keyManager.MasterFingerprint;
- if (fingerprint is null) return (false, "This wallet is a watch-only wallet.");
+ if (fingerprint is null)
+ {
+ return (false, "This wallet is a watch-only wallet.");
+ }
keyManager.HardwareWalletInfo = hwis.FirstOrDefault(x => x.MasterFingerprint == fingerprint);

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletActionViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletActionViewModel.cs
@@ -54,7 +54,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
while (!IsClosed)
{
if (!IsSelected) // Prevent de-selection of tab.
+ {
Select();
+ }
await Task.Delay(100);
}
return DialogResult;

MODIFY
WalletWasabi.Gui/Helpers/ShellUtils.cs
WalletWasabi.Gui/Helpers/ShellUtils.cs
@@ -122,7 +122,9 @@ namespace WalletWasabi.Gui.Helpers
public static string ResolveFullExecutablePath(string fileName, bool returnNullOnFailure = true, params string[] extraPaths)
{
if (File.Exists(fileName))
+ {
return Path.GetFullPath(fileName);
+ }
if (ExecutorType == ShellType.Windows)
{
@@ -133,9 +135,11 @@ namespace WalletWasabi.Gui.Helpers
{
var fullPath = Path.Combine(path, fileName);
if (File.Exists(fullPath))
+ {
return fullPath;
}
}
+ }
else
{
//Use the which command

MODIFY
WalletWasabi.Gui/MainWindow.xaml.cs
WalletWasabi.Gui/MainWindow.xaml.cs
@@ -55,7 +55,10 @@ namespace WalletWasabi.Gui
protected override void OnDataContextEndUpdate()
{
if (Global is null)
+ {
return;
+ }
+
Application.Current.Resources.AddOrReplace(Global.GlobalResourceKey, Global);
Application.Current.Resources.AddOrReplace(Global.ConfigResourceKey, Global.Config);
Application.Current.Resources.AddOrReplace(Global.UiConfigResourceKey, Global.UiConfig);

MODIFY
WalletWasabi.Tests/ExternalApiTests.cs
WalletWasabi.Tests/ExternalApiTests.cs
@@ -60,7 +60,7 @@ namespace WalletWasabi.Tests
{
response = await client.GetGeneralInformationAsync(CancellationToken.None);
}
- catch // stupid CI internet conenction sometimes fails
+ catch // stupid CI internet connection sometimes fails
{
await Task.Delay(3000);
response = await client.GetGeneralInformationAsync(CancellationToken.None);

MODIFY
WalletWasabi.Tests/StoreTests.cs
WalletWasabi.Tests/StoreTests.cs
@@ -378,14 +378,20 @@ namespace WalletWasabi.Tests
bool IsStringArraysEqual(string[] lines1, string[] lines2)
{
- if (lines1.Length != lines2.Length) return false;
+ if (lines1.Length != lines2.Length)
+ {
+ return false;
+ }
for (int i = 0; i < lines1.Length; i++)
{
string line = lines2[i];
var readline = lines1[i];
- if (!line.Equals(readline)) return false;
+ if (!line.Equals(readline))
+ {
+ return false;
+ }
}
return true;
}

MODIFY
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
@@ -19,7 +19,10 @@ namespace NBitcoin
public static async Task<Block> DownloadBlockAsync(this Node node, uint256 hash, CancellationToken cancellationToken)
{
if (node.State == NodeState.Connected)
+ {
node.VersionHandshake(cancellationToken);
+ }
+
using (var listener = node.CreateListener())
{
var getdata = new GetDataPayload(new InventoryVector(node.AddSupportedOptions(InventoryType.MSG_BLOCK), hash));

MODIFY
WalletWasabi/Helpers/NBitcoinHelpers.cs
WalletWasabi/Helpers/NBitcoinHelpers.cs
@@ -88,7 +88,9 @@ namespace WalletWasabi.Helpers
var actual = Hashes.Hash256(data);
var expected = new uint256(hash);
if (expected != actual)
+ {
throw new FormatException("Invalid address manager file");
+ }
BitcoinStream stream = new BitcoinStream(data);
stream.Type = SerializationType.Disk;

MODIFY
WalletWasabi/Nito/AsyncEx/AsyncMutex.cs
WalletWasabi/Nito/AsyncEx/AsyncMutex.cs
@@ -148,7 +148,9 @@ namespace Nito.AsyncEx
while (true)
{
if (DateTime.Now - start > TimeSpan.FromSeconds(90))
+ {
throw new TimeoutException("Could not acquire mutex in time");
+ }
// Block for n ms and try to acquire the mutex. Blocking is not a problem
// we are on our own thread.
acquired = Mutex.WaitOne(1000);

Add null and braces preferences to .editorconfig