Check conventions with Roslyn analyzers
kevin-montrose opened this issue · 1 comments
kevin-montrose commented
There are a couple conventions in Cesil that should be checked by analyzers, rather than either a) not being checked or b) checked in tests with janky reflection.
They are (at time of writing):
AsyncTestHelper.IsCompletedSuccessfully()
is used instead of(Value)Task(<T>).IsCompletedSuccessfully
AwaitHelper.ConfigureCancellableAwait()
is called for all awaitables prior to them beingawait
'edBindingFlagsConstants
is used instead ofBindingFlags
- Every use of the null forgiving operators (ie. suffix-
!
) is annotated with an explanation - Members on
Throw
are called instead of athrow
statement orthrow
expression - Members on
Types
are used instead of atypeof()
expression - Non-public types don't have public members
There may be others to add in the future, but this is a good start.
It's possible to provide an analyzer as a project, so the path forward here is creating a Cesil.Analyzers
project and referencing it from the main Cesil
project.
kevin-montrose commented
Addressed by #20.