Skip to content

Commit

Permalink
Merge pull request #2783 from Evangelink/no-loop
Browse files Browse the repository at this point in the history
Avoid to use loop for only first element
  • Loading branch information
asbjornu authored Jul 29, 2021
2 parents 45f074b + 8a595c9 commit 893b865
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GitVersion.MsBuild/Helpers/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public static void DeleteTempFiles()

public static void CheckForInvalidFiles(IEnumerable<ITaskItem> compileFiles, string projectFile)
{
foreach (var compileFile in GetInvalidFiles(compileFiles, projectFile))
if (GetInvalidFiles(compileFiles, projectFile).FirstOrDefault() is { } invalidCompileFile)
{
throw new WarningException("File contains assembly version attributes which conflict with the attributes generated by GitVersion " + compileFile);
throw new WarningException("File contains assembly version attributes which conflict with the attributes generated by GitVersion " + invalidCompileFile);
}
}

Expand Down

0 comments on commit 893b865

Please sign in to comment.