HerpeDerpeDerp
Getting started with source analyzers
I'm working on a rather large project and to keep myself from making certain mistakes in the future I need to make sure I never create fields or properties of certain types, with some specific exceptions. Since there is nothing in the language to enforce this I thought I could maybe write a code analyzer for this. However I have never written an analyzer before. Although I can easily find all the technical details online, I have some questions regarding conventions/convenience for the structure of the project(s). I will be using the analyzer exclusively in a single solution (class library and some small console applications spanning many projects, 100k+ lines of code) and will need to use types defined in this solution. Should I create my analyzers inside this solution or outside of it? Do I put all analyzers in a single project or do I keep them separate from each other? Does anyone have any general advice for someone getting started with this, any pitfalls to avoid?
21 replies