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 being await'ed
BindingFlagsConstants is used instead of BindingFlags
Every use of the null forgiving operators (ie. suffix-!) is annotated with an explanation
Members on Throw are called instead of a throw statement or throw expression
Members on Types are used instead of a typeof() 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.
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
!
) is annotated with an explanationThrow
are called instead of athrow
statement orthrow
expressionTypes
are used instead of atypeof()
expressionThere 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 mainCesil
project.