Add acceptance tests to track nullable enabled directives#7869
Add acceptance tests to track nullable enabled directives#7869mchamberlin77 wants to merge 4 commits into
Conversation
|
I wonder whether we could follow the same approach as "TrimmabilityWarnings.cs", but build with nullable analysis enabled and approve the resulting nullable warnings. That would give us a stronger quality gate than tracking directories containing "#nullable enable". It would directly enforce that no new nullable warnings are introduced, while allowing the approved warning list to shrink as existing warnings are addressed. Once the approved list reaches zero, nullable warnings could be enabled directly for the project. To me, that seems like a higher-quality approval because it verifies the outcome we ultimately care about rather than the presence of the directive. |
The presence of the directive is something we should also care about though, since it's a good signifier that file has been looked at and evaluated. |
…to nullable-completed-directories-approval
@danielmarbach Good idea, I agree. I added a NullabilityWarnings.cs in the same style as the TrimmabilityWarnings.cs. |
Add two tests to help ensure progress towards adding nullable annotation context checks across the code base.
#nullable enabledirective.NullabilityWarnings.cs builds NServiceBus.Core with the nullable enable flag across the entire project and captures the nullability warnings generated from this. That is compared with the known set of warnings in the approval file. If the received file differs from the approved file a test failure occurs.
BuildIncompleteDirectoriesReport() generates a NullableEnable.IncompleteFolders.txt listing all directories with at least one file that does not have the directive. This test must be explicitly run and is used to get a report of what directories still need to be addressed.