Improve nullable analysis for IsNullOrWhiteSpace and IsNotNullOrWhiteSpace

This commit is contained in:
Bogdan 2026-05-02 11:27:41 +03:00
parent bf5d48c76a
commit f639ac0c8d
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Net.Sockets;
@ -93,15 +94,17 @@ public static string CleanSpaces(this string text)
return CollapseSpace.Replace(text, " ").Trim();
}
public static bool IsNullOrWhiteSpace(this string text)
#nullable enable
public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? text)
{
return string.IsNullOrWhiteSpace(text);
}
public static bool IsNotNullOrWhiteSpace(this string text)
public static bool IsNotNullOrWhiteSpace([NotNullWhen(true)] this string? text)
{
return !string.IsNullOrWhiteSpace(text);
}
#nullable disable
public static bool StartsWithIgnoreCase(this string text, string startsWith)
{

View file

@ -34,7 +34,7 @@ protected override bool IsValid(PropertyValidatorContext context)
return true;
}
var rootFolder = new DirectoryInfo(rootFolderPath!).Name;
var rootFolder = new DirectoryInfo(rootFolderPath).Name;
var series = seriesResource.ToModel();
var seriesFolder = _fileNameBuilder.GetSeriesFolder(series);