Currently we are using sonar-cobol-plugin in house, but now we want to add one rule to cobol. This rule is specific to our company, and basically consists in apply a regex, verify some content, and mark a issue.
For what I have read, Sonar can only have one plugin claiming one extension at a time. Is this a limitation?
If it is, how can I add a rule to COBOL through a plugin? How should I proceed?
Adding a custom rule (as suggested by Julien) is possible.
If you really don’t need the COBOL parsing capabilities of sonar-cobol to write your rules, you can also create a separate plugin which doesn’t “claim” COBOL extensions. That’s somehow what sonar-java does: it’s able to raise issues on pom.xml files which are XML files without causing any incompatibility with sonar-xml.
You can have a sensor which retrieves all files which SonarQube associates to the COBOL language (example for PHP) and raise issues on those files.
As you don’t declare the COBOL language to SonarQube, your plugin will be able to run alongside another plugin which declares the COBOL language (SonarCOBOL) but of course it will require this plugin to be present.