mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
Warning if not using 'is not null'
This commit is contained in:
parent
5cbc2e96e7
commit
c6a7e90c1a
9 changed files with 13 additions and 11 deletions
|
@ -121,8 +121,10 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
csharp_space_between_parentheses = false
|
csharp_space_between_parentheses = false
|
||||||
csharp_space_between_square_brackets = false
|
csharp_space_between_square_brackets = false
|
||||||
|
csharp_style_prefer_null_check_over_type_check = true:warning
|
||||||
|
|
||||||
# C++ Files
|
# C++ Files
|
||||||
|
|
||||||
[*.{cpp,h,in}]
|
[*.{cpp,h,in}]
|
||||||
curly_bracket_next_line = true
|
curly_bracket_next_line = true
|
||||||
indent_brace_style = Allman
|
indent_brace_style = Allman
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace BTCPayServer.Client.JsonConverters
|
||||||
|
|
||||||
public override void WriteJson(JsonWriter writer, [AllowNull] NodeInfo value, JsonSerializer serializer)
|
public override void WriteJson(JsonWriter writer, [AllowNull] NodeInfo value, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
if (value is NodeInfo)
|
if (value is not null)
|
||||||
writer.WriteValue(value.ToString());
|
writer.WriteValue(value.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace BTCPayServer.Services.Rates
|
||||||
{
|
{
|
||||||
LastRequested = LastRequested
|
LastRequested = LastRequested
|
||||||
};
|
};
|
||||||
if (_Latest is LatestFetch fetch && fetch.Latest is PairRate[])
|
if (_Latest is LatestFetch fetch && fetch.Latest is not null)
|
||||||
{
|
{
|
||||||
state.LastUpdated = fetch.Updated;
|
state.LastUpdated = fetch.Updated;
|
||||||
state.Rates = fetch.Latest
|
state.Rates = fetch.Latest
|
||||||
|
|
|
@ -479,7 +479,7 @@ namespace BTCPayServer.Tests
|
||||||
currencyEl.Clear();
|
currencyEl.Clear();
|
||||||
currencyEl.SendKeys(currency);
|
currencyEl.SendKeys(currency);
|
||||||
Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail);
|
Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail);
|
||||||
if (defaultPaymentMethod is string)
|
if (defaultPaymentMethod is not null)
|
||||||
new SelectElement(Driver.FindElement(By.Name("DefaultPaymentMethod"))).SelectByValue(defaultPaymentMethod);
|
new SelectElement(Driver.FindElement(By.Name("DefaultPaymentMethod"))).SelectByValue(defaultPaymentMethod);
|
||||||
if (requiresRefundEmail is bool)
|
if (requiresRefundEmail is bool)
|
||||||
new SelectElement(Driver.FindElement(By.Name("RequiresRefundEmail"))).SelectByValue(requiresRefundEmail == true ? "1" : "2");
|
new SelectElement(Driver.FindElement(By.Name("RequiresRefundEmail"))).SelectByValue(requiresRefundEmail == true ? "1" : "2");
|
||||||
|
|
|
@ -500,21 +500,21 @@ namespace BTCPayServer.Controllers
|
||||||
var enabledPaymentIds = store.GetEnabledPaymentIds(_NetworkProvider);
|
var enabledPaymentIds = store.GetEnabledPaymentIds(_NetworkProvider);
|
||||||
PaymentMethodId? invoicePaymentId = invoice.GetDefaultPaymentMethod();
|
PaymentMethodId? invoicePaymentId = invoice.GetDefaultPaymentMethod();
|
||||||
PaymentMethodId? storePaymentId = store.GetDefaultPaymentId();
|
PaymentMethodId? storePaymentId = store.GetDefaultPaymentId();
|
||||||
if (invoicePaymentId is PaymentMethodId)
|
if (invoicePaymentId is not null)
|
||||||
{
|
{
|
||||||
if (enabledPaymentIds.Contains(invoicePaymentId))
|
if (enabledPaymentIds.Contains(invoicePaymentId))
|
||||||
paymentMethodId = invoicePaymentId;
|
paymentMethodId = invoicePaymentId;
|
||||||
}
|
}
|
||||||
if (paymentMethodId is null && storePaymentId is PaymentMethodId)
|
if (paymentMethodId is null && storePaymentId is not null)
|
||||||
{
|
{
|
||||||
if (enabledPaymentIds.Contains(storePaymentId))
|
if (enabledPaymentIds.Contains(storePaymentId))
|
||||||
paymentMethodId = storePaymentId;
|
paymentMethodId = storePaymentId;
|
||||||
}
|
}
|
||||||
if (paymentMethodId is null && invoicePaymentId is PaymentMethodId)
|
if (paymentMethodId is null && invoicePaymentId is not null)
|
||||||
{
|
{
|
||||||
paymentMethodId = invoicePaymentId.FindNearest(enabledPaymentIds);
|
paymentMethodId = invoicePaymentId.FindNearest(enabledPaymentIds);
|
||||||
}
|
}
|
||||||
if (paymentMethodId is null && storePaymentId is PaymentMethodId)
|
if (paymentMethodId is null && storePaymentId is not null)
|
||||||
{
|
{
|
||||||
paymentMethodId = storePaymentId.FindNearest(enabledPaymentIds);
|
paymentMethodId = storePaymentId.FindNearest(enabledPaymentIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,7 +419,7 @@ namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
var enabled = storeData.GetEnabledPaymentIds(_NetworkProvider);
|
var enabled = storeData.GetEnabledPaymentIds(_NetworkProvider);
|
||||||
var defaultPaymentId = storeData.GetDefaultPaymentId();
|
var defaultPaymentId = storeData.GetDefaultPaymentId();
|
||||||
var defaultChoice = defaultPaymentId is PaymentMethodId ? defaultPaymentId.FindNearest(enabled) : null;
|
var defaultChoice = defaultPaymentId is not null ? defaultPaymentId.FindNearest(enabled) : null;
|
||||||
if (defaultChoice is null)
|
if (defaultChoice is null)
|
||||||
{
|
{
|
||||||
defaultChoice = enabled.FirstOrDefault(e => e.CryptoCode == "BTC" && e.PaymentType == PaymentTypes.BTCLike) ??
|
defaultChoice = enabled.FirstOrDefault(e => e.CryptoCode == "BTC" && e.PaymentType == PaymentTypes.BTCLike) ??
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace BTCPayServer
|
||||||
// but we want searchTerm to be null only if the user is browsing the page via some link
|
// but we want searchTerm to be null only if the user is browsing the page via some link
|
||||||
// NOT if the user entered some empty search
|
// NOT if the user entered some empty search
|
||||||
var searchTerm = model.SearchTerm;
|
var searchTerm = model.SearchTerm;
|
||||||
searchTerm = searchTerm is string ? searchTerm :
|
searchTerm = searchTerm is not null ? searchTerm :
|
||||||
ctrl.Request.Query.ContainsKey(nameof(searchTerm)) ? string.Empty :
|
ctrl.Request.Query.ContainsKey(nameof(searchTerm)) ? string.Empty :
|
||||||
null;
|
null;
|
||||||
if (searchTerm is null)
|
if (searchTerm is null)
|
||||||
|
|
|
@ -254,7 +254,7 @@ namespace BTCPayServer.HostedServices
|
||||||
var result = await SendAndSaveDelivery(ctx, cancellationToken);
|
var result = await SendAndSaveDelivery(ctx, cancellationToken);
|
||||||
if (ctx.WebhookBlob.AutomaticRedelivery &&
|
if (ctx.WebhookBlob.AutomaticRedelivery &&
|
||||||
!result.Success &&
|
!result.Success &&
|
||||||
result.DeliveryId is string)
|
result.DeliveryId is not null)
|
||||||
{
|
{
|
||||||
var originalDeliveryId = result.DeliveryId;
|
var originalDeliveryId = result.DeliveryId;
|
||||||
foreach (var wait in new[]
|
foreach (var wait in new[]
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace BTCPayServer.Security.Greenfield
|
||||||
{
|
{
|
||||||
if (Permission.TryParse(claim.Value, out var claimPermission))
|
if (Permission.TryParse(claim.Value, out var claimPermission))
|
||||||
{
|
{
|
||||||
if (requireUnscoped && claimPermission.Scope is string)
|
if (requireUnscoped && claimPermission.Scope is not null)
|
||||||
continue;
|
continue;
|
||||||
if (claimPermission.Contains(permission))
|
if (claimPermission.Contains(permission))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue