Hi John,
I develop my own plugin and I’d like to do the same (multiple tabs in rule description, green/red highlighting). Could you please point to a code sample?
Thank you
Regards
Nicolas
Hi John,
I develop my own plugin and I’d like to do the same (multiple tabs in rule description, green/red highlighting). Could you please point to a code sample?
Thank you
Regards
Nicolas
Hi @Nicolas_Alcaraz,
I’m talking to the team to see if we can get some more information for you.
Best regards
John
Hi Nicolas,
I should have asked this before. Which programming language are you writing a plugin for?
Best regards
John
Hi John,
My boss told me that I cannot publicly tell what the language is and what it is about.
I can just tell you that it is a simple programming language developed internally for our own usage.
Anyway, it should not have any impact on the way to write rule descriptions.
I’m on the latest version of the sonar-plugin-api:
<dependency>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>10.1.0.809</version>
</dependency>
And on SonarQube 10.2.
Thanks for your help
Regards
Nicolas
Hi @Nicolas_Alcaraz ,
Apparently, https://github.com/SonarSource/sonar-php/tree/master/php-custom-rules is a good place to start. It is an example of a simple custom plugin for PHP. It was moved from GitHub - SonarSource/sonar-custom-rules-examples: Shows how to bootstrap a project to write custom rules for PHP, Python, Cobol, RPG. That repo contains more examples for different languages, but they can be outdated.
Good luck!
John
Hi John,
Thanks for the link. But it looks like there is no advanced rule descriptions with multiple tabs, green/red highlighting, etc.
Regards
Nicolas
Hi Nicolas,
It might be worth trying copying/pasting the contents of an existing rule with the capabilities you want over the top of the sample rule in the PHP example and see if that renders as you would expect. I don’t know if this will work though. This is how that rule looks today.
The alternative is digging into the API repo and documentation:
Good luck
John
Hi John,
Same as Syntax highlighting of code examples - #16 by Nicolas_Alcaraz, there must be an html processing somewhere because here’s what I get with the exact same html:
I’ll have a look at the PHP plugin. It looks like there’s an EducationRuleLoader class in sonar-analyzer-commons that might do the job.
Regards
Nicolas
I managed to achieve what I wanted to by using RuleMetadataLoader and its EducationRuleLoader.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.