How to use SonarLint in IBM Rational developer for i (RDi)

Please provide

  • Operating system: Windows
  • SonarLint plugin version: 6.0.0.34844
  • Programming language you’re coding in: RPG
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): SonarQube Version 8.9.7

And a thorough description of the problem / question:

Question - Does Sonarlint support RPG language for IBMi ?

If yes -
We recently got Sonarlint plugin installed with RDi and are trying to understand steps for utilizing’s Sonarlint capabilities for real time code quality feedback.
Any documentation or steps explaining the steps to follow will be of great help. Thanks

Hi @digvijay2k2

Question - Does Sonarlint support RPG language for IBMi ?

Normally, yes. I can’t be 100% sure, since we don’t have access to an RDi environment to test on our side. But in the past, we collaborated with IBM folks to ensure Cobol + RPG analysis is working (for Cobol, there is extra integration needed in order to properly provide copybooks to our Cobol analyzer).

We recently got Sonarlint plugin installed with RDi and are trying to understand steps for utilizing’s Sonarlint capabilities for real time code quality feedback.

Assuming you managed to configure connected mode (creating a connection + binding your Eclipe/RDi project to the right SonarQube project), you should be good to use SonarLint for RPG.

SonarLint should automatically analyze code when you open a file, and every time you save a change, and display the issues in the SonarLint On-The-Fly view.

If you think something is not working, feel free to provide more details (like detailed logs) so that we can try to investigate.

Thank you Julien Henry for your prompt feedback !!
Will you have some additional info around ‘binding your Eclipe/RDi project to the right SonarQube project’ ?..looking for some guidance on where to start with.

Hi Julien Henry,

We created an iproject and enabled Sonarlint. Looks like it did get triggered when opening a RPG source though we are unable to find any analysis feedback even though there are code quality issues that violate SonarQube server rules defined in RPG quality profile.
Have attached an output of Sonarlint console, can you please review and let us know if we are missing something ?


SonarLint processing file /SonarLintTest/QRPGSRC/APE7UFR.RPG…
Standalone mode (project not bound)
Starting analysis with configuration:
[
baseDir: C:\Users\u012838\IBM\rationalsdp\workspace\SonarLintTest
extraProperties: {}
moduleKey: null
excludedRules:
includedRules:
ruleParameters: {}
inputFiles: [
file:/C:/Users/u012838/IBM/rationalsdp/workspace/SonarLintTest/QRPGSRC/APE7UFR.RPG (UTF-8)
]
]

Creating container for module with key=null
TypeScript sensor excluded
Start analysis
Index files
Language of file ‘file:/C:/Users/u012838/IBM/rationalsdp/workspace/SonarLintTest/QRPGSRC/APE7UFR.RPG’ is detected to be ‘RPG’
1 file indexed
‘JavaSensor’ skipped because there is no related file in current project
‘PHP sensor’ skipped because there is no related file in current project
‘Analyzer for “php.ini” files’ skipped because there is no related file in current project
‘Python Sensor’ skipped because there is no related file in current project
Execute Sensor: JavaXmlSensor
Execute Sensor: HTML
‘JavaScript analysis’ skipped because there is no related file in current project
Found 0 issue(s)
Done in 29 ms

Hi,

Thanks for the logs, it is useful. I can see that your project is not bound. So your are not in connected mode, and RPG analysis is not supported. Configuring a connection is not enough, you also have to configure the binding (= mapping) between your Eclipse IProject and your SonarQube project.
To do that, simply use the menu on your project:

Then pick the connection you have previously configured, and search for the appropriate SonarQube project to bind to.
You can verify the binding in the SonarLint Bindings view:

In my case (this is a Java multi-module project), I have bound multiple Eclipse projects to the same SonarQube project. Not sure this is a thing for RPG.

Thank you Julien Henry, we were able to bind and run a scan on a sample code though we are NOT getting real time code feedback . We will perform some more deep dive and reach out to you for assistance if unable to find a solution.