[InheritsTests]: opt-out instead of opt-in? #1977
-
hey @thomhurst thanks for tunit and keeping such pace in further development - very impressive 👍🏼 we were evaluating if we could switch from mstest to tunit. which is more or less possible by search and replace of some attributes. one of the problems we are facing is: we have close to 18.000 unit tests which are also organized by some inheritance. the analyzer gives warnings that when having inheritance we should use [InheritsTests] (I guess this could be for the genrerators to kick in). you can imagine that we've got a lots of analyzer warnings about the [InheritsTests] - which when having TreatWarningsAsErrors - fails the build. Instead of always "opting in" - is there any option to have it as "default" to inherit tests ... and - when not wanted - to have an option to opt-out? (I can't think of any circumstance why someone wnats to ... but anyways 😄 ) thanks for your feedback. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Thanks 😄 Unfortunately source generators have to look up something in order to do their job. They could look at just classes, but this means they're constantly firing on any change and leads to a slow and laggy IDE experience. The recommended method is to make it look at specific attributes instead, and that's why you have to use What I could do to help, is create a code fixer for that analyzer that adds the attribute for you. So you could run something like Would that be useful for you? |
Beta Was this translation helpful? Give feedback.
-
if that would be possible - I think that would be amazing. as far as I know code fixes could be applied to all warnings solution-wide. that would be appreciated. thanks! |
Beta Was this translation helpful? Give feedback.
Code fix should be in 0.16.1
Run it by doing
dotnet format --severity info --diagnostics TUnit0030