Hello @Sven.G, welcome to SonarSource community.
When working with custom rules a nice source of information is the Java analyzer itself, with hundreds of examples! I understand that the whole code is quite complex to understand, but many rule implementation themselves are not that complex, and I’m sure you can already find many information there.
For example, you correctly identified that valuesForAnnotation
could be useful. By looking at usages, I ended up on this code. By looking at the rule test file, it turns out that this code detects @Deprecated(forRemoval = true)
. I believe you can take inspiration from it.
In addition, as a general comment when writing rules, you will hardly ever have to rely on tokens. Always try to rely on Tree and helper methods.
Is there a blank template which has all necessary classes built in, where you just would need to add the classes described in the tutorial.
I understand the point, we will take it into account when we will eventually rework this tutorial. In the meantime, I believe identifying what is extra or not is not a big deal.