Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[snippets] Add special exit for sln deleted #353

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
11 changes: 11 additions & 0 deletions snippets5000/PullRequestSimulations/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@
}
]
},
{
"Name": "Delete - SLN - Projects remain",
"CountOfEmptyResults": 1,
"ExpectedResults": null,
"Items": [
{
"ItemType": "Delete",
"Path": "snippets/good/normal/somefile.sln"
}
]
},
{
"Name": "Create - New project, is in old solution",
"ExpectedResults": [
Expand Down
4 changes: 4 additions & 0 deletions snippets5000/Snippets5000/PullRequestProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ private async IAsyncEnumerable<DiscoveryResult> FindAllSolutionsAndProjects(stri
bool allProjectsFoundInSln = false;
List<string> projectsFound = new List<string>();

// Special exit for solution deleted. Any artifacts left over should be caught by the other checks
if (Path.GetExtension(itemFileName).Equals(".sln", StringComparison.OrdinalIgnoreCase) && itemWasDeleted)
return null;

// Check for the project/solution to test with was found
FindProjectOrSolution(rootDir, itemPath, out string? project, out int countOfSln, out int countOfProjs, out int countOfCode, out int countOfSpecial, ref projectsFound);

Expand Down
Loading