I'm trying to setup Sonar on our organization that we mostly make Unity projects.
Our problem is that the rules provided to C# language are not always the same in Unity context.
1. In Unity there is a MonoBehaviour class that if you declare some methods (Awake, Start) they are being called by reflection:
So in this case I have tons of "Remove this unused private member".
Is there a way to tell, don't apply that rule if my class derives from MonoBehaviour (or AssetPostprocessor, etc...) and my method name is for example "Awake"? I mean, is there a way to set a custom rule and invalidate other one?
2. The same applies to Unity serialization system. You can have a private field with [SerializeField] attribute and it gets automatically initialized by Unity:
In this case I get tons of "Make "{FIELD}" "readonly"" if my field has a default value because it's Unity then who "fills" that value updated/changed from inspector but if I make it readonly it won't work in Unity's serialization system.
Thanks.