Skip to content

Commit

Permalink
code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Jul 25, 2023
1 parent 42cb54c commit 2b20108
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ private static (bool Exists, long ActualFreeMegabytes) GetSystemDriveInfo(string
return ( false, 0L );
}

var driveInfo = drivesList.FirstOrDefault(
drive => string.Equals(drive.Name, driveName, StringComparison.InvariantCultureIgnoreCase));
var driveInfo = Array.Find(drivesList,
drive => string.Equals(drive.Name, driveName,
StringComparison.InvariantCultureIgnoreCase));
return driveInfo?.AvailableFreeSpace != null ? (true, driveInfo.AvailableFreeSpace / 1024L / 1024L) : (false, 0L);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Task<HealthCheckResult> CheckHealthAsync(
$"Not configured"));

return Task.FromResult(
resultsList.Any(p => p == FolderOrFileModel.FolderOrFileTypeList.Deleted) ?
resultsList.Exists(p => p == FolderOrFileModel.FolderOrFileTypeList.Deleted) ?
new HealthCheckResult(context.Registration.FailureStatus, $"Configured path is not present on system") :
HealthCheckResult.Healthy("Configured path is present"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public string TagName {
set
{
if ( string.IsNullOrWhiteSpace(value)) return;
if ( !value.StartsWith("v") ) Console.WriteLine($"{_tagName} Should start with v");
if ( !value.StartsWith('v') ) Console.WriteLine($"{_tagName} Should start with v");
_tagName = value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ internal static KeyValuePair<UpdateStatus, string> Parse(IEnumerable<ReleaseMode
{
var orderedReleaseModelList = releaseModelList.OrderByDescending(p => p.TagName);
var tagName = orderedReleaseModelList.FirstOrDefault(p => !p.Draft && !p.PreRelease)?.TagName;
if ( string.IsNullOrWhiteSpace(tagName) || !tagName.StartsWith("v") )
if ( string.IsNullOrWhiteSpace(tagName) ||
!tagName.StartsWith('v') )
{
return new KeyValuePair<UpdateStatus, string>(UpdateStatus.NoReleasesFound,string.Empty);
}

try
{
Expand Down
2 changes: 1 addition & 1 deletion starsky/starsky.feature.import/Services/Import.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public async Task<List<ImportIndexItem>> Preflight(List<string> fullFilePathsLis
var parentFolder = Directory.GetParent(itemSourceFullFilePath)
?.FullName;

if ( parentFolders.All(p => p.Item1 != parentFolder) )
if ( parentFolders.TrueForAll(p => p.Item1 != parentFolder) )
{
parentFolders.Add(new Tuple<string?, List<string>>(parentFolder, new List<string>{itemSourceFullFilePath}));
continue;
Expand Down

0 comments on commit 2b20108

Please sign in to comment.