Fixed: Test for empty strings using isNullOrEmpty

This commit is contained in:
Qstick 2020-10-02 14:52:48 -04:00
parent 4ec71538b9
commit 7d31eb1f55
9 changed files with 10 additions and 12 deletions

View File

@ -185,8 +185,6 @@ dotnet_diagnostic.CA1814.severity = suggestion
dotnet_diagnostic.CA1815.severity = suggestion
dotnet_diagnostic.CA1816.severity = suggestion
dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1820.severity = suggestion
dotnet_diagnostic.CA1821.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
@ -488,7 +488,7 @@ namespace NzbDrone.Common.OAuth
private static bool IsNullOrBlank(string value)
{
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && value.Trim() == string.Empty);
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && string.IsNullOrEmpty(value.Trim()));
}
}
}

View File

@ -405,7 +405,7 @@ namespace NzbDrone.Common.OAuth
private static bool IsNullOrBlank(string value)
{
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && value.Trim() == string.Empty);
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && string.IsNullOrEmpty(value.Trim()));
}
}
}

View File

@ -3660,7 +3660,7 @@ namespace TinyIoC
var registrations = _RegisteredTypes.Keys.Where(tr => tr.Type == resolveType).Concat(GetParentRegistrationsForType(resolveType));
if (!includeUnnamed)
registrations = registrations.Where(tr => tr.Name != string.Empty);
registrations = registrations.Where(tr => !string.IsNullOrEmpty(tr.Name));
return registrations.Select(registration => this.ResolveInternal(registration, NamedParameterOverloads.Default, ResolveOptions.Default));
}

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Datastore.Migration
modifiers += "RQ";
}
if (modifiers != "")
if (!string.IsNullOrEmpty(modifiers))
{
modifiers = "_" + modifiers;
}

View File

@ -305,7 +305,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
var metadataFileName = GetMovieMetadataFilename(movieFile.RelativePath);
return xmlResult == string.Empty ? null : new MetadataFileResult(metadataFileName, xmlResult.Trim(Environment.NewLine.ToCharArray()));
return string.IsNullOrEmpty(xmlResult) ? null : new MetadataFileResult(metadataFileName, xmlResult.Trim(Environment.NewLine.ToCharArray()));
}
public override List<ImageFileResult> MovieImages(Movie movie)

View File

@ -348,7 +348,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return ""; // Other
}
if (videoCodecLibrary == "")
if (string.IsNullOrEmpty(videoCodecLibrary))
{
return ""; // Unknown mp4v
}

View File

@ -48,7 +48,7 @@ namespace NzbDrone.Core.Parser
if (isoArray.Length > 1)
{
isoLanguages = isoLanguages.Any(l => l.CountryCode == isoArray[1].ToLower()) ?
isoLanguages.Where(l => l.CountryCode == isoArray[1].ToLower()).ToList() : isoLanguages.Where(l => l.CountryCode == "").ToList();
isoLanguages.Where(l => l.CountryCode == isoArray[1].ToLower()).ToList() : isoLanguages.Where(l => string.IsNullOrEmpty(l.CountryCode)).ToList();
}
return isoLanguages.FirstOrDefault();

View File

@ -55,7 +55,7 @@ namespace NzbDrone.Mono.Disk
var target = 0;
for (var i = 0; i < dirs.Length; ++i)
{
if (dirs[i] == "." || dirs[i] == string.Empty)
if (dirs[i] == "." || string.IsNullOrEmpty(dirs[i]))
{
continue;
}