Add xUnit1027: TestMethodShouldNotHaveReturnType
Fixes xunit/xunit#1415
FYI, I already checked in the descriptor name change for TheoryMethodShouldUseAllParameters
@marcind Great, I'll back out those changes here then.
@marcind I've un-WIPed this PR, so feel free to review when you have time.
Sorry for the delay in getting back to this.
Upon reviewing the code and the discussion, I have two opinions:
- I want to be more conservative than Marcin did, I think, and am fine with it being explicitly limited to
[Fact]and[Theory]. - We definitely should be changing return statements in the fixer.
I had a few additional thoughts as well:
- I just merged in another rule as
xUnit1027so you'll need to move toxUnit1028 - The testing framework in use now is significantly different than it was in 2017, so tests will need to be ported (and the fixer moved to the fixer project, since analyzers and fixers live in different assemblies now)
- Once this change is merged, we should open an issue for analysis for v3 to also allow returning
ValueTask(but definitely limit this to tests that link in v3, and not v2).
I understand if your interest in this is long gone (again, apologies for the delays). If that's the case, feel free to just chime in and say you'd rather not make the changes and I'll look for some time in the future to do them myself, because I feel like this is a valuable feature.
Thanks!
Closing for age.