xunit.analyzers icon indicating copy to clipboard operation
xunit.analyzers copied to clipboard

Add xUnit1027: TestMethodShouldNotHaveReturnType

Open jamesqo opened this issue 8 years ago • 4 comments

Fixes xunit/xunit#1415

jamesqo avatar Aug 23 '17 01:08 jamesqo

FYI, I already checked in the descriptor name change for TheoryMethodShouldUseAllParameters

marcind avatar Sep 01 '17 01:09 marcind

@marcind Great, I'll back out those changes here then.

jamesqo avatar Sep 01 '17 01:09 jamesqo

@marcind I've un-WIPed this PR, so feel free to review when you have time.

jamesqo avatar Sep 01 '17 02:09 jamesqo

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 xUnit1027 so you'll need to move to xUnit1028
  • 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!

bradwilson avatar Aug 21 '21 22:08 bradwilson

Closing for age.

bradwilson avatar May 06 '23 21:05 bradwilson