Writing a plugin that works across .h and .cpp files and sees comments

We have a rule where I work that above every virtual, override, final or static function implementation there has to be a comment, respectively /*virtual*/, /*override*/, /*final*/, /*static*/. I don't necessary agree with that rule, but for it to make any semblance of sense, I need to be sure that whole codebase adheres to it.

I've tried naively parsing the source files using python and regexes to check, but there are so  many edge cases that I though and haven't though of that I cannot guarantee I've identified every function and situation properly.

However, Rider is generating ASTs and must somehow hold references between it and the  actual text files. I'm looking to write my own plugin or extension for Rider or Resharper that would enable me to find all virtual, override, final or static functions in the project (using the AST) and check if the respective comment exists above the definition (hopefully using that mapping I suspect exsists).

I've since been looking into developing a plugin, but the whole process is a major pain. I've gotten IntelliJ community version and setup an empty plugin project. I've managed to specify to use my local Rider installation for testing, but I get prompted to enter a licence every time it starts, what's up with that?

Further more, the fact I'm trying to develop a plugin that analyzes C++ code in a nominaly C# IDE that rider is isn't helping. Am I supposed to develop a ReSharper plugin instead? What's the process there?

All I want to do is create an inspection that will look at a file, enumerate all functions in the file, find the ones I'm interested in, find their definitions and check if line above them in the source contains what I want.

Finally is there some kind of open source plugin for Rider (or ReSharper, if that's what I need) that I can take a look at to figure out how to set it up? I've looked at some, but the just didn't work. Are there any that are upto date?

1 comment

Hello Ivan,

We can guide you through this process in Slack. We have a dedicated shared Slack channel for plugin developers where we invite interested developers.

If you are interested, would you mind telling me your email?

If you are not comfortable sharing your email publicly, please share it with us using the Help | Contact Support action.

Have a nice day!


Please sign in to leave a comment.