Use ArgumentException.ThrowIfNullOrEmpty()

Proprietary

Replace if (string.IsNullOrEmpty(s)) throw new ArgumentException("...", nameof(s)) guard clauses with ArgumentException.ThrowIfNullOrEmpty(s). Available since .NET 7.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net7.UseThrowIfNullOrEmpty
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net7.UseThrowIfNullOrEmpty

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.